Skip to contentSkip to conversation

lib/igt_core: fflush stdout after printing subtest results

PATCH In review Paulo Zanoni 2 participants 2 messages Jun 25, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_core: fflush stdout after printing subtest results

From: Paulo Zanoni <[email protected]>

I often run "sudo ./test 2>&1 | tee output.txt", and when we're succeeding - never printing to stderr - the output gets buffered and is never flushed (because it doesn't point to a terminal), so I never know which test is running. With this fflush, I'm able to know when each test finishes.

---
 lib/igt_core.c | 1 +
 1 file changed, 1 insertion(+)
lib/igt_core.c +1 -0
index 051bc6a..48a0124 100644
@@ -829,6 +829,7 @@ static void exit_subtest(const char *result)
 	elapsed += (now.tv_nsec - subtest_time.tv_nsec) * 1e-9;
 
 	printf("Subtest %s: %s (%.3fs)\n", in_subtest, result, elapsed);
+	fflush(stdout);
 	in_subtest = NULL;
 	siglongjmp(igt_subtest_jmpbuf, 1);
 }
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

I often run "sudo ./test 2>&1 | tee output.txt", and when we're succeeding - never printing to stderr - the output gets buffered and is never flushed (because it doesn't point to a terminal), so I never know which test is running. With this fflush, I'm able to know when each test finishes.

---
 lib/igt_core.c | 1 +
 1 file changed, 1 insertion(+)
lib/igt_core.c +0 -0
index 051bc6a..48a0124 100644

lib/igt_core.c static void exit_subtest(const char *result) · line 832

Quoted 4 lines
lib/igt_core.c +1 -0
@@ -829,6 +829,7 @@ static void exit_subtest(const char *result)
 	elapsed += (now.tv_nsec - subtest_time.tv_nsec) * 1e-9;
 
 	printf("Subtest %s: %s (%.3fs)\n", in_subtest, result, elapsed);
+	fflush(stdout);

If you add a blank line here,

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx