public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication
@ 2024-10-30  8:45 Li Wang
  2024-10-30 12:06 ` Petr Vorel
  2024-10-30 12:14 ` Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Li Wang @ 2024-10-30  8:45 UTC (permalink / raw)
  To: ltp

The LTP test currently prints failure hints multiple times if a test
encounters several TFAIL or TBROK results. This leads to unnecessarily
verbose and duplicated logs.

This patch modifies the `print_failure_hints()` function to ensure that
failure hints are printed only once per test run. By setting `show_failure_hints`
to 0 after the first print, subsequent calls to `print_failure_hints()`
will not produce redundant output.

Fixes: 701212f08 ("Disable failure hints before we actually run the test")
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index d942a91f1..8db554dea 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -911,6 +911,8 @@ static void print_failure_hints(void)
 	print_failure_hint("musl-git", "missing musl fixes", MUSL_GIT_URL);
 	print_failure_hint("CVE", "vulnerable to CVE(s)", CVE_DB_URL);
 	print_failure_hint("known-fail", "hit by known kernel failures", NULL);
+
+	show_failure_hints = 0;
 }
 
 static void do_exit(int ret)
-- 
2.46.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication
  2024-10-30  8:45 [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication Li Wang
@ 2024-10-30 12:06 ` Petr Vorel
  2024-10-30 12:14 ` Cyril Hrubis
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2024-10-30 12:06 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi all,

> The LTP test currently prints failure hints multiple times if a test
> encounters several TFAIL or TBROK results. This leads to unnecessarily
> verbose and duplicated logs.

> This patch modifies the `print_failure_hints()` function to ensure that
> failure hints are printed only once per test run. By setting `show_failure_hints`
> to 0 after the first print, subsequent calls to `print_failure_hints()`
> will not produce redundant output.

> Fixes: 701212f08 ("Disable failure hints before we actually run the test")
> Signed-off-by: Li Wang <liwang@redhat.com>
> Cc: Cyril Hrubis <chrubis@suse.cz>
...

> +++ b/lib/tst_test.c
> @@ -911,6 +911,8 @@ static void print_failure_hints(void)
>  	print_failure_hint("musl-git", "missing musl fixes", MUSL_GIT_URL);
>  	print_failure_hint("CVE", "vulnerable to CVE(s)", CVE_DB_URL);
>  	print_failure_hint("known-fail", "hit by known kernel failures", NULL);
> +
> +	show_failure_hints = 0;

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication
  2024-10-30  8:45 [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication Li Wang
  2024-10-30 12:06 ` Petr Vorel
@ 2024-10-30 12:14 ` Cyril Hrubis
  2024-10-30 12:15   ` Cyril Hrubis
  1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2024-10-30 12:14 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi!
> The LTP test currently prints failure hints multiple times if a test
> encounters several TFAIL or TBROK results. This leads to unnecessarily
> verbose and duplicated logs.
> 
> This patch modifies the `print_failure_hints()` function to ensure that
> failure hints are printed only once per test run. By setting `show_failure_hints`
> to 0 after the first print, subsequent calls to `print_failure_hints()`
> will not produce redundant output.

Hmm, we do call print_failure_hints() from do_exit() that calls exit()
at the end of the function. We shouldn't print the hints twice, what do
I miss?

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication
  2024-10-30 12:14 ` Cyril Hrubis
@ 2024-10-30 12:15   ` Cyril Hrubis
  2024-10-31  2:33     ` Li Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2024-10-30 12:15 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi!
> > The LTP test currently prints failure hints multiple times if a test
> > encounters several TFAIL or TBROK results. This leads to unnecessarily
> > verbose and duplicated logs.
> > 
> > This patch modifies the `print_failure_hints()` function to ensure that
> > failure hints are printed only once per test run. By setting `show_failure_hints`
> > to 0 after the first print, subsequent calls to `print_failure_hints()`
> > will not produce redundant output.
> 
> Hmm, we do call print_failure_hints() from do_exit() that calls exit()
> at the end of the function. We shouldn't print the hints twice, what do
> I miss?

Ah, right, we have two if () conditions that call the function in there,
so yes, we may print it twice.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication
  2024-10-30 12:15   ` Cyril Hrubis
@ 2024-10-31  2:33     ` Li Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Li Wang @ 2024-10-31  2:33 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

On Wed, Oct 30, 2024 at 8:15 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > The LTP test currently prints failure hints multiple times if a test
> > > encounters several TFAIL or TBROK results. This leads to unnecessarily
> > > verbose and duplicated logs.
> > >
> > > This patch modifies the `print_failure_hints()` function to ensure that
> > > failure hints are printed only once per test run. By setting
> `show_failure_hints`
> > > to 0 after the first print, subsequent calls to `print_failure_hints()`
> > > will not produce redundant output.
> >
> > Hmm, we do call print_failure_hints() from do_exit() that calls exit()
> > at the end of the function. We shouldn't print the hints twice, what do
> > I miss?
>
> Ah, right, we have two if () conditions that call the function in there,
> so yes, we may print it twice.
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>

Pushed, thank you both.

-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-31  2:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30  8:45 [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication Li Wang
2024-10-30 12:06 ` Petr Vorel
2024-10-30 12:14 ` Cyril Hrubis
2024-10-30 12:15   ` Cyril Hrubis
2024-10-31  2:33     ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox