1 # file to be sourced by scripts wanting to test the compiler
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.
11 # function callee() { cat }
12 # function caller() { callee bar <<EOF \n $1 \n EOF \n }
15 # will print "foo". In certain versions of sh, however, it will print
16 # "bar" instead. Hence variables f and c in the following code.
20 # Test compiling and loading.
24 ;;; But loading the file should fail.
25 (multiple-value-bind (value0 value1) (ignore-errors (load *))
26 (assert (null value0))
27 (format t "VALUE1=~S (~A)~%" value1 value1)
28 (assert (typep value1 'error)))
29 (sb-ext:exit :code $EXIT_LISP_WIN)
31 check_status_maybe_lose compile-and-load $?
33 # Test loading into the interpreter.
36 (multiple-value-bind (value0 value1) (ignore-errors (load "$f"))
37 (assert (null value0))
38 (format t "VALUE1=~S (~A)~%" value1 value1)
39 (assert (typep value1 'error)))
40 (sb-ext:exit :code $EXIT_LISP_WIN)
42 check_status_maybe_lose load-into-interpreter $?
47 expect_clean_compile $1
50 (multiple-value-bind (value0 value1)
51 (ignore-errors (load (compile-file-pathname "$f")))
53 (assert (null value1)))
54 (sb-ext:exit :code $EXIT_LISP_WIN)
56 check_status_maybe_lose load-compiled $?
59 # Test that a file compiles cleanly, with no ERRORs, WARNINGs or
61 expect_clean_compile ()
65 (multiple-value-bind (pathname warnings-p failure-p)
67 (declare (ignore pathname))
68 (assert (not warnings-p))
69 (assert (not failure-p))
70 (sb-ext:exit :code $EXIT_LISP_WIN))
72 check_status_maybe_lose clean-compile $?
75 expect_warned_compile ()
79 (multiple-value-bind (pathname warnings-p failure-p)
81 (declare (ignore pathname))
83 (assert (not failure-p))
84 (sb-ext:exit :code $EXIT_LISP_WIN))
86 check_status_maybe_lose warn-compile $?
89 expect_failed_compile ()
93 (multiple-value-bind (pathname warnings-p failure-p)
95 (declare (ignore pathname warnings-p))
97 (sb-ext:exit :code $EXIT_LISP_WIN))
99 check_status_maybe_lose fail-compile $?
102 expect_aborted_compile ()
107 (fasl (compile-file-pathname lisp)))
108 (multiple-value-bind (pathname warnings-p failure-p)
109 (compile-file "$f" :print t)
110 (assert (not pathname))
113 (assert (not (probe-file fasl))))
114 (sb-ext:exit :code $EXIT_LISP_WIN))
116 check_status_maybe_lose abort-compile $?
119 fail_on_condition_during_compile ()
124 (handler-bind (($c #'error))
126 (sb-ext:exit :code $EXIT_LISP_WIN))
128 check_status_maybe_lose "fail-on-condition_$1" $?
131 expect_condition_during_compile ()
136 (handler-bind (($c (lambda (c)
138 (sb-ext:exit :code $EXIT_LISP_WIN))))
141 check_status_maybe_lose "expect-condition_$1" $?