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 check_status_maybe_lose "SAVE-LISP-AND-DIE :TOPLEVEL" $? 0 "(saved core ran)"
29 # In sbcl-0.7.7 SAVE-LISP-AND-DIE didn't work at all because of
30 # flakiness caused by consing/GC/purify twice-and-at-least-twice
33 # "serves yall right for fiddling with too much stuff"
34 # -- Eric Marsden, <http://tunes.org/~nef/logs/lisp/02.09.15>
36 # diagnosed and fixed by Dan Barlow in sbcl-0.7.7.29
38 (defun foo (x) (+ x 11))
39 (save-lisp-and-die "$tmpcore")
41 run_sbcl_with_core "$tmpcore" --no-userinit --no-sysinit <<EOF
42 (quit :unix-status (foo 10))
44 check_status_maybe_lose "Basic SAVE-LISP-AND-DIE" $? 21 "(saved core ran)"
46 # In sbcl-0.9.8 saving cores with callbacks didn't work on gencgc platforms
49 (format t "~&Callbacks not supported, skipping~%")
50 (quit :unix-status 42))
53 (sb-alien::define-alien-callback foo int () 42)
54 (defun bar () (quit :unix-status (alien-funcall foo))))
55 (save-lisp-and-die "$tmpcore")
57 run_sbcl_with_core "$tmpcore" --no-userinit --no-sysinit <<EOF
60 check_status_maybe_lose "Callbacks after SAVE-LISP-AND-DIE" $? \
61 42 "(callback function ran)"
63 # test suppression of banner in executable cores
65 (save-lisp-and-die "$tmpcore" :executable t)
68 ./"$tmpcore" > "$tmpoutput" --no-userinit --no-sysinit --noprint <<EOF
69 (quit :unix-status 71)
72 if [ $status != 71 ]; then
73 echo "failure in banner suppression: $status"
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."
88 # saving runtime options _from_ executable cores
90 (save-lisp-and-die "$tmpcore" :executable t)
93 ./"$tmpcore" --no-userinit <<EOF
94 (save-lisp-and-die "$tmpcore" :executable t :save-runtime-options t)
97 ./"$tmpcore" --no-userinit --version --eval '(quit)' <<EOF
98 (when (equal *posix-argv* '("./$tmpcore" "--version" "--eval" "(quit)"))
99 (quit :unix-status 42))
102 if [ $status != 42 ]; then
103 echo "saving runtime options from executable failed"