3 # tests related to .core files
5 # This software is part of the SBCL system. See the README file for
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
12 # This software is in the public domain and is provided with
13 # absolutely no warranty. See the COPYING and CREDITS files for
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
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
29 (defun foo (x) (+ x 11))
30 (save-lisp-and-die "$tmpcore")
32 $SBCL_ALLOWING_CORE --core "$tmpcore" \
33 --userinit /dev
/null
--sysinit /dev
/null
<<EOF
34 (quit :unix-status (foo 10))
37 echo "/Basic SAVE-LISP-AND-DIE worked, good."
39 echo "failure in basic SAVE-LISP-AND-DIE: $?"
43 # In sbcl-0.9.8 saving cores with callbacks didn't work on gencgc platforms
46 (format t "~&Callbacks not supported, skipping~%")
47 (quit :unix-status 42))
50 (sb-alien::define-alien-callback foo int () 42)
51 (defun bar () (quit :unix-status (alien-funcall foo))))
52 (save-lisp-and-die "$tmpcore")
54 $SBCL_ALLOWING_CORE --core "$tmpcore" \
55 --userinit /dev
/null
--sysinit /dev
/null
<<EOF
59 echo "/Callbacks after SAVE-LISP-AND-DIE worked, good."
61 echo "failure in basic SAVE-LISP-AND-DIE: $?"
65 # test suppression of banner in executable cores
67 (save-lisp-and-die "$tmpcore" :executable t)
70 .
/"$tmpcore" >"$tmpoutput" \
71 --no-userinit --no-sysinit --eval '(quit :unix-status 71)'
73 echo "failure in banner suppression: $?"
75 elif [ -s "$tmpoutput" ]; then
76 echo "failure in banner suppression: nonempty output:"
81 elif [ -f "$tmpoutput" ]; then
82 echo "/Executable suppressed banner, good."
84 echo "failure in banner suppression: $tmpoutput was not created or something funny happened."
90 echo "/returning success from core.test.sh"