X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Futils%2Ftap.c;h=573ae3366faca1a2a8b51957ff42df4eb2252819;hp=8bf72f6fcde57dac97fd9673cb0df5efdf9b6b0c;hb=d266df35815fc53c237c5cf96ff1a6391e2bbe6f;hpb=1b3874915095deab4aa9be0f33423e992e571bb7 diff --git a/tests/utils/tap.c b/tests/utils/tap.c index 8bf72f6..573ae33 100644 --- a/tests/utils/tap.c +++ b/tests/utils/tap.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ -#define _GNU_SOURCE #include #include #include @@ -42,6 +41,7 @@ static char *todo_msg = NULL; static char *todo_msg_fixed = "libtap malloc issue"; static int todo = 0; static int test_died = 0; +static int tap_is_disabled = 0; /* Encapsulate the pthread code in a conditional. In the absence of libpthread the code does nothing */ @@ -284,6 +284,32 @@ diag(char *fmt, ...) return 0; } +unsigned int +rdiag_start(void) +{ + fputs("# ", stderr); + return 0; +} + +unsigned int +rdiag(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + + return 0; +} + +unsigned int +rdiag_end(void) +{ + fputs("\n", stderr); + return 0; +} + void _expected_tests(unsigned int tests) { @@ -389,6 +415,11 @@ _cleanup(void) LOCK; + if (tap_is_disabled) { + UNLOCK; + return; + } + /* If plan_no_plan() wasn't called, and we don't have a plan, and we're not skipping everything, then something happened before we could produce any output */ @@ -431,3 +462,12 @@ _cleanup(void) UNLOCK; } + +/* Disable tap for this process. */ +void +tap_disable(void) +{ + LOCK; + tap_is_disabled = 1; + UNLOCK; +}