1 # file to be sourced by scripts wanting to test the compiler
5 # In theory, each of these should delete the fasls they produce, so
6 # that the various tests don't interact in odd ways.
10 (delete-file (compile-file-pathname "$1"))
11 (sb-ext:quit :unix-status 0)
13 # If the above is too principled, we can try this:
14 # rm "${1%.lisp}.fasl"
17 # Check that compiling and loading the file $1 generates an error
18 # at load time; also that just loading it directly (into the
19 # interpreter) generates an error.
22 # Test compiling and loading.
25 ;;; But loading the file should fail.
26 (multiple-value-bind (value0 value1) (ignore-errors (load *))
27 (assert (null value0))
28 (format t "VALUE1=~S (~A)~%" value1 value1)
29 (assert (typep value1 'error)))
30 (sb-ext:quit :unix-status $EXIT_LISP_WIN)
32 check_status_maybe_lose compile-and-load $?
34 # Test loading into the interpreter.
36 (multiple-value-bind (value0 value1) (ignore-errors (load "$1"))
37 (assert (null value0))
38 (format t "VALUE1=~S (~A)~%" value1 value1)
39 (assert (typep value1 'error)))
40 (sb-ext:quit :unix-status $EXIT_LISP_WIN)
42 check_status_maybe_lose load-into-interpreter $?
45 # Test that a file compiles cleanly, with no ERRORs, WARNINGs or
47 expect_clean_compile
()
50 (multiple-value-bind (pathname warnings-p failure-p)
52 (declare (ignore pathname))
53 (assert (not warnings-p))
54 (assert (not failure-p))
55 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
57 check_status_maybe_lose clean-compile $?
60 expect_warned_compile
()
63 (multiple-value-bind (pathname warnings-p failure-p)
65 (declare (ignore pathname))
67 (assert (not failure-p))
68 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
70 check_status_maybe_lose warn-compile $?
73 expect_failed_compile
()
76 (multiple-value-bind (pathname warnings-p failure-p)
78 (declare (ignore pathname warnings-p))
80 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
82 check_status_maybe_lose fail-compile $?
85 expect_aborted_compile
()
90 (fasl (compile-file-pathname lisp)))
91 (multiple-value-bind (pathname warnings-p failure-p)
92 (compile-file "$1" :print t)
93 (assert (not pathname))
96 (assert (not (probe-file fasl))))
97 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
99 check_status_maybe_lose abort-compile $?
102 fail_on_compiler_note
()
105 (handler-bind ((sb-ext:compiler-note #'error))
107 (sb-ext:quit :unix-status $EXIT_LISP_WIN))
109 check_status_maybe_lose fail-on-compiler-note $?
112 expect_compiler_note
()
115 (handler-bind ((sb-ext:compiler-note (lambda (c)
117 (sb-ext:quit :unix-status
121 check_status_maybe_lose expect-compiler-note $?