diff mbox

[igt] lib/igt_core: fflush stdout after printing subtest results

Message ID 1435247542-21630-1-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni June 25, 2015, 3:52 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

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.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 lib/igt_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Chris Wilson June 25, 2015, 7:55 p.m. UTC | #1
On Thu, Jun 25, 2015 at 12:52:22PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> 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.
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  lib/igt_core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 051bc6a..48a0124 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -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,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 051bc6a..48a0124 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -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);
 }