]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-test: flush test-assert failure messages
authorPhil Carmody <phil@dovecot.fi>
Mon, 15 Jun 2015 11:31:19 +0000 (14:31 +0300)
committerPhil Carmody <phil@dovecot.fi>
Mon, 15 Jun 2015 11:31:19 +0000 (14:31 +0300)
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 <phil@dovecot.fi>
src/lib-test/test-common.c

index f8a2b07b7b81d18e31317e7d6976d6d3a6159b52..45037bda39c693b286de3f893c7868e10db6d0af 100644 (file)
@@ -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++;
 }