Skip to contentSkip to conversation

lib: Print failure hints only once to reduce log duplication

PATCH In review Li Wang 3 participants 5 messages Oct 30, 2024 – Oct 31, 2024 Library code

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 lib: Print failure hints only once to reduce log duplication

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")
Cc Cyril Hrubis <[email protected]>
---
 lib/tst_test.c | 2 ++
 1 file changed, 2 insertions(+)
lib/tst_test.c +2 -0
index d942a91f1..8db554dea 100644
@@ -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)
Signature · 5 lines
2.46.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi all,

Quoted 12 lines

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")
Cc Cyril Hrubis <[email protected]>

...

lib/tst_test.c static void print_failure_hints(void) · line 915

Quoted 7 lines

+++ b/lib/tst_test.c

lib/tst_test.c +2 -0
@@ -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;

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Li Wang

Hi!

Quoted 8 lines

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?

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by
#3 lore raw

Hi!

Quoted 4 lines
Quoted 4 lines

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.

Quoted 8 lines
Quoted 4 lines

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.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw
Quoted 11 lines · Cyril Hrubis

Hi!

Quoted 6 lines
Quoted 6 lines

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

Quoted 3 lines
Quoted 2 lines

to 0 after the first print, subsequent calls to print_failure_hints() will not produce redundant output.

Quoted 9 lines
Quoted 3 lines

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.

Pushed, thank you both.

Signature · 5 lines
Regards,
Li Wang

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