0.6.10.11:
[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 Unix status value that we expect from a successful test.
21 # (Of course, zero is the usual success value, but we don't want to
22 # use that because SBCL returns that by default, so we might think
23 # we passed a test when in fact some error caused us to exit SBCL
24 # in a weird unexpected way. In contrast, 104 is unlikely to be
25 # returned unless we exit through the intended explicit "test
26 # successful" path.
27 tenfour () {
28     if [ $? = 104 ]; then
29         echo ok
30     else
31         echo test failed: $?
32         exit 1
33     fi
34 }
35
36 # *.pure.lisp files are ordinary Lisp code with no side effects,
37 # and we can run them all in a single Lisp process.
38 echo //running '*.pure.lisp' tests
39 echo //i.e. *.pure.lisp
40 (
41 echo "(progn"
42 for f in *.pure.lisp; do
43     if [ -f $f ]; then
44         echo "  (progn (format t \"//running $f test~%\") (load \"$f\"))"
45     fi
46 done
47 echo "  (sb-ext:quit :unix-status 104)) ; Return status=success."
48 ) | $sbcl ; tenfour
49
50 # *.impure.lisp files are Lisp code with side effects (e.g. doing DEFSTRUCT
51 # or DEFTYPE or DEFVAR). Each one needs to be run as a separate
52 # invocation of Lisp.
53 echo //running '*.impure.lisp' tests
54 for f in *.impure.lisp; do
55     if [ -f $f ]; then
56         echo //running $f test
57         echo "(load \"$f\")" | $sbcl ; tenfour
58     fi
59 done
60
61 # *.test.sh files are scripts to test stuff, typically stuff which can't
62 # so easily be tested within Lisp itself. A file foo.test.sh
63 # may be associated with other files foo*, e.g. foo.lisp, foo-1.lisp,
64 # or foo.pl.
65 echo //running '*.test.sh' tests
66 for f in *.test.sh; do
67     if [ -f $f ]; then
68         echo //running $f test
69         sh $f ; tenfour
70     fi
71 done
72
73 # *.assertoids files contain ASSERTOID statements to test things
74 # interpreted and at various compilation levels.
75 echo //running '*.assertoids' tests
76 for f in *.assertoids; do
77     if [ -f $f ]; then
78         echo //running $f test
79         echo "(load \"$f\")" | $sbcl --eval '(load "assertoid.lisp")' ; tenfour
80     fi
81 done
82
83 echo '//apparent success (reached end of run-tests.sh normally)'