0.9.13.16: preliminary Windows installer builder
[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 . ../sbcl-pwd.sh
30 sbcl_pwd
31
32 SBCL_HOME=$SBCL_PWD/../contrib
33 export SBCL_HOME
34 sbclstem=$SBCL_PWD/../src/runtime/sbcl
35
36 SBCL="$sbclstem --core $SBCL_PWD/../output/sbcl.core --noinform --sysinit /dev/null --userinit /dev/null --noprint --disable-debugger"
37 export SBCL
38 echo /running tests on SBCL=\'$SBCL\'
39 # more or less like SBCL, but without enough grot removed that appending
40 # a --core command line argument works
41 #
42 # (KLUDGE: and also without any magic to suppress --userinit and
43 # --sysinit, so if you use it in a test, you need to add those
44 # yourself if you want things to be clean. If many tests start using
45 # this, we can redo it as a shell function or something so that the
46 # magic can be done once and only once.). Not used in this file, but
47 # exists for the benefit of the *.test.sh files that can be started by
48 # run-tests.lisp
49 SBCL_ALLOWING_CORE=$sbclstem
50 export SBCL_ALLOWING_CORE
51 echo /with SBCL_ALLOWING_CORE=\'$SBCL_ALLOWING_CORE\'
52
53 LANG=C
54 LC_ALL=C
55 export LANG
56 export LC_ALL
57
58 # "Ten four" is the closest numerical slang I can find to "OK", so
59 # it's the Unix status value that we expect from a successful test.
60 # (Of course, zero is the usual success value, but we don't want to
61 # use that because SBCL returns that by default, so we might think
62 # we passed a test when in fact some error caused us to exit SBCL
63 # in a weird unexpected way. In contrast, 104 is unlikely to be
64 # returned unless we exit through the intended explicit "test
65 # successful" path.
66 tenfour () {
67     if [ $1 = 104 ]; then
68         echo ok
69     else
70         echo test $2 failed, expected 104 return code, got $1
71         exit 1
72     fi
73 }
74
75 $SBCL --eval '(with-compilation-unit () (load "run-tests.lisp"))' \
76   --eval '(run-tests::run-all)' $*
77
78 tenfour $?
79
80 echo '//apparent success (reached end of run-tests.sh normally)'
81 date