X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fscript.test.sh;h=e17761a5d04a226eb63e2b5191128a8e0b9d0287;hb=2deecbd428dee535b5830e0686ad130f64110fb9;hp=a9ce19a2bda70d075e8e9af3f9a8ebacdb5815a7;hpb=406c4143b9aa508c35c0004f57f587170dfda166;p=sbcl.git diff --git a/tests/script.test.sh b/tests/script.test.sh index a9ce19a..e17761a 100644 --- a/tests/script.test.sh +++ b/tests/script.test.sh @@ -18,19 +18,64 @@ use_test_subdirectory tmpscript=$TEST_FILESTEM.lisp-script +tmpout=$TEST_FILESTEM.lisp-out +tmperr=$TEST_FILESTEM.lisp-err echo '(quit :unix-status 7)' > $tmpscript run_sbcl --script $tmpscript check_status_maybe_lose "--script exit status from QUIT" $? 7 "(quit status good)" echo '(error "oops")' > $tmpscript -run_sbcl --script $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 +check_status_maybe_lose "--script backtrace not to stdout" $? 1 "(ok)" +grep BACKTRACE $tmperr > /dev/null +check_status_maybe_lose "--script backtrace to stderr" $? 0 "(ok)" echo 'nil'> $tmpscript run_sbcl --script $tmpscript check_status_maybe_lose "--script exit status from normal exit" $? 0 "(everything ok)" -rm -f $tmpscript +cat > $tmpscript < $tmpscript < $tmpout 2> $tmperr +check_status_maybe_lose "--script exit status when stdin closed" $? 0 "(as given)" +if [ -s $tmperr ] || [ "ONE" != `cat $tmpout` ] +then + echo "--script outputs wrong" + exit $EXIT_LOSE +fi + +cat > $tmpscript < $tmperr | head -n1 > $tmpout +check_status_maybe_lose "--script exit status when stdout closed" $? 0 "(as given)" +if [ -s $tmperr ] || [ "foo" != `cat $tmpout` ] +then + echo "--script unexpected error output" + exit $EXIT_LOSE +fi +echo '(write-line "Ok!")' | run_sbcl --script 1>$tmpout 2>$tmperr +check_status_maybe_lose "--script exit status script from stdin" $? 0 "(ok)" +if [ -s $tmperr ] || [ "Ok!" != `cat $tmpout` ] +then + echo "--script unexpected error output" + exit $EXIT_LOSE +fi + +rm -f $tmpscript $tmpout $tmperr exit $EXIT_TEST_WIN