X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-util.lisp;h=7ef6b6baec35a03968d17be5be78af9ebf9e23e9;hb=d9d75ffc2f436767c81a4091ec4ff7006c1ec676;hp=8ed24c83716f6e8c23da0679fc665b086a02e574;hpb=b3e3fbe7d381147fccc8a3027cb6fae923e57d13;p=sbcl.git diff --git a/tests/test-util.lisp b/tests/test-util.lisp index 8ed24c8..7ef6b6b 100644 --- a/tests/test-util.lisp +++ b/tests/test-util.lisp @@ -12,16 +12,27 @@ (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 @@ -37,6 +48,7 @@ (incf *test-count*)) (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*