]> git.ozlabs.org Git - ccan/commitdiff
tap: add fail callback
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 10 Jan 2011 05:30:48 +0000 (16:00 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 10 Jan 2011 05:30:48 +0000 (16:00 +1030)
This is useful for failtest, so we can abort on first failure.

ccan/tap/tap.c
ccan/tap/tap.h

index 857528a24429fa12e438e6844f356fa6fee40513..106da912487ba28665fc82d9f206e4c639085a34 100644 (file)
@@ -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;
index 395d245d284a55dab9b8df064d9d58dddda8d363..6a4c5e0520f683ff3e217644cb0d69b4e076ac62 100644 (file)
@@ -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 */