Fix make-array transforms.
[sbcl.git] / tests / stream.test.sh
1 #!/bin/sh
2
3 # This software is part of the SBCL system. See the README file for
4 # more information.
5 #
6 # While most of SBCL is derived from the CMU CL system, the test
7 # files (like this one) were written from scratch after the fork
8 # from CMU CL.
9 #
10 # This software is in the public domain and is provided with
11 # absolutely no warranty. See the COPYING and CREDITS files for
12 # more information.
13
14 . ./subr.sh
15
16 use_test_subdirectory
17
18 tmpfilename="$TEST_FILESTEM.lisp"
19
20 cat > $tmpfilename <<EOF
21     (in-package :cl-user)
22     (if (equal (concatenate 'string "Bivalent *STANDARD-INPUT*" (string #\newline))
23                (with-output-to-string (s)
24                  (loop for byte = (read-byte *standard-input* nil)
25                        while byte do (write-char (code-char byte) s))))
26         (exit :code $EXIT_LISP_WIN)
27         (exit :code $EXIT_LOSE))
28 EOF
29 run_sbcl --disable-debugger --load $tmpfilename <<EOF
30 Bivalent *STANDARD-INPUT*
31 EOF
32 check_status_maybe_lose bivalent-standard-input $?
33
34 cat > $tmpfilename <<EOF
35     (in-package :cl-user)
36     (loop for char across "Bivalent *STANDARD-OUTPUT*"
37           do (write-byte (char-code char) *standard-output*))
38     (terpri *standard-output*)
39     (exit :code $EXIT_LISP_WIN)
40 EOF
41 run_sbcl --disable-debugger --load $tmpfilename > $tmpfilename.out
42 check_status_maybe_lose bivalent-standard-output $?
43 test_output=`cat $tmpfilename.out`
44 rm -f $tmpfilename.out
45 if [ 'Bivalent *STANDARD-OUTPUT*' != "$test_output" ]; then
46     echo "bad test output: '$test_output'"
47     exit $EXIT_LOSE
48 fi
49
50 cat > $tmpfilename <<EOF
51     (in-package :cl-user)
52     (loop for char across "Bivalent *ERROR-OUTPUT*"
53           do (write-byte (char-code char) *error-output*))
54     (terpri *error-output*)
55     (exit :code $EXIT_LISP_WIN)
56 EOF
57 run_sbcl --disable-debugger --load $tmpfilename 2> $tmpfilename.out
58 check_status_maybe_lose bivalent-error-output $?
59 test_output=`cat $tmpfilename.out`
60 rm -f $tmpfilename.out
61 if [ 'Bivalent *ERROR-OUTPUT*' != "$test_output" ]; then
62     echo "bad test output: '$test_output'"
63     exit $EXIT_LOSE
64 fi
65
66 # success
67 exit $EXIT_TEST_WIN