Skip to content

Commit 03c2464

Browse files
authored
Merge pull request #19377 from JuliaLang/sf/not_quite_so_resilient
Integrate test segfaults with the Testset scaffolding
2 parents 55000fd + fe2f271 commit 03c2464

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

test/runtests.jl

+16
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ cd(dirname(@__FILE__)) do
103103
and Brokens from the worker and the full information about all errors and
104104
failures encountered running the tests. This information will be displayed
105105
as a summary at the end of the test run.
106+
107+
If a test failed, returning an `Exception` that is not a `RemoteException`,
108+
it is likely the julia process running the test has encountered some kind
109+
of internal error, such as a segfault. The entire testset is marked as
110+
Errored, and execution continues until the summary at the end of the test
111+
run, where the test file is printed out as the "failed expression".
106112
=#
107113
o_ts = Base.Test.DefaultTestSet("Overall")
108114
Base.Test.push_testset(o_ts)
@@ -141,6 +147,16 @@ cd(dirname(@__FILE__)) do
141147
Base.Test.record(o_ts, fake)
142148
Base.Test.pop_testset()
143149
end
150+
elseif isa(res[2][1], Exception)
151+
# If this test raised an exception that is not a RemoteException, that means
152+
# the test runner itself had some problem, so we may have hit a segfault
153+
# or something similar. Record this testset as Errored.
154+
o_ts.anynonpass = true
155+
fake = Base.Test.DefaultTestSet(res[1])
156+
Base.Test.record(fake, Base.Test.Error(:test_error, res[1], res[2][1], []))
157+
Base.Test.push_testset(fake)
158+
Base.Test.record(o_ts, fake)
159+
Base.Test.pop_testset()
144160
end
145161
end
146162
println()

test/util/segfault.jl

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
unsafe_load(convert(Ptr{UInt8},C_NULL))

test/util/throw_error_exception.jl

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
error("This purposefully dies")

0 commit comments

Comments
 (0)