Re: [LTP] [PATCH] lib: Print failure hints only once to reduce log duplication

Petr Vorel
2024-10-30T12:07:21Z

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