summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ccan/tap/tap.c3
-rw-r--r--ccan/tap/tap.h7
2 files changed, 10 insertions, 0 deletions
diff --git a/ccan/tap/tap.c b/ccan/tap/tap.c
index 857528a2..106da912 100644
--- a/ccan/tap/tap.c
+++ b/ccan/tap/tap.c
@@ -179,6 +179,9 @@ _gen_result(int ok, const char *func, const char *file, unsigned int line,
UNLOCK;
+ if (!ok && tap_fail_callback)
+ tap_fail_callback();
+
/* We only care (when testing) that ok is positive, but here we
specifically only want to return 1 or 0 */
return ok ? 1 : 0;
diff --git a/ccan/tap/tap.h b/ccan/tap/tap.h
index 395d245d..6a4c5e05 100644
--- a/ccan/tap/tap.h
+++ b/ccan/tap/tap.h
@@ -243,4 +243,11 @@ void plan_no_plan(void);
*/
void plan_skip_all(const char *reason);
+/**
+ * tap_fail_callback - function to call when we fail
+ *
+ * This can be used to ease debugging, or exit on the first failure.
+ */
+void (*tap_fail_callback)(void);
+
#endif /* C99 or gcc */