Commits (2)
......@@ -11,6 +11,11 @@ dev-watch:
while inotifywait -r -e modify -e move -e create -e delete \
plugins content theme imgs; do make; done
.PHONY: dev
$(MAKE) dev-server &
$(MAKE) dev-watch
.PHONY: webhook-server
node webhook-server 51207 $(TOKEN)
......@@ -24,3 +24,28 @@ Here's a short demo:
(If that doesn't run, you can download <https://mort.coffee/_/imgs/gdb-integration-1.cast> 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](https://github.com/mortie/snow/blob/837d97f771391986d42a035ddabc84d72361ac47/snow/snow.h#L690-L705),
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](https://github.com/mortie/snow/blob/837d97f771391986d42a035ddabc84d72361ac47/snow/snow.h#L933-L1025),
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.