tools.test: add a restartable-tests? flag to control restarts.

locals-and-roots
John Benediktsson 2016-03-31 06:51:17 -07:00
parent 617a725ba5
commit a4b9e55987
2 changed files with 10 additions and 6 deletions

View File

@ -31,6 +31,9 @@ T{ error-type-holder
SYMBOL: verbose-tests?
t verbose-tests? set-global
SYMBOL: restartable-tests?
t restartable-tests? set-global
: <test-failure> ( error experiment path line# -- test-failure )
test-failure new
swap >>line#
@ -41,7 +44,7 @@ t verbose-tests? set-global
<PRIVATE
: failure ( error experiment file line# -- )
: failure ( error experiment path line# -- )
"--> test failed!" print
<test-failure> test-failures get push
notify-error-observers ;
@ -126,11 +129,11 @@ PRIVATE>
dup current-test-file [
test-failures get current-test-file get +test-failure+ delete-file-errors
'[ _ run-file ] [
dup compute-restarts empty? [
file-failure
] [
rethrow
] if
restartable-tests? get
[ dup compute-restarts empty? not ] [ f ] if [
"Continue running tests" over 2array 1array
rethrow-restarts
] when [ file-failure ] when*
] recover
] with-variable ;

View File

@ -103,6 +103,7 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
: do-all ( -- )
f parser-quiet? set-global
f restartable-tests? set-global
".." [
run-mason-rc check-user-init-errors [ 1 exit ] when
bootstrap-time get boot-time-file to-file