From: Phil Carmody Date: Mon, 15 Jun 2015 11:31:19 +0000 (+0300) Subject: lib-test: flush test-assert failure messages X-Git-Tag: 2.2.19.rc1~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04e7cfc5e641c9431d3deb718b1064ad56fb0bc2;p=thirdparty%2Fdovecot%2Fcore.git lib-test: flush test-assert failure messages Diagnostic output to stderr may overtake these stdout logs if the streams are combined by the shell or on the console. fflush() might help realign them. Signed-off-by: Phil Carmody --- diff --git a/src/lib-test/test-common.c b/src/lib-test/test-common.c index f8a2b07b7b..45037bda39 100644 --- a/src/lib-test/test-common.c +++ b/src/lib-test/test-common.c @@ -165,12 +165,14 @@ bool test_has_failed(void) void test_assert_failed(const char *code, const char *file, unsigned int line) { printf("%s:%u: Assert failed: %s\n", file, line, code); + fflush(stdout); test_success = FALSE; } void test_assert_failed_idx(const char *code, const char *file, unsigned int line, long long i) { printf("%s:%u: Assert(#%lld) failed: %s\n", file, line, i, code); + fflush(stdout); test_success = FALSE; } @@ -250,6 +252,7 @@ void test_out_reason(const char *name, bool success, const char *reason) if (reason != NULL && *reason != '\0') printf(": %s", reason); putchar('\n'); + fflush(stdout); total_count++; }