0.6.8.25:
[sbcl.git] / tests / run-tests.sh
1 #!/bin/sh
2
3 # Run the regression tests in this directory.
4
5 # This software is part of the SBCL system. See the README file for
6 # more information.
7 #
8 # While most of SBCL is derived from the CMU CL system, the test
9 # files (like this one) were written from scratch after the fork
10 # from CMU CL.
11
12 # This software is in the public domain and is provided with
13 # absolutely no warranty. See the COPYING and CREDITS files for
14 # more information.
15
16 # how we invoke SBCL
17 sbcl=${1:-../src/runtime/sbcl --core ../output/sbcl.core --noinform --noprint --noprogrammer}
18
19 # "Ten four" is the closest numerical slang I can find to "OK", so
20 # it's the return value that we expect from a successful test.
21 tenfour () {
22     if [ $? = 104 ]; then
23         echo ok
24     else
25         echo test failed: $?
26         exit 1
27     fi
28 }
29
30 # *.pure.lisp files are ordinary Lisp code with no side effects,
31 # and we can run them all in a single Lisp process.
32 echo //running '*.pure.lisp' tests
33 echo //i.e. *.pure.lisp
34 (for f in *.pure.lisp; do
35     echo "(progn"
36     if [ -f $f ]; then
37         echo "  (progn (format t \"//running $f test~%\") (load \"$f\"))"
38     fi
39     echo "  (sb-ext:quit :unix-status 104))"
40 done) | $sbcl ; tenfour
41
42 # *.impure.lisp files are Lisp code with side effects (e.g. doing DEFSTRUCT
43 # or DEFTYPE or DEFVAR). Each one needs to be run as a separate
44 # invocation of Lisp.
45 echo //running '*.impure.lisp' tests
46 for f in *.impure.lisp; do
47     if [ -f $f ]; then
48         echo //running $f test
49         echo "(load \"$f\")" | $sbcl ; tenfour
50     fi
51 done
52
53 # *.test.sh files are scripts to test stuff, typically stuff which can't
54 # so easily be tested within Lisp itself. A file foo.test.sh
55 # may be associated with other files foo*, e.g. foo.lisp, foo-1.lisp,
56 # or foo.pl.
57 echo //running '*.test.sh' tests
58 for f in *.test.sh; do
59     if [ -f $f ]; then
60         echo //running $f test
61         sh $f ; tenfour
62     fi
63 done
64
65 # *.assertoids files contain ASSERTOID statements to test things
66 # interpreted and at various compilation levels.
67 echo //running '*.assertoids' tests
68 for f in *.assertoids; do
69     if [ -f $f ]; then
70         echo //running $f test
71         echo "(load \"$f\")" | $sbcl --eval '(load "assertoid.lisp")' ; tenfour
72     fi
73 done