Trust non-returning functions during sb-xc.
[sbcl.git] / tests / run-sbcl.test.sh
blob98995bf38ff2655babd6db5e854dd7a8649407fe
1 set -e
3 . ./subr.sh
5 # run-sbcl.sh's pathname munging turns out always to have been
6 # insufficient in one way or another.
7 test_run_sbcl() (
8 set -e
9 args='--noinform --no-userinit --no-sysinit --disable-debugger --quit'
10 #set -x # uncomment for eyeball debugging
11 ## There are three ways run-sbcl.sh can fail or set things up badly.
12 # (1) run-sbcl.sh will refuse to run because there are no build
13 # artifacts relative to $run_sbcl_path.
14 "$1" $args
15 # (2) SBCL will start, but if SBCL_HOME is wrong, will be unable to
16 # load contribs. (This is what 9d5be5e953 partially addressed.)
17 "$1" $args --eval '(require :sb-posix)'
18 # (3) SBCL will start, but if SBCL_HOME is a relative pathname,
19 # then loading contribs will be sensitive to the dynamic value of
20 # *DEFAULT-PATHNAME-DEFAULTS*. (There appears not to be consensus
21 # whether SBCL ought to make SBCL-HOMEDIR-PATHNAME absolute during
22 # startup, so holding that aside, run-sbcl.sh has to.)
24 # In order to ensure that MODULE-PROVIDE-CONTRIB can't succeed
25 # when SBCL-HOMEDIR-PATHNAME is relative, we'll construct a
26 # default directory pathname known not to exist, so that any merge
27 # with it will also not exist.
28 "$1" $args --eval '(setq *default-pathname-defaults*
29 (loop for i upfrom 0 below 1000
30 as directory
31 = (pathname
32 (format nil "/nosuchdir.~d/" i))
33 unless (probe-file directory)
34 return directory
35 finally
36 (error "test setup failure")))' \
37 --eval '(require :sb-posix)'
40 # Sanity check: test the file in our build tree a couple of ways.
41 echo "testing run-sbcl.sh with an absolute path"
42 test_run_sbcl "$PWD"/../run-sbcl.sh
44 echo "testing run-sbcl.sh with a relative path"
45 test_run_sbcl ../run-sbcl.sh
47 # Next, test a couple ways that run-sbcl.sh could be invoked via a
48 # symlink. We'll need an absolute path to run-sbcl.sh in our build
49 # tree in order to construct symlinks that point to it.
50 if expr "$0" : "^[^/].*" > /dev/null; then
51 test_file_directory_path="$(cd ./$(dirname "$0") && pwd)"
53 # Now we can derive an absolute path to run-sbcl.sh relative to this
54 # file.
55 run_sbcl_path="$test_file_directory_path/../run-sbcl.sh"
57 # Now we're going to frob the file system, so let's do it properly.
58 # (for some definition of "properly?")
59 use_test_subdirectory_in_source_tree
61 # 9d5be5e953 (lp#1242643) addressed the possibility that run-sbcl.sh
62 # was a symlink into the repo. Let's exercise it, 8 years later.
63 echo "testing run-sbcl.sh when it's a symlink to an absolute path"
64 ln -s "$run_sbcl_path" ./run-sbcl-absolute-symlink.sh
65 test_run_sbcl ./run-sbcl-absolute-symlink.sh
66 rm ./run-sbcl-absolute-symlink.sh
68 # Test whether we can run-sbcl.sh through a symlink to a relative
69 # path.
70 echo "testing run-sbcl.sh when it's a symlink to a relative path"
71 # good god, what does this sed command even do?
72 ln -s $(pwd | sed 's|^/||; s|[^/][^/]*|..|g')/"$run_sbcl_path" ./run-sbcl-relative-symlink.sh
73 test_run_sbcl ./run-sbcl-relative-symlink.sh
74 rm ./run-sbcl-relative-symlink.sh
76 # Test whether we can run-sbcl.sh named using a path to the build
77 # directory that contains a space.
78 echo "testing run-sbcl.sh named by a path containing spaces"
79 ln -s `dirname $run_sbcl_path` ./'a b'
80 # Prior to 4a30189fbc, run-sbcl.sh would start the runtime using the
81 # core file path ./a b/output/sbcl.core, but unquoted.
82 # After 4a30189fbc, the path to the core file will be
83 # ${PWD}/a b/output/sbcl.core, still unquoted.
84 # 546416b34d changed the core file path handling to ensure
85 # it's always quoted.
86 test_run_sbcl "./a b/run-sbcl.sh"
88 exit $EXIT_TEST_WIN