twiddle script.test.sh
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 2 Jan 2012 09:56:03 +0000 (11:56 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 2 Jan 2012 10:19:55 +0000 (12:19 +0200)
  Can't open /dev/stdout on all platforms -- but happily for the behaviour we
  want to test we don't have to.

  Also add a compile of variations on the theme.

tests/script.test.sh

index db270df..87a2e08 100644 (file)
@@ -38,15 +38,29 @@ run_sbcl --script $tmpscript
 check_status_maybe_lose "--script exit status from normal exit" $? 0 "(everything ok)"
 
 cat > $tmpscript <<EOF
-#+(or darwin netbsd openbsd)
-(progn
-  (format t "silently skipping known failure in script.test.sh~%")
-  (sb-ext:quit :unix-status 3))
-(setf *standard-output* (open "/dev/stdout"))
+(setf *standard-output* (make-broadcast-stream))
 (close *standard-output*)
 (sb-ext:quit :unix-status 3)
 EOF
 run_sbcl --script $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 <<EOF
+(close *standard-output*)
+(sb-ext:quit :unix-status 3)
+EOF
+run_sbcl --script $tmpscript >/dev/null
+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 original standard-output closed" $? 3 "(as given)"
+
+cat > $tmpscript <<EOF
+(close sb-sys:*stdout*)
+(sb-ext:quit :unix-status 3)
+EOF
+run_sbcl --script $tmpscript >/dev/null
 check_status_maybe_lose "--script exit status from QUIT when stdout 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)"