[04d819]: tests / core.test.sh Maximize Restore History

Download this file

core.test.sh    67 lines (60 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
# tests related to .core files
# This software is part of the SBCL system. See the README file for
# more information.
#
# While most of SBCL is derived from the CMU CL system, the test
# files (like this one) were written from scratch after the fork
# from CMU CL.
#
# This software is in the public domain and is provided with
# absolutely no warranty. See the COPYING and CREDITS files for
# more information.
tmpcore="core-test-sh-$$.core"
rm -f $tmpcore
# In sbcl-0.7.7 SAVE-LISP-AND-DIE didn't work at all because of
# flakiness caused by consing/GC/purify twice-and-at-least-twice
# mismatch grot.
#
# "serves yall right for fiddling with too much stuff"
# -- Eric Marsden, <http://tunes.org/~nef/logs/lisp/02.09.15>
#
# diagnosed and fixed by Dan Barlow in sbcl-0.7.7.29
$SBCL <<EOF
(defun foo (x) (+ x 11))
(save-lisp-and-die "$tmpcore")
EOF
$SBCL_ALLOWING_CORE --core "$tmpcore" \
--userinit /dev/null --sysinit /dev/null <<EOF
(quit :unix-status (foo 10))
EOF
if [ $? = 21 ]; then
echo "/Basic SAVE-LISP-AND-DIE worked, good."
else
echo "failure in basic SAVE-LISP-AND-DIE: $?"
exit 1
fi
# In sbcl-0.9.8 saving cores with callbacks didn't work on gencgc platforms
$SBCL <<EOF
(defun bar ()
(format t "~&Callbacks not supported, skipping~%")
(quit :unix-status 42))
#+alien-callbacks
(progn
(sb-alien::define-alien-callback foo int () 42)
(defun bar () (quit :unix-status (alien-funcall foo))))
(save-lisp-and-die "$tmpcore")
EOF
$SBCL_ALLOWING_CORE --core "$tmpcore" \
--userinit /dev/null --sysinit /dev/null <<EOF
(bar)
EOF
if [ $? = 42 ]; then
echo "/Callbacks after SAVE-LISP-AND-DIE worked, good."
else
echo "failure in basic SAVE-LISP-AND-DIE: $?"
exit 1
fi
rm -f $tmpcore
echo "/returning success from core.test.sh"
exit 104