Skip to content

Commit cf999af

Browse files
authored
Also trigger breakpoint on testset error (#44652)
Ref #44635 (comment)
1 parent 32b1305 commit cf999af

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/rtutils.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,11 @@ JL_DLLEXPORT void jl_breakpoint(jl_value_t *v)
13161316
// put a breakpoint in your debugger here
13171317
}
13181318

1319+
JL_DLLEXPORT void jl_test_failure_breakpoint(jl_value_t *v)
1320+
{
1321+
// put a breakpoint in your debugger here
1322+
}
1323+
13191324
// logging tools --------------------------------------------------------------
13201325

13211326
void jl_log(int level, jl_value_t *module, jl_value_t *group, jl_value_t *id,

stdlib/Test/src/Test.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ function do_test(result::ExecutionResult, orig_expr)
652652
@assert isa(result, Threw)
653653
testres = Error(:test_error, orig_expr, result.exception, result.backtrace::Vector{Any}, result.source)
654654
end
655-
isa(testres, Pass) || ccall(:jl_breakpoint, Cvoid, (Any,), result)
655+
isa(testres, Pass) || trigger_test_failure_break(result)
656656
record(get_testset(), testres)
657657
end
658658

@@ -1317,6 +1317,9 @@ macro testset(args...)
13171317
end
13181318
end
13191319

1320+
trigger_test_failure_break(@nospecialize(err)) =
1321+
ccall(:jl_test_failure_breakpoint, Cvoid, (Any,), err)
1322+
13201323
"""
13211324
Generate the code for a `@testset` with a function call or `begin`/`end` argument
13221325
"""
@@ -1360,6 +1363,7 @@ function testset_beginend_call(args, tests, source)
13601363
err isa InterruptException && rethrow()
13611364
# something in the test block threw an error. Count that as an
13621365
# error in this test set
1366+
trigger_test_failure_break(err)
13631367
record(ts, Error(:nontest_error, Expr(:tuple), err, Base.current_exceptions(), $(QuoteNode(source))))
13641368
finally
13651369
copy!(RNG, oldrng)
@@ -1435,6 +1439,7 @@ function testset_forloop(args, testloop, source)
14351439
err isa InterruptException && rethrow()
14361440
# Something in the test block threw an error. Count that as an
14371441
# error in this test set
1442+
trigger_test_failure_break(err)
14381443
record(ts, Error(:nontest_error, Expr(:tuple), err, Base.current_exceptions(), $(QuoteNode(source))))
14391444
end
14401445
end

0 commit comments

Comments
 (0)