1.0.13.51: Fixups in mkstemp wrapper used in RUN-PROGRAM.
[sbcl/simd.git] / tests / expect.sh
blob5919750e99baf75f3eb73fa2d0154f7ee2abff79
1 # file to be sourced by scripts wanting to test the compiler
3 . ./subr.sh
5 # Check that compiling and loading the file $1 generates an error
6 # at load time; also that just loading it directly (into the
7 # interpreter) generates an error.
8 expect_load_error ()
10 # Test compiling and loading.
11 run_sbcl <<EOF
12 (compile-file "$1")
13 ;;; But loading the file should fail.
14 (multiple-value-bind (value0 value1) (ignore-errors (load *))
15 (assert (null value0))
16 (format t "VALUE1=~S (~A)~%" value1 value1)
17 (assert (typep value1 'error)))
18 (sb-ext:quit :unix-status $EXIT_LISP_WIN)
19 EOF
20 check_status_maybe_lose compile-and-load $?
22 # Test loading into the interpreter.
23 run_sbcl <<EOF
24 (multiple-value-bind (value0 value1) (ignore-errors (load "$1"))
25 (assert (null value0))
26 (format t "VALUE1=~S (~A)~%" value1 value1)
27 (assert (typep value1 'error)))
28 (sb-ext:quit :unix-status $EXIT_LISP_WIN)
29 EOF
30 check_status_maybe_lose load-into-interpreter $?
33 # Test that a file compiles cleanly, with no ERRORs, WARNINGs or
34 # STYLE-WARNINGs.
35 expect_clean_compile ()
37 run_sbcl <<EOF
38 (multiple-value-bind (pathname warnings-p failure-p)
39 (compile-file "$1")
40 (declare (ignore pathname))
41 (assert (not warnings-p))
42 (assert (not failure-p))
43 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
44 EOF
45 check_status_maybe_lose clean-compile $?
48 expect_warned_compile ()
50 run_sbcl <<EOF
51 (multiple-value-bind (pathname warnings-p failure-p)
52 (compile-file "$1")
53 (declare (ignore pathname))
54 (assert warnings-p)
55 (assert (not failure-p))
56 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
57 EOF
58 check_status_maybe_lose warn-compile $?
61 expect_failed_compile ()
63 run_sbcl <<EOF
64 (multiple-value-bind (pathname warnings-p failure-p)
65 (compile-file "$1")
66 (declare (ignore pathname warnings-p))
67 (assert failure-p)
68 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
69 EOF
70 check_status_maybe_lose fail-compile $?
73 expect_aborted_compile ()
75 run_sbcl <<EOF
76 (let* ((lisp "$1")
77 (fasl (compile-file-pathname lisp)))
78 (multiple-value-bind (pathname warnings-p failure-p)
79 (compile-file "$1" :print t)
80 (assert (not pathname))
81 (assert failure-p)
82 (assert warnings-p)
83 (assert (not (probe-file fasl))))
84 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
85 EOF
86 check_status_maybe_lose abort-compile $?
89 fail_on_compiler_note ()
91 run_sbcl <<EOF
92 (handler-bind ((sb-ext:compiler-note #'error))
93 (compile-file "$1")
94 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
95 EOF
96 check_status_maybe_lose fail-on-compiler-note $?
99 expect_compiler_note ()
101 run_sbcl <<EOF
102 (handler-bind ((sb-ext:compiler-note (lambda (c)
103 (declare (ignore c))
104 (sb-ext:quit :unix-status
105 $EXIT_LISP_WIN))))
106 (compile-file "$1"))
108 check_status_maybe_lose expect-compiler-note $?