Print the failed assertion before aborting in test cases

This makes it faster and easier to debug, so that you don't need to fire
up a debugger just to see which assertion triggered in a failing test.
This commit is contained in:
Kevin Svetlitski
2023-07-10 14:25:53 -07:00
committed by Qi Wang
parent 65d3b5989b
commit 314c073a38
2 changed files with 11 additions and 32 deletions

View File

@@ -228,7 +228,10 @@ p_test_no_malloc_init(test_t *t, ...) {
}
void
p_test_fail(const char *prefix, const char *message) {
p_test_fail(bool may_abort, const char *prefix, const char *message) {
malloc_cprintf(NULL, NULL, "%s%s\n", prefix, message);
test_status = test_status_fail;
if (may_abort) {
abort();
}
}