1.0.22.9: SB-INTROSPECT regression from 1.0.22.8
[sbcl/tcr.git] / tests / core.test.sh
blob4f80be84e76feb4ed96f9b2874e9879796c76d02
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 . ./subr.sh
18 use_test_subdirectory
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
25 # mismatch grot.
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
31 run_sbcl <<EOF
32 (defun foo (x) (+ x 11))
33 (save-lisp-and-die "$tmpcore")
34 EOF
35 run_sbcl_with_core "$tmpcore" --no-userinit --no-sysinit <<EOF
36 (quit :unix-status (foo 10))
37 EOF
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
41 run_sbcl <<EOF
42 (defun bar ()
43 (format t "~&Callbacks not supported, skipping~%")
44 (quit :unix-status 42))
45 #+alien-callbacks
46 (progn
47 (sb-alien::define-alien-callback foo int () 42)
48 (defun bar () (quit :unix-status (alien-funcall foo))))
49 (save-lisp-and-die "$tmpcore")
50 EOF
51 run_sbcl_with_core "$tmpcore" --no-userinit --no-sysinit <<EOF
52 (bar)
53 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
58 run_sbcl <<EOF
59 (save-lisp-and-die "$tmpcore" :executable t)
60 EOF
61 chmod u+x "$tmpcore"
62 ./"$tmpcore" > "$tmpoutput" --no-userinit --no-sysinit --noprint <<EOF
63 (quit :unix-status 71)
64 EOF
65 status=$?
66 if [ $status != 71 ]; then
67 echo "failure in banner suppression: $status"
68 exit 1
69 elif [ -s "$tmpoutput" ]; then
70 echo "failure in banner suppression: nonempty output:"
71 echo ---
72 cat "$tmpoutput"
73 echo ---
74 exit 1
75 elif [ -f "$tmpoutput" ]; then
76 echo "/Executable suppressed banner, good."
77 else
78 echo "failure in banner suppression: $tmpoutput was not created or something funny happened."
79 exit 1
82 exit $EXIT_TEST_WIN