0.9.8.27:
[sbcl.git] / tests / run-tests.sh
1 #!/bin/sh
2
3 # Run the regression tests in this directory.
4 #
5 # Usage: run-tests.sh [--break-on-failure] [--break-on-expected-failure] [files]
6 #  --break-on-failure            Break into the debugger when a test fails
7 #                                unexpectedly
8 #  --break-on-expected-failure   Break into the debugger when any test fails
9 #
10 # If no test files are specified, runs all tests.
11
12 # This software is part of the SBCL system. See the README file for
13 # more information.
14 #
15 # While most of SBCL is derived from the CMU CL system, the test
16 # files (like this one) were written from scratch after the fork
17 # from CMU CL.
18 #
19 # This software is in the public domain and is provided with
20 # absolutely no warranty. See the COPYING and CREDITS files for
21 # more information.
22
23 # how we invoke SBCL in the tests
24 #
25 # Until sbcl-0.6.12.8, the shell variable SBCL was bound to a relative
26 # pathname, but now we take care to bind it to an absolute pathname (still
27 # generated relative to `pwd` in the tests/ directory) so that tests
28 # can chdir before invoking SBCL and still work.
29 sbclstem=`pwd`/../src/runtime/sbcl
30 SBCL="$sbclstem --core `pwd`/../output/sbcl.core --noinform --sysinit /dev/null --userinit /dev/null --noprint --disable-debugger"
31 export SBCL
32 echo /running tests on SBCL=\'$SBCL\'
33 # more or less like SBCL, but without enough grot removed that appending
34 # a --core command line argument works
35 #
36 # (KLUDGE: and also without any magic to suppress --userinit and
37 # --sysinit, so if you use it in a test, you need to add those
38 # yourself if you want things to be clean. If many tests start using
39 # this, we can redo it as a shell function or something so that the
40 # magic can be done once and only once.). Not used in this file, but
41 # exists for the benefit of the *.test.sh files that can be started by
42 # run-tests.lisp
43 SBCL_ALLOWING_CORE=$sbclstem
44 export SBCL_ALLOWING_CORE
45 echo /with SBCL_ALLOWING_CORE=\'$SBCL_ALLOWING_CORE\'
46
47 LANG=C
48 LC_ALL=C
49 export LANG
50 export LC_ALL
51
52 # "Ten four" is the closest numerical slang I can find to "OK", so
53 # it's the Unix status value that we expect from a successful test.
54 # (Of course, zero is the usual success value, but we don't want to
55 # use that because SBCL returns that by default, so we might think
56 # we passed a test when in fact some error caused us to exit SBCL
57 # in a weird unexpected way. In contrast, 104 is unlikely to be
58 # returned unless we exit through the intended explicit "test
59 # successful" path.
60 tenfour () {
61     if [ $1 = 104 ]; then
62         echo ok
63     else
64         echo test $2 failed, expected 104 return code, got $1
65         exit 1
66     fi
67 }
68
69 $SBCL --eval '(with-compilation-unit () (load "run-tests.lisp"))' \
70   --eval '(run-tests::run-all)' $*
71
72 tenfour $?
73
74 echo '//apparent success (reached end of run-tests.sh normally)'
75 date