Fail-fast
TatriX opened this issue · 1 comments
If there is a way to stop executing the following tests after a test failure?
There may be a better way, but this accomplishes what you ask and lets prove
play nice with make
:
Based upon the example from https://github.com/fukamachi/prove#quickstart, change the final expression from simply (finalize)
to instead examine its result, which indicates whether there were any failures.
(unless (prove:finalize)
(break "Test suite failures"))
with your Lisp's equivalent to sbcl --disable-debugger
invoked from Makefile
so that it stops on errors with test case code itself, too.
The ASDF manual indicates that success/failure isn't reported from test-op
or any operation according to https://www.common-lisp.net/project/asdf/asdf.html#test_002dop which is why the extra logic goes into your test suite file.
Fancy version:
(unless (prove:finalize)
#+swank
(break "Test suite had ~D failure~:P: ~A"
(slot-value (prove:current-suite) 'prove.suite:failed)
(prove:current-suite))
#-swank
;; Non-interactive such as running via make or CI, so avoid stack trace
(uiop/image:shell-boolean-exit nil))
Edit: changed (sb-ext:exit :code 1)
to (uiop/image:shell-boolean-exit nil)
to be portable across Lisps.