3 # tests related to --script
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 tmpscript=$TEST_FILESTEM.lisp-script
22 echo '(quit :unix-status 7)' > $tmpscript
23 run_sbcl --script $tmpscript
24 check_status_maybe_lose "--script exit status from QUIT" $? 7 "(quit status good)"
26 echo '(error "oops")' > $tmpscript
27 run_sbcl --script $tmpscript 2> /dev/null
28 check_status_maybe_lose "--script exit status from ERROR" $? 1 "(error implies 1)"
30 echo 'nil'> $tmpscript
31 run_sbcl --script $tmpscript
32 check_status_maybe_lose "--script exit status from normal exit" $? 0 "(everything ok)"
34 cat > $tmpscript <<EOF
35 (setf *standard-output* (open "/dev/stdout"))
36 (close *standard-output*)
37 (sb-ext:quit :unix-status 3)
40 run_sbcl --script $tmpscript
41 check_status_maybe_lose "--script exit status from QUIT when stdout closed" $? 3 "(as given)"
42 run_sbcl --load $tmpscript
43 check_status_maybe_lose "--load exit status from QUIT when stdout closed" $? 3 "(as given)"