get-defined-fun: handle :declared-verify.
[sbcl.git] / tests / save1.test.sh
blob1d729db6112fa1158dee664d660d6ce106b52ae4
1 . ./subr.sh
3 use_test_subdirectory
5 tmpcore=$TEST_FILESTEM.core
7 # In sbcl-0.7.7 SAVE-LISP-AND-DIE didn't work at all because of
8 # flakiness caused by consing/GC/purify twice-and-at-least-twice
9 # mismatch grot.
11 # "serves yall right for fiddling with too much stuff"
12 # -- Eric Marsden, <http://tunes.org/~nef/logs/lisp/02.09.15>
14 # diagnosed and fixed by Dan Barlow in sbcl-0.7.7.29
15 run_sbcl <<EOF
16 (defun foo (x) (+ x 11))
17 (setq *features* (union *features* sb-impl:+internal-features+))
18 ;; The basic smoke test includes a test that immobile-space defragmentation
19 ;; supports calls to "static" functions - those called without reference
20 ;; to an fdefn, from a caller in dynamic space.
21 ;; dynamic space should be the default for compilation to memory,
22 ;; but maybe someone changed it :immobile, so bind it to be certain.
23 (let (#+immobile-code (sb-c::*compile-to-memory-space* :dynamic))
24 (defvar *afun* (compile nil '(lambda (x) (- (length x))))))
25 ;; test for lp#1983218 - a VALUE-CELL holding a readonly string could crash
26 (defun mkcell (x) (sb-sys:%primitive sb-vm::make-value-cell x nil))
27 (compile 'mkcell)
28 (defvar *cell* (mkcell (symbol-name '*print-base*)))
30 (save-lisp-and-die "$tmpcore")
31 EOF
32 run_sbcl_with_core "$tmpcore" --noinform --no-userinit --no-sysinit --noprint \
33 --eval "(setf sb-ext:*evaluator-mode* :${TEST_SBCL_EVALUATOR_MODE:-compile})" \
34 <<EOF
35 (exit :code (foo 10))
36 EOF
37 check_status_maybe_lose "Basic SAVE-LISP-AND-DIE" $? 21 "(saved core ran)"
39 run_sbcl <<EOF
40 (save-lisp-and-die "$tmpcore" :purify nil)
41 EOF
42 run_sbcl_with_core "$tmpcore" --noinform --no-userinit --no-sysinit --noprint <<EOF
43 #-(and darwin arm64) ;; darwin-jit
44 (unless (zerop (- (sb-sys:sap-int sb-vm:*read-only-space-free-pointer*) sb-vm:read-only-space-start))
45 (exit :code 1))
46 EOF
47 check_status_maybe_lose "SAVE-LISP-AND-DIE NOPURIFY" $? 0 "(unpurified core ran)"
49 exit $EXIT_TEST_WIN