3 # Run the regression tests in this directory.
5 # This software is part of the SBCL system. See the README file for
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
12 # This software is in the public domain and is provided with
13 # absolutely no warranty. See the COPYING and CREDITS files for
16 # how we invoke SBCL in the tests
18 # Until sbcl-0.6.12.8, the shell variable SBCL was bound to a relative
19 # pathname, but now we take care to bind it to an absolute pathname (still
20 # generated relative to `pwd` in the tests/ directory) so that tests
21 # can chdir before invoking SBCL and still work.
22 sbclstem=`pwd`/../src/runtime/sbcl
23 SBCL="${1:-$sbclstem --core `pwd`/../output/sbcl.core --noinform --sysinit /dev/null --userinit /dev/null --noprint --disable-debugger}"
25 echo /running tests on SBCL=\'$SBCL\'
26 # more or less like SBCL, but without enough grot removed that appending
27 # a --core command line argument works
29 # (KLUDGE: and also without any magic to suppress --userinit and
30 # --sysinit, so if you use it in a test, you need to add those
31 # yourself if you want things to be clean. If many tests start using
32 # this, we can redo it as a shell function or something so that the
33 # magic can be done once and only once.)
34 SBCL_ALLOWING_CORE=${1:-$sbclstem}
35 export SBCL_ALLOWING_CORE
36 echo /with SBCL_ALLOWING_CORE=\'$SBCL_ALLOWING_CORE\'
38 # "Ten four" is the closest numerical slang I can find to "OK", so
39 # it's the Unix status value that we expect from a successful test.
40 # (Of course, zero is the usual success value, but we don't want to
41 # use that because SBCL returns that by default, so we might think
42 # we passed a test when in fact some error caused us to exit SBCL
43 # in a weird unexpected way. In contrast, 104 is unlikely to be
44 # returned unless we exit through the intended explicit "test
50 echo test $2 failed, expected 104 return code, got $1
55 # *.pure.lisp files are ordinary Lisp code with no side effects,
56 # and we can run them all in a single Lisp process.
57 echo //running '*.pure.lisp' tests
58 echo //i.e. *.pure.lisp
61 echo " (progn (format t \"//loading assertoid.lisp~%\") (load \"assertoid.lisp\"))"
62 echo " (use-package \"ASSERTOID\")"
63 for f in *.pure.lisp; do
65 echo " (progn (format t \"//running $f test~%\") (load \"$f\"))"
68 echo " (sb-ext:quit :unix-status 104)) ; Return status=success."
69 ) | $SBCL ; tenfour $? "(pure.lisp files)"
71 # *.impure.lisp files are Lisp code with side effects (e.g. doing
72 # DEFSTRUCT or DEFTYPE or DEFVAR, or messing with the read table).
73 # Each one should be LOADed in a separate invocation of Lisp, so
74 # that we don't need to worry about them interfering with each
76 echo //running '*.impure.lisp' tests
77 for f in *.impure.lisp; do
79 echo //running $f test
80 echo "(load \"$f\")" | $SBCL ; tenfour $? $f
84 # *.test.sh files are scripts to test stuff, typically stuff which
85 # can't so easily be tested within Lisp itself. A file foo.test.sh
86 # may be associated with other files foo*, e.g. foo.lisp, foo-1.lisp,
88 echo //running '*.test.sh' tests
89 for f in *.test.sh; do
91 echo //running $f test
92 sh $f "$SBCL"; tenfour $? $f
96 # *.assertoids files contain ASSERTOID statements to test things
97 # interpreted and at various compilation levels.
98 echo //running '*.assertoids' tests
99 for f in *.assertoids; do
101 echo //running $f test
102 echo "(load \"$f\")" | $SBCL --eval '(load "assertoid.lisp")' ; tenfour $? $f
106 # *.pure-cload.lisp files want to be compiled, then loaded. They
107 # can all be done in the same invocation of Lisp.
108 echo //running '*.pure-cload.lisp' tests
109 for f in *.pure-cload.lisp; do
110 # (Actually here we LOAD each one into a separate invocation
111 # of Lisp just because I haven't figured out a concise way
112 # to LOAD them all into the same Lisp.)
114 echo //running $f test
115 $SBCL <<EOF ; tenfour $? $f
120 (ignore-errors (delete-file (compile-file-pathname "$f"))))
121 (sb-ext:quit :unix-status 104))
126 # *.impure-cload.lisp files want to be compiled, then loaded. They
127 # can have side effects, so each one should be done in a separate
128 # invocation of Lisp so that they don't interfere.
129 echo //running '*.impure-cload.lisp' tests
130 for f in *.impure-cload.lisp; do
132 echo //running $f test
133 $SBCL <<EOF ; tenfour $? $f
138 (ignore-errors (delete-file (compile-file-pathname "$f"))))
139 (sb-ext:quit :unix-status 104))
144 # (*.before-xc.lisp and *.after-xc.lisp files aren't handled in this
145 # script at all. They're tests intended to run in the cross-compiler,
146 # so that some functionality can be tested even when cold init doesn't
149 echo '//apparent success (reached end of run-tests.sh normally)'