From 676f45b1aa4529efb799cdbe48db11274534ee3b Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Mon, 21 Nov 2016 11:44:34 -0800 Subject: [PATCH] Integrate test segfaults with the Testset scaffolding Fixes #19376 Also add utility tests `segfault` and `throw_error_exception` that do exactly what they sound like. --- test/runtests.jl | 16 ++++++++++++++++ test/util/segfault.jl | 1 + test/util/throw_error_exception.jl | 1 + 3 files changed, 18 insertions(+) create mode 100644 test/util/segfault.jl create mode 100644 test/util/throw_error_exception.jl diff --git a/test/runtests.jl b/test/runtests.jl index 35f620f8faa57c..bcb034a1b16c09 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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) @@ -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() diff --git a/test/util/segfault.jl b/test/util/segfault.jl new file mode 100644 index 00000000000000..245005eeb615e1 --- /dev/null +++ b/test/util/segfault.jl @@ -0,0 +1 @@ +unsafe_load(convert(Ptr{UInt8},C_NULL)) diff --git a/test/util/throw_error_exception.jl b/test/util/throw_error_exception.jl new file mode 100644 index 00000000000000..847f4b26321acc --- /dev/null +++ b/test/util/throw_error_exception.jl @@ -0,0 +1 @@ +error("This purposefully dies")