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
24 (save-lisp-and-die "$tmpcore" :toplevel (lambda () 42))
26 run_sbcl_with_core
"$tmpcore" --no-userinit --no-sysinit \
27 --eval "(setf sb-ext:*evaluator-mode* :${TEST_SBCL_EVALUATOR_MODE:-compile})"
28 check_status_maybe_lose
"SAVE-LISP-AND-DIE :TOPLEVEL" $?
0 "(saved core ran)"
30 # In sbcl-0.7.7 SAVE-LISP-AND-DIE didn't work at all because of
31 # flakiness caused by consing/GC/purify twice-and-at-least-twice
34 # "serves yall right for fiddling with too much stuff"
35 # -- Eric Marsden, <http://tunes.org/~nef/logs/lisp/02.09.15>
37 # diagnosed and fixed by Dan Barlow in sbcl-0.7.7.29
39 (defun foo (x) (+ x 11))
40 (save-lisp-and-die "$tmpcore")
42 run_sbcl_with_core
"$tmpcore" --no-userinit --no-sysinit \
43 --eval "(setf sb-ext:*evaluator-mode* :${TEST_SBCL_EVALUATOR_MODE:-compile})" \
47 check_status_maybe_lose
"Basic SAVE-LISP-AND-DIE" $?
21 "(saved core ran)"
49 # In sbcl-0.9.8 saving cores with callbacks didn't work on gencgc platforms
52 (format t "~&Callbacks not supported, skipping~%")
56 (sb-alien::define-alien-callback foo int () 42)
57 (defun bar () (exit :code (alien-funcall foo))))
58 (save-lisp-and-die "$tmpcore")
60 run_sbcl_with_core
"$tmpcore" --no-userinit --no-sysinit \
61 --eval "(setf sb-ext:*evaluator-mode* :${TEST_SBCL_EVALUATOR_MODE:-compile})" \
65 check_status_maybe_lose
"Callbacks after SAVE-LISP-AND-DIE" $? \
66 42 "(callback function ran)"
68 # test suppression of banner in executable cores
70 (save-lisp-and-die "$tmpcore" :executable t)
73 .
/"$tmpcore" > "$tmpoutput" --no-userinit --no-sysinit --noprint <<EOF
77 if [ $status != 71 ]; then
78 echo "failure in banner suppression: $status"
80 elif [ -s "$tmpoutput" ]; then
81 echo "failure in banner suppression: nonempty output:"
86 elif [ -f "$tmpoutput" ]; then
87 echo "/Executable suppressed banner, good."
89 echo "failure in banner suppression: $tmpoutput was not created or something funny happened."
93 # saving runtime options _from_ executable cores
95 (save-lisp-and-die "$tmpcore" :executable t)
98 .
/"$tmpcore" --no-userinit <<EOF
99 (save-lisp-and-die "$tmpcore" :executable t :save-runtime-options t)
102 .
/"$tmpcore" --no-userinit --version --eval '(exit)' <<EOF
103 (when (equal *posix-argv* '("./$tmpcore" "--version" "--eval" "(exit)"))
107 if [ $status != 42 ]; then
108 echo "saving runtime options from executable failed"
114 (save-lisp-and-die "$tmpcore" :toplevel (lambda () 42)
115 :compression (and (member :sb-core-compression *features*) t))
117 run_sbcl_with_core
"$tmpcore" --no-userinit --no-sysinit \
118 --eval "(setf sb-ext:*evaluator-mode* :${TEST_SBCL_EVALUATOR_MODE:-compile})"
119 check_status_maybe_lose
"SAVE-LISP-AND-DIE :COMPRESS" $?
0 "(compressed saved core ran)"
123 (save-lisp-and-die "$tmpcore" :toplevel (lambda () 42) :executable t
124 :compression (and (member :sb-core-compression *features*) t))
127 .
/"$tmpcore" --no-userinit --no-sysinit
128 check_status_maybe_lose
"SAVE-LISP-AND-DIE :EXECUTABLE-COMPRESS" $?
0 "(executable compressed saved core ran)"