diff mbox series

[v7,1/7] lib: Print Summary: into stderr

Message ID 20210802173536.19525-2-pvorel@suse.cz
State Changes Requested
Headers show
Series [v7,1/7] lib: Print Summary: into stderr | expand

Commit Message

Petr Vorel Aug. 2, 2021, 5:35 p.m. UTC
to follow tst_{brk,res}() being printed to stderr.

Found with GitHub actions where stdout and stderr are probably
block buffered and flushed at different times.

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
The same as in v6.

 lib/tst_test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Cyril Hrubis Aug. 3, 2021, 9:30 a.m. UTC | #1
Hi!
I wonder if this change can break anything but I guess that it's
unlikely.

Also while you are at it can you also fix tags? We do print help() to
stderr but tags that follow go into stdout which is rather starnge.

And the failure hints are written to stdout as well, which should be
fixed as well.

> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> The same as in v6.
> 
>  lib/tst_test.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index c7c77596c..d15c8c054 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -734,12 +734,12 @@ static void do_exit(int ret)
>  		if (results->broken)
>  			ret |= TBROK;
>  
> -		printf("\nSummary:\n");
> -		printf("passed   %d\n", results->passed);
> -		printf("failed   %d\n", results->failed);
> -		printf("broken   %d\n", results->broken);
> -		printf("skipped  %d\n", results->skipped);
> -		printf("warnings %d\n", results->warnings);
> +		fprintf(stderr, "\nSummary:\n");
> +		fprintf(stderr, "passed   %d\n", results->passed);
> +		fprintf(stderr, "failed   %d\n", results->failed);
> +		fprintf(stderr, "broken   %d\n", results->broken);
> +		fprintf(stderr, "skipped  %d\n", results->skipped);
> +		fprintf(stderr, "warnings %d\n", results->warnings);
>  	}
>  
>  	do_cleanup();
> -- 
> 2.32.0
>
Petr Vorel Aug. 3, 2021, 11:35 a.m. UTC | #2
Hi Cyril,

> Hi!
> I wonder if this change can break anything but I guess that it's
> unlikely.

> Also while you are at it can you also fix tags? We do print help() to
> stderr but tags that follow go into stdout which is rather starnge.

> And the failure hints are written to stdout as well, which should be
> fixed as well.

Sure, I'll fix them all in v8.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/lib/tst_test.c b/lib/tst_test.c
index c7c77596c..d15c8c054 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -734,12 +734,12 @@  static void do_exit(int ret)
 		if (results->broken)
 			ret |= TBROK;
 
-		printf("\nSummary:\n");
-		printf("passed   %d\n", results->passed);
-		printf("failed   %d\n", results->failed);
-		printf("broken   %d\n", results->broken);
-		printf("skipped  %d\n", results->skipped);
-		printf("warnings %d\n", results->warnings);
+		fprintf(stderr, "\nSummary:\n");
+		fprintf(stderr, "passed   %d\n", results->passed);
+		fprintf(stderr, "failed   %d\n", results->failed);
+		fprintf(stderr, "broken   %d\n", results->broken);
+		fprintf(stderr, "skipped  %d\n", results->skipped);
+		fprintf(stderr, "warnings %d\n", results->warnings);
 	}
 
 	do_cleanup();