Skip to content

Commit eb64b89

Browse files
authored
test: handle runtest errors in a couple more places (#38127)
1 parent 8e3d78d commit eb64b89

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

test/runtests.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ cd(@__DIR__) do
218218
end
219219
delete!(running_tests, test)
220220
push!(results, (test, resp))
221-
if resp[1] isa Exception && !(resp[1] isa TestSetException && isempty(resp[1].errors_and_fails))
221+
if length(resp) == 1
222222
print_testworker_errored(test, wrkr, exit_on_error ? nothing : resp[1])
223223
if exit_on_error
224224
skipped = length(tests)
@@ -268,12 +268,16 @@ cd(@__DIR__) do
268268
# to the overall aggregator
269269
isolate = true
270270
t == "SharedArrays" && (isolate = false)
271-
local resp
272-
try
273-
resp = eval(Expr(:call, () -> runtests(t, test_path(t), isolate, seed=seed))) # runtests is defined by the include above
271+
resp = try
272+
Base.invokelatest(runtests, t, test_path(t), isolate, seed=seed) # runtests is defined by the include above
273+
catch e
274+
isa(e, InterruptException) && rethrow()
275+
Any[CapturedException(e, catch_backtrace())]
276+
end
277+
if length(resp) == 1
278+
print_testworker_errored(t, 1, resp[1])
279+
else
274280
print_testworker_stats(t, 1, resp)
275-
catch e
276-
resp = Any[e]
277281
end
278282
push!(results, (t, resp))
279283
end
@@ -352,7 +356,7 @@ cd(@__DIR__) do
352356
# the test runner itself had some problem, so we may have hit a segfault,
353357
# deserialization errors or something similar. Record this testset as Errored.
354358
fake = Test.DefaultTestSet(testname)
355-
Test.record(fake, Test.Error(:test_error, testname, nothing, Any[(resp, [])], LineNumberNode(1)))
359+
Test.record(fake, Test.Error(:nontest_error, testname, nothing, Any[(resp, [])], LineNumberNode(1)))
356360
Test.push_testset(fake)
357361
Test.record(o_ts, fake)
358362
Test.pop_testset()

test/testdefs.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ function runtests(name, path, isolate=true; seed=nothing)
3737
return res_and_time_data
3838
catch ex
3939
Test.TESTSET_PRINT_ENABLE[] = old_print_setting
40-
ex isa TestSetException || (ex = CapturedException(ex, catch_backtrace()))
41-
# return this as a value to avoid remotecall from mangling it and discarding half of it
40+
ex isa TestSetException || rethrow()
4241
return Any[ex]
4342
end
4443
end

0 commit comments

Comments
 (0)