Skip to content

Commit

Permalink
Integrate test segfaults with the Testset scaffolding
Browse files Browse the repository at this point in the history
Fixes JuliaLang#19376

Also add utility tests `segfault` and `throw_error_exception` that do
exactly what they sound like.
  • Loading branch information
staticfloat authored and fcard committed Feb 28, 2017
1 parent d96e13a commit 676f45b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ cd(dirname(@__FILE__)) do
and Brokens from the worker and the full information about all errors and
failures encountered running the tests. This information will be displayed
as a summary at the end of the test run.
If a test failed, returning an `Exception` that is not a `RemoteException`,
it is likely the julia process running the test has encountered some kind
of internal error, such as a segfault. The entire testset is marked as
Errored, and execution continues until the summary at the end of the test
run, where the test file is printed out as the "failed expression".
=#
o_ts = Base.Test.DefaultTestSet("Overall")
Base.Test.push_testset(o_ts)
Expand Down Expand Up @@ -141,6 +147,16 @@ cd(dirname(@__FILE__)) do
Base.Test.record(o_ts, fake)
Base.Test.pop_testset()
end
elseif isa(res[2][1], Exception)
# If this test raised an exception that is not a RemoteException, that means
# the test runner itself had some problem, so we may have hit a segfault
# or something similar. Record this testset as Errored.
o_ts.anynonpass = true
fake = Base.Test.DefaultTestSet(res[1])
Base.Test.record(fake, Base.Test.Error(:test_error, res[1], res[2][1], []))
Base.Test.push_testset(fake)
Base.Test.record(o_ts, fake)
Base.Test.pop_testset()
end
end
println()
Expand Down
1 change: 1 addition & 0 deletions test/util/segfault.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unsafe_load(convert(Ptr{UInt8},C_NULL))
1 change: 1 addition & 0 deletions test/util/throw_error_exception.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error("This purposefully dies")

0 comments on commit 676f45b

Please sign in to comment.