Commit f5a9df16 authored by Martin Dørum's avatar Martin Dørum

update to snow-gdb-integration

parent da52623c
......@@ -24,3 +24,28 @@ Here's a short demo:
(If that doesn't run, you can download <> and run
it with asciinema.)
The heavy lifting is done by a new `--rerun-failed` option, which makes Snow
run all tests as normal, then, once an assertion fails, it calls an empty
function (`snow_break()`) before running the test case again. Actually
re-running the test case is a bit complex, because the code longjmps all over
the place; all `defer`s from the test case has to run, then the `after_each`
block has to run again, then the `before_each` block has to run again. Only
after that can it jump back to the failing test case and call `snow_break()`.
([Here is the relevant code](,
in case you're interested in reading through a structured mess of
In order to be able to break again when the failing assert is encountered the
second time, another empty function (`snow_rerun_failed()`) is called when an
assertion fails while re-running.
The actual `--gdb` option
[is comparatively straightforward](,
but uses some pretty cool GDB features.
GDB has a command called "commands", which lets you specify a list of commands
to run once a particular breakpoint is hit. Snow uses this with the `snow_break`
breakpoint to immediately step out of the `snow_break` function and into the
first line of the test case. It's also used with the `snow_rerun_failed`
function, to print a diagnostic message and a stack trace when an assert fails
while re-running the test case.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment