[samples] Unbuffered standard streams on report sample for test consistency

This commit is contained in:
Snaipe 2016-01-20 15:16:07 +01:00
parent cc9465e133
commit 444e393226
3 changed files with 10 additions and 6 deletions

View file

@ -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");
}

View file

@ -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");
}

View file

@ -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)