X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Ftap%2Ftap.c;h=4d09a58a5e8c2e39835d14dba24a83d249da7ed5;hb=840c5b8053ae58755e57dba5bdc4488945594600;hp=8bf72f6fcde57dac97fd9673cb0df5efdf9b6b0c;hpb=ccde9b25397f3e74c60bfbcb9f77008299a44cc9;p=babeltrace.git diff --git a/tests/utils/tap/tap.c b/tests/utils/tap/tap.c index 8bf72f6f..4d09a58a 100644 --- a/tests/utils/tap/tap.c +++ b/tests/utils/tap/tap.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004 Nik Clayton + * 2017 Jérémie Galarneau * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,11 +25,13 @@ * SUCH DAMAGE. */ -#define _GNU_SOURCE #include #include #include #include +#include +#include +#include #include "tap.h" @@ -59,6 +62,18 @@ static void _expected_tests(unsigned int); static void _tap_init(void); static void _cleanup(void); +#ifdef __MINGW32__ +static inline +void flockfile (FILE * filehandle) { + return; +} + +static inline +void funlockfile(FILE * filehandle) { + return; +} +#endif + /* * Generate a test result. * @@ -284,6 +299,28 @@ diag(char *fmt, ...) return 0; } +void +diag_multiline(const char *val) +{ + size_t len, i, line_start_idx = 0; + + assert(val); + len = strlen(val); + + for (i = 0; i < len; i++) { + int line_length; + + if (val[i] != '\n') { + continue; + } + + assert((i - line_start_idx + 1) <= INT_MAX); + line_length = i - line_start_idx + 1; + fprintf(stderr, "# %.*s", line_length, &val[line_start_idx]); + line_start_idx = i + 1; + } +} + void _expected_tests(unsigned int tests) {