Skip to content

Commit

Permalink
Also trigger breakpoint on testset error
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Mar 17, 2022
1 parent 1e64682 commit 110e0ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/rtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,11 @@ JL_DLLEXPORT void jl_breakpoint(jl_value_t *v)
// put a breakpoint in your debugger here
}

JL_DLLEXPORT void jl_test_failure_breakpoint(jl_value_t *v)
{
// put a breakpoint in your debugger here
}

// logging tools --------------------------------------------------------------

void jl_log(int level, jl_value_t *module, jl_value_t *group, jl_value_t *id,
Expand Down
4 changes: 3 additions & 1 deletion stdlib/Test/src/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ function do_test(result::ExecutionResult, orig_expr)
@assert isa(result, Threw)
testres = Error(:test_error, orig_expr, result.exception, result.backtrace::Vector{Any}, result.source)
end
isa(testres, Pass) || ccall(:jl_breakpoint, Cvoid, (Any,), result)
isa(testres, Pass) || ccall(:jl_test_failure_breakpoint, Cvoid, (Any,), result)
record(get_testset(), testres)
end

Expand Down Expand Up @@ -1360,6 +1360,7 @@ function testset_beginend_call(args, tests, source)
err isa InterruptException && rethrow()
# something in the test block threw an error. Count that as an
# error in this test set
ccall(:jl_test_failure_breakpoint, Cvoid, (Any,), err)
record(ts, Error(:nontest_error, Expr(:tuple), err, Base.current_exceptions(), $(QuoteNode(source))))
finally
copy!(RNG, oldrng)
Expand Down Expand Up @@ -1435,6 +1436,7 @@ function testset_forloop(args, testloop, source)
err isa InterruptException && rethrow()
# Something in the test block threw an error. Count that as an
# error in this test set
ccall(:jl_test_failure_breakpoint, Cvoid, (Any,), err)
record(ts, Error(:nontest_error, Expr(:tuple), err, Base.current_exceptions(), $(QuoteNode(source))))
end
end
Expand Down

0 comments on commit 110e0ee

Please sign in to comment.