sbcl.sbcl/tests/save2.test.sh
Douglas Katzman ea0e1f96e1 Use /tmp more in shell tests
Anything that invokes 'use_test_subdirectory' should go to /tmp, not just
a few scripts that overrode TEST_BASEDIR. After this there are approximately
6 files that will fail if pwd isn't writable. Most involve run-compiler.sh
and also filesys tests. Plus there's a hack in run-sbcl.sh without which
it would already fail when writing into /tmp.
2022-10-07 13:54:25 -04:00

33 lines
1.3 KiB
Bash

. ./subr.sh
use_test_subdirectory
tmpcore=$TEST_FILESTEM.core
# This test asserts that the :TOPLEVEL function is allowed to return with
# an arbitrary value that does _not_ propagate into the exit status.
run_sbcl <<EOF
(save-lisp-and-die "$tmpcore" :toplevel (lambda () 42))
EOF
run_sbcl_with_core "$tmpcore" --noinform --no-userinit --no-sysinit \
--eval "(setf sb-ext:*evaluator-mode* :${TEST_SBCL_EVALUATOR_MODE:-compile})"
check_status_maybe_lose "SAVE-LISP-AND-DIE :TOPLEVEL" $? 0 "(saved core ran)"
run_sbcl --eval '(save-lisp-and-die "'$tmpcore'" :toplevel (lambda () (format t "Ahoy-hoy.~%")))'
result1=`run_sbcl_with_core "$tmpcore" --noinform --no-userinit --no-sysinit`
result2=`run_sbcl_with_core "$tmpcore" --merge-core-pages --noinform --no-userinit --no-sysinit`
# Both invocations should produce the "Ahoy-hoy." but result2 didn't
# because of busted arg parsing in git rev f0a7f17516
# result2 has to be string-quoted in case it contains junk (due to not parsing
# --noinform after incorrectly parsing --merge-core-pages)
if [ ${result1} != "Ahoy-hoy." -o "${result2}" != ${result1} ]
then
echo FAIL: merge-core-pages
exit 0
fi
# Passing doesn't actually mean we utilized madvise,
# just that we didn't choke on the argument.
echo PASS: merge-core-pages
exit $EXIT_TEST_WIN