X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fscript.test.sh;h=b209d96faa4c9ede76de5271c58d515a83e1794c;hb=cf49f2d086069a9c1b57f501df9a6a0bd3a34c3c;hp=3f55d1357827ab27481fdf25bd5c900ffc98ae05;hpb=5b137a40b265d0a1da5bee27a83ec1fd9b354a68;p=sbcl.git diff --git a/tests/script.test.sh b/tests/script.test.sh index 3f55d13..b209d96 100644 --- a/tests/script.test.sh +++ b/tests/script.test.sh @@ -18,19 +18,20 @@ use_test_subdirectory tmpscript=$TEST_FILESTEM.lisp-script +tmpfasl=$TEST_FILESTEM.lisp-fasl tmpout=$TEST_FILESTEM.lisp-out tmperr=$TEST_FILESTEM.lisp-err -echo '(quit :unix-status 7)' > $tmpscript +echo '(exit :code 7)' > $tmpscript run_sbcl --script $tmpscript -check_status_maybe_lose "--script exit status from QUIT" $? 7 "(quit status good)" +check_status_maybe_lose "--script exit status from EXIT" $? 7 "(status good)" echo '(error "oops")' > $tmpscript run_sbcl --script $tmpscript 1> $tmpout 2> $tmperr check_status_maybe_lose "--script exit status from ERROR" $? 1 "(error implies 1)" -grep BACKTRACE $tmpout > /dev/null +grep Backtrace $tmpout > /dev/null check_status_maybe_lose "--script backtrace not to stdout" $? 1 "(ok)" -grep BACKTRACE $tmperr > /dev/null +grep Backtrace $tmperr > /dev/null check_status_maybe_lose "--script backtrace to stderr" $? 0 "(ok)" echo 'nil'> $tmpscript @@ -38,18 +39,32 @@ run_sbcl --script $tmpscript check_status_maybe_lose "--script exit status from normal exit" $? 0 "(everything ok)" cat > $tmpscript </dev/null +check_status_maybe_lose "--script exit status from QUIT when standard-output closed" $? 3 "(as given)" +run_sbcl --load $tmpscript >/dev/null +check_status_maybe_lose "--load exit status from QUIT when standard-output closed" $? 3 "(as given)" + +cat > $tmpscript </dev/null -check_status_maybe_lose "--script exit status from QUIT when stdout closed" $? 3 "(as given)" +check_status_maybe_lose "--script exit status from QUIT when original standard-output closed" $? 3 "(as given)" run_sbcl --load $tmpscript >/dev/null -check_status_maybe_lose "--load exit status from QUIT when stdout closed" $? 3 "(as given)" +check_status_maybe_lose "--load exit status from QUIT when original standard-output closed" $? 3 "(as given)" + +cat > $tmpscript </dev/null +check_status_maybe_lose "--script exit status from EXIT when stdout closed" $? 3 "(as given)" +run_sbcl --load $tmpscript >/dev/null +check_status_maybe_lose "--load exit status from EXIT when stdout closed" $? 3 "(as given)" cat > $tmpscript <$tmpout 2>$tmperr -check_status_maybe_lose "--script exit status script from stdin" $? 0 "(ok)" +check_status_maybe_lose "--script exit status from stdin" $? 0 "(ok)" if [ -s $tmperr ] || [ "Ok!" != `cat $tmpout` ] then echo "--script unexpected error output" @@ -91,6 +106,22 @@ if [ "`grep -c :SCRIPT-OK $tmpout`" != 1 ] ; then exit $EXIT_LOSE fi -rm -f $tmpscript $tmpout $tmperr +# automatically executing fasls +# +# this test is fragile, with its SBCL_HOME hack to get the shebang +# line in the fasl to find the right core, and also is unlikely to +# work with that mechanism on Windows. +echo '(format t "Hello, Fasl~%")' > $tmpscript +run_sbcl --eval "(compile-file \"$tmpscript\" :output-file \"$tmpfasl\")" /dev/null +chmod +x $tmpfasl +SBCL_HOME=`dirname $SBCL_CORE` ./$tmpfasl >$tmpout 2>$tmperr +check_status_maybe_lose "--script exit status from fasl" $? 0 "(ok)" +if [ -s $tmperr ] || [ "Hello, Fasl" != "`cat $tmpout`" ] +then + echo "--script from fasl unexpected output" + exit $EXIT_LOSE +fi + +rm -f $tmpscript $tmpout $tmperr $tmpfasl exit $EXIT_TEST_WIN