From 488b7a80d9d980e0746b4f46258eed419ce453db Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Mon, 18 Feb 2019 11:00:19 -0600 Subject: [PATCH] Make it easier to create useful bug reports from Julia tests See the instructions in #13. --- test/utils.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/utils.jl b/test/utils.jl index 1c1bb851..d73029e2 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -172,6 +172,8 @@ function run_test_by_eval(test, fullpath, nstmts) stack = JuliaStackFrame[] for (i, modex) in enumerate(modexs) # having the index can be useful for debugging nstmtsleft = $nstmts + # mod, ex = modex + # @show mod ex frame = JuliaInterpreter.prepare_thunk(modex) while true yield() # allow communication between processes @@ -198,3 +200,17 @@ function run_test_by_eval(test, fullpath, nstmts) return ts, aborts end)) end + +# To help debugging +function run_compiled(frame) + Core.eval(moduleof(frame), Expr(:toplevel, quote + let pc = $frame.pc[] + while true # This is finish!, except we need to run it at top level + new_pc = ($_step_expr!)($(Compiled()), $frame, pc, true) + new_pc == nothing && break + pc = new_pc + end + $frame.pc[] = pc + end + end)) +end