X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Frun-tests.lisp;h=f1a046f6e51146d58a2ccd2f36d13c99052f430b;hb=444d2072bc52e60a41af62ee22e343e76109212f;hp=32f7bb97cb2db06cecaf77f596adaddb5c7f165f;hpb=14d9ae2d08892daee9a94da1a050bb6f2ca57dbe;p=sbcl.git diff --git a/tests/run-tests.lisp b/tests/run-tests.lisp index 32f7bb9..f1a046f 100644 --- a/tests/run-tests.lisp +++ b/tests/run-tests.lisp @@ -43,7 +43,7 @@ (format t "Finished running tests.~%") (cond (*all-failures* (format t "Status:~%") - (dolist (fail (reverse *all-failures*)) + (dolist (fail (reverse *all-failures*)) (cond ((eq (car fail) :unhandled-error) (format t " ~20a ~a~%" "Unhandled error" @@ -71,15 +71,12 @@ (dolist (file files) (when (accept-test-file file) (format t "// Running ~a~%" file) - (handler-case - (funcall test-fun file) - (error (error) - (push (list :unhandled-error file) - *all-failures*) - (when *break-on-error* - (test-util:really-invoke-debugger error)))))) + (restart-case + (handler-bind ((error (make-error-handler file))) + (funcall test-fun file)) + (skip-file ())))) (append-failures))) - + (defun impure-runner (files test-fun) (format t "// Running impure tests (~a)~%" test-fun) (let ((*package* (find-package :cl-user))) @@ -90,12 +87,11 @@ (let ((pid (sb-posix:fork))) (cond ((= pid 0) (format t "// Running ~a~%" file) - (handler-case - (funcall test-fun file) - (error (error) - (push (list :unhandled-error file) *failures*) - (when *break-on-error* - (test-util:really-invoke-debugger error)))) + (restart-case + (handler-bind ((error (make-error-handler file))) + (funcall test-fun file)) + (skip-file () + (format t ">>>~a<<<~%" *failures*))) (report-test-status) (sb-ext:quit :unix-status 104)) (t @@ -111,11 +107,25 @@ (push (list :invalid-exit-status file) *all-failures*)))))))))) +(defun make-error-handler (file) + (lambda (condition) + (push (list :unhandled-error file) *failures*) + (cond (*break-on-error* + (test-util:really-invoke-debugger condition)) + (t + (format *error-output* "~&Unhandled ~a: ~a~%" + (type-of condition) condition) + (sb-debug:backtrace))) + (invoke-restart 'skip-file))) + (defun append-failures (&optional (failures *failures*)) (setf *all-failures* (append failures *all-failures*))) (defun unexpected-failures () - (remove-if (lambda (x) (eq (car x) :expected-failure)) *all-failures*)) + (remove-if (lambda (x) + (or (eq (car x) :expected-failure) + (eq (car x) :unexpected-success))) + *all-failures*)) (defun setup-cl-user () (use-package :test-util) @@ -135,9 +145,9 @@ (defun sh-test (file) ;; What? No SB-POSIX:EXECV? - (let ((process (sb-ext:run-program "/bin/sh" + (let ((process (sb-ext:run-program "/bin/sh" (list (namestring file)) - :output *error-output*))) + :output *error-output*))) (sb-ext:quit :unix-status (process-exit-code process)))) (defun accept-test-file (file)