1.0.4.12: stale bugs
[sbcl/lichteblau.git] / tests / core.test.sh
blob1c5a0cf8a42961ec2e5bc3c9b38c50416b66092a
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" --eval '(quit :unix-status 71)'
71 if [ $? != 71 ]; then
72 echo "failure in banner suppression: $?"
73 exit 1
74 elif [ -s "$tmpoutput" ]; then
75 echo "failure in banner suppression: nonempty output:"
76 echo ---
77 cat "$tmpoutput"
78 echo ---
79 exit 1
80 elif [ -f "$tmpoutput" ]; then
81 echo "/Executable suppressed banner, good."
82 else
83 echo "failure in banner suppression: $tmpoutput was not created or something funny happened."
84 exit 1
87 rm -f "$tmpcore"
88 rm -f "$tmpoutput"
89 echo "/returning success from core.test.sh"
90 exit 104