From 444e39322632a2166eca1cccf1d85e6e97aacb5f Mon Sep 17 00:00:00 2001 From: Snaipe Date: Wed, 20 Jan 2016 15:16:07 +0100 Subject: [PATCH] [samples] Unbuffered standard streams on report sample for test consistency --- samples/report.c | 2 ++ samples/report.cc | 2 ++ test/cram/core.t | 12 ++++++------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/samples/report.c b/samples/report.c index 8c9ace8..7a6e249 100644 --- a/samples/report.c +++ b/samples/report.c @@ -17,6 +17,8 @@ ReportHook(POST_TEST)(struct criterion_test_stats *stats) { ReportHook(PRE_ALL)(struct criterion_test_set *tests) { (void) tests; + setbuf(stdout, NULL); + setbuf(stderr, NULL); puts("criterion_init"); } diff --git a/samples/report.cc b/samples/report.cc index 8c9ace8..7a6e249 100644 --- a/samples/report.cc +++ b/samples/report.cc @@ -17,6 +17,8 @@ ReportHook(POST_TEST)(struct criterion_test_stats *stats) { ReportHook(PRE_ALL)(struct criterion_test_set *tests) { (void) tests; + setbuf(stdout, NULL); + setbuf(stderr, NULL); puts("criterion_init"); } diff --git a/test/cram/core.t b/test/cram/core.t index 6910f7d..6b36c7c 100644 --- a/test/cram/core.t +++ b/test/cram/core.t @@ -136,18 +136,18 @@ Testing report hooks $ report.c.bin criterion_init - [\x1b[0;34m----\x1b[0m] \x1b[0;1mreport.c\x1b[0m:\x1b[0;31m5\x1b[0m: Assertion failed: The expression 0 is false. (esc) - [\x1b[0;31mFAIL\x1b[0m] sample::test (esc) - [\x1b[0;34m====\x1b[0m] \x1b[0;1mSynthesis: Tested: \x1b[0;34m1\x1b[0;1m | Passing: \x1b[0;32m0\x1b[0;1m | Failing: \x1b[0;31m1\x1b[0;1m | Crashing: \x1b[0;31m0\x1b[0;1m \x1b[0m (esc) testing test in category sample + [\x1b[0;34m----\x1b[0m] \x1b[0;1mreport.c\x1b[0m:\x1b[0;31m5\x1b[0m: Assertion failed: The expression 0 is false. (esc) Asserts: [1 passed, 1 failed, 2 total] + [\x1b[0;31mFAIL\x1b[0m] sample::test (esc) criterion_fini + [\x1b[0;34m====\x1b[0m] \x1b[0;1mSynthesis: Tested: \x1b[0;34m1\x1b[0;1m | Passing: \x1b[0;32m0\x1b[0;1m | Failing: \x1b[0;31m1\x1b[0;1m | Crashing: \x1b[0;31m0\x1b[0;1m \x1b[0m (esc) $ report.cc.bin criterion_init - [\x1b[0;34m----\x1b[0m] \x1b[0;1mreport.cc\x1b[0m:\x1b[0;31m5\x1b[0m: Assertion failed: The expression 0 is false. (esc) - [\x1b[0;31mFAIL\x1b[0m] sample::test (esc) - [\x1b[0;34m====\x1b[0m] \x1b[0;1mSynthesis: Tested: \x1b[0;34m1\x1b[0;1m | Passing: \x1b[0;32m0\x1b[0;1m | Failing: \x1b[0;31m1\x1b[0;1m | Crashing: \x1b[0;31m0\x1b[0;1m \x1b[0m (esc) testing test in category sample + [\x1b[0;34m----\x1b[0m] \x1b[0;1mreport.cc\x1b[0m:\x1b[0;31m5\x1b[0m: Assertion failed: The expression 0 is false. (esc) Asserts: [1 passed, 1 failed, 2 total] + [\x1b[0;31mFAIL\x1b[0m] sample::test (esc) criterion_fini + [\x1b[0;34m====\x1b[0m] \x1b[0;1mSynthesis: Tested: \x1b[0;34m1\x1b[0;1m | Passing: \x1b[0;32m0\x1b[0;1m | Failing: \x1b[0;31m1\x1b[0;1m | Crashing: \x1b[0;31m0\x1b[0;1m \x1b[0m (esc)