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
20 tmpcore
=$TEST_FILESTEM.core
21 tmpoutput
=$TEST_FILESTEM.txt
23 # In sbcl-0.7.7 SAVE-LISP-AND-DIE didn't work at all because of
24 # flakiness caused by consing/GC/purify twice-and-at-least-twice
27 # "serves yall right for fiddling with too much stuff"
28 # -- Eric Marsden, <http://tunes.org/~nef/logs/lisp/02.09.15>
30 # diagnosed and fixed by Dan Barlow in sbcl-0.7.7.29
32 (defun foo (x) (+ x 11))
33 (save-lisp-and-die "$tmpcore")
35 run_sbcl_with_core
"$tmpcore" --no-userinit --no-sysinit <<EOF
36 (quit :unix-status (foo 10))
38 check_status_maybe_lose
"Basic SAVE-LISP-AND-DIE" $?
21 "(saved core ran)"
40 # In sbcl-0.9.8 saving cores with callbacks didn't work on gencgc platforms
43 (format t "~&Callbacks not supported, skipping~%")
44 (quit :unix-status 42))
47 (sb-alien::define-alien-callback foo int () 42)
48 (defun bar () (quit :unix-status (alien-funcall foo))))
49 (save-lisp-and-die "$tmpcore")
51 run_sbcl_with_core
"$tmpcore" --no-userinit --no-sysinit <<EOF
54 check_status_maybe_lose
"Callbacks after SAVE-LISP-AND-DIE" $? \
55 42 "(callback function ran)"
57 # test suppression of banner in executable cores
59 (save-lisp-and-die "$tmpcore" :executable t)
62 .
/"$tmpcore" > "$tmpoutput" --no-userinit --no-sysinit --noprint <<EOF
63 (quit :unix-status 71)
66 if [ $status != 71 ]; then
67 echo "failure in banner suppression: $status"
69 elif [ -s "$tmpoutput" ]; then
70 echo "failure in banner suppression: nonempty output:"
75 elif [ -f "$tmpoutput" ]; then
76 echo "/Executable suppressed banner, good."
78 echo "failure in banner suppression: $tmpoutput was not created or something funny happened."