Skip to content

Commit

Permalink
test: handle runtest errors in a couple more places (#38127)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored Oct 22, 2020
1 parent 8e3d78d commit eb64b89
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 11 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ cd(@__DIR__) do
end
delete!(running_tests, test)
push!(results, (test, resp))
if resp[1] isa Exception && !(resp[1] isa TestSetException && isempty(resp[1].errors_and_fails))
if length(resp) == 1
print_testworker_errored(test, wrkr, exit_on_error ? nothing : resp[1])
if exit_on_error
skipped = length(tests)
Expand Down Expand Up @@ -268,12 +268,16 @@ cd(@__DIR__) do
# to the overall aggregator
isolate = true
t == "SharedArrays" && (isolate = false)
local resp
try
resp = eval(Expr(:call, () -> runtests(t, test_path(t), isolate, seed=seed))) # runtests is defined by the include above
resp = try
Base.invokelatest(runtests, t, test_path(t), isolate, seed=seed) # runtests is defined by the include above
catch e
isa(e, InterruptException) && rethrow()
Any[CapturedException(e, catch_backtrace())]
end
if length(resp) == 1
print_testworker_errored(t, 1, resp[1])
else
print_testworker_stats(t, 1, resp)
catch e
resp = Any[e]
end
push!(results, (t, resp))
end
Expand Down Expand Up @@ -352,7 +356,7 @@ cd(@__DIR__) do
# the test runner itself had some problem, so we may have hit a segfault,
# deserialization errors or something similar. Record this testset as Errored.
fake = Test.DefaultTestSet(testname)
Test.record(fake, Test.Error(:test_error, testname, nothing, Any[(resp, [])], LineNumberNode(1)))
Test.record(fake, Test.Error(:nontest_error, testname, nothing, Any[(resp, [])], LineNumberNode(1)))
Test.push_testset(fake)
Test.record(o_ts, fake)
Test.pop_testset()
Expand Down
3 changes: 1 addition & 2 deletions test/testdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ function runtests(name, path, isolate=true; seed=nothing)
return res_and_time_data
catch ex
Test.TESTSET_PRINT_ENABLE[] = old_print_setting
ex isa TestSetException || (ex = CapturedException(ex, catch_backtrace()))
# return this as a value to avoid remotecall from mangling it and discarding half of it
ex isa TestSetException || rethrow()
return Any[ex]
end
end
Expand Down

0 comments on commit eb64b89

Please sign in to comment.