1.0.3.40: :EXECUTABLE T implies --noinform
[sbcl.git] / tests / expect.sh
blob49e84893344343f01d1db2653beb843663f72018
1 # file to be sourced by scripts wanting to test the compiler
3 # Check that compiling and loading the file $1 generates an error
4 # at load time; also that just loading it directly (into the
5 # interpreter) generates an error.
6 expect_load_error ()
8 # Test compiling and loading.
9 $SBCL <<EOF
10 (compile-file "$1")
11 ;;; But loading the file should fail.
12 (multiple-value-bind (value0 value1) (ignore-errors (load *))
13 (assert (null value0))
14 (format t "VALUE1=~S (~A)~%" value1 value1)
15 (assert (typep value1 'error)))
16 (sb-ext:quit :unix-status 52)
17 EOF
18 if [ $? != 52 ]; then
19 echo compile-and-load $1 test failed: $?
20 exit 1
23 # Test loading into the interpreter.
24 $SBCL <<EOF
25 (multiple-value-bind (value0 value1) (ignore-errors (load "$1"))
26 (assert (null value0))
27 (format t "VALUE1=~S (~A)~%" value1 value1)
28 (assert (typep value1 'error)))
29 (sb-ext:quit :unix-status 52)
30 EOF
31 if [ $? != 52 ]; then
32 echo load-into-interpreter $1 test failed: $?
33 exit 1
37 # Test that a file compiles cleanly, with no ERRORs, WARNINGs or
38 # STYLE-WARNINGs.
39 expect_clean_compile ()
41 $SBCL <<EOF
42 (multiple-value-bind (pathname warnings-p failure-p)
43 (compile-file "$1")
44 (declare (ignore pathname))
45 (assert (not warnings-p))
46 (assert (not failure-p))
47 (sb-ext:quit :unix-status 52))
48 EOF
49 if [ $? != 52 ]; then
50 echo clean-compile $1 test failed: $?
51 exit 1
55 expect_warned_compile ()
57 $SBCL <<EOF
58 (multiple-value-bind (pathname warnings-p failure-p)
59 (compile-file "$1")
60 (declare (ignore pathname))
61 (assert warnings-p)
62 (assert (not failure-p))
63 (sb-ext:quit :unix-status 52))
64 EOF
65 if [ $? != 52 ]; then
66 echo warn-compile $1 test failed: $?
67 exit 1
71 expect_failed_compile ()
73 $SBCL <<EOF
74 (multiple-value-bind (pathname warnings-p failure-p)
75 (compile-file "$1")
76 (declare (ignore pathname warnings-p))
77 (assert failure-p)
78 (sb-ext:quit :unix-status 52))
79 EOF
80 if [ $? != 52 ]; then
81 echo fail-compile $1 test failed: $?
82 exit 1
86 fail_on_compiler_note ()
88 $SBCL <<EOF
89 (handler-bind ((sb-ext:compiler-note #'error))
90 (compile-file "$1")
91 (sb-ext:quit :unix-status 52))
92 EOF
93 if [ $? != 52 ]; then
94 echo fail-on-compiler-note $1 test failed: $?
95 exit 1
99 expect_compiler_note ()
101 $SBCL <<EOF
102 (handler-bind ((sb-ext:compiler-note (lambda (c)
103 (declare (ignore c))
104 (sb-ext:quit :unix-status 52))))
105 (compile-file "$1"))
107 if [ $? != 52 ]; then
108 echo expect-compiler-note $1 test failed: $?
109 exit 1