X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-util.lisp;h=7ef6b6baec35a03968d17be5be78af9ebf9e23e9;hb=9abfd1a2b22862570c15ffa5129b1196d0480290;hp=00a986d5e5cb83eea4c6cf8818d06039276e4377;hpb=175c318c892b0627b36fa3c4db66f59680242204;p=sbcl.git diff --git a/tests/test-util.lisp b/tests/test-util.lisp index 00a986d..7ef6b6b 100644 --- a/tests/test-util.lisp +++ b/tests/test-util.lisp @@ -12,19 +12,30 @@ (defvar *break-on-failure* nil) (defvar *break-on-expected-failure* nil) +(defun log-msg (&rest args) + (format *trace-output* "~&::: ") + (apply #'format *trace-output* args) + (terpri *trace-output*) + (force-output *trace-output*)) + (defmacro with-test ((&key fails-on name) &body body) - `(handler-case (progn - (start-test) - ,@body - (when (expected-failure-p ,fails-on) - (fail-test :unexpected-success ',name nil))) - (error (error) - (if (expected-failure-p ,fails-on) - (fail-test :expected-failure ',name error) - (fail-test :unexpected-failure ',name error))))) + (let ((block-name (gensym))) + `(block ,block-name + (handler-bind ((error (lambda (error) + (if (expected-failure-p ,fails-on) + (fail-test :expected-failure ',name error) + (fail-test :unexpected-failure ',name error)) + (return-from ,block-name)))) + (progn + (log-msg "Running ~S" ',name) + (start-test) + ,@body + (if (expected-failure-p ,fails-on) + (fail-test :unexpected-success ',name nil) + (log-msg "Success ~S" ',name))))))) (defun report-test-status () - (with-standard-io-syntax + (with-standard-io-syntax (with-open-file (stream "test-status.lisp-expr" :direction :output :if-exists :supersede) @@ -36,7 +47,8 @@ (setf *test-count* 0)) (incf *test-count*)) -(defun fail-test (type test-name condition) +(defun fail-test (type test-name condition) + (log-msg "~A ~S" type test-name) (push (list type *test-file* (or test-name *test-count*)) *failures*) (when (or (and *break-on-failure*