1.0.12.13: sequence optimizations: SUBSEQ, part 3
[sbcl.git] / tests / core.test.sh
blob1fd0ad4a7532bdb3f91ab1a9749e7188497efedc
1 #!/bin/sh
3 # tests related to .core files
5 # This software is part of the SBCL system. See the README file for
6 # more information.
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.
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.
16 tmpcore="core-test-sh-$$.core"
17 tmpoutput="core-test-sh-$$.output.txt"
18 rm -f "$tmpcore" "$tmpoutput"
20 # In sbcl-0.7.7 SAVE-LISP-AND-DIE didn't work at all because of
21 # flakiness caused by consing/GC/purify twice-and-at-least-twice
22 # mismatch grot.
24 # "serves yall right for fiddling with too much stuff"
25 # -- Eric Marsden, <http://tunes.org/~nef/logs/lisp/02.09.15>
27 # diagnosed and fixed by Dan Barlow in sbcl-0.7.7.29
28 $SBCL <<EOF
29 (defun foo (x) (+ x 11))
30 (save-lisp-and-die "$tmpcore")
31 EOF
32 $SBCL_ALLOWING_CORE --core "$tmpcore" \
33 --userinit /dev/null --sysinit /dev/null <<EOF
34 (quit :unix-status (foo 10))
35 EOF
36 if [ $? = 21 ]; then
37 echo "/Basic SAVE-LISP-AND-DIE worked, good."
38 else
39 echo "failure in basic SAVE-LISP-AND-DIE: $?"
40 exit 1
43 # In sbcl-0.9.8 saving cores with callbacks didn't work on gencgc platforms
44 $SBCL <<EOF
45 (defun bar ()
46 (format t "~&Callbacks not supported, skipping~%")
47 (quit :unix-status 42))
48 #+alien-callbacks
49 (progn
50 (sb-alien::define-alien-callback foo int () 42)
51 (defun bar () (quit :unix-status (alien-funcall foo))))
52 (save-lisp-and-die "$tmpcore")
53 EOF
54 $SBCL_ALLOWING_CORE --core "$tmpcore" \
55 --userinit /dev/null --sysinit /dev/null <<EOF
56 (bar)
57 EOF
58 if [ $? = 42 ]; then
59 echo "/Callbacks after SAVE-LISP-AND-DIE worked, good."
60 else
61 echo "failure in basic SAVE-LISP-AND-DIE: $?"
62 exit 1
65 # test suppression of banner in executable cores
66 $SBCL <<EOF
67 (save-lisp-and-die "$tmpcore" :executable t)
68 EOF
69 chmod u+x "$tmpcore"
70 ./"$tmpcore" >"$tmpoutput" \
71 --no-userinit --no-sysinit --eval '(quit :unix-status 71)'
72 if [ $? != 71 ]; then
73 echo "failure in banner suppression: $?"
74 exit 1
75 elif [ -s "$tmpoutput" ]; then
76 echo "failure in banner suppression: nonempty output:"
77 echo ---
78 cat "$tmpoutput"
79 echo ---
80 exit 1
81 elif [ -f "$tmpoutput" ]; then
82 echo "/Executable suppressed banner, good."
83 else
84 echo "failure in banner suppression: $tmpoutput was not created or something funny happened."
85 exit 1
88 rm -f "$tmpcore"
89 rm -f "$tmpoutput"
90 echo "/returning success from core.test.sh"
91 exit 104