lib: Print failure hints only once to reduce log duplication
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.
--- lib/tst_test.c | 2 ++ 1 file changed, 2 insertions(+)
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 ; }static void do_exit (int ret)
Signature · 5 lines
2.46.2 -- Mailing list info: https://lists.linux.it/listinfo/ltp
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 settingshow_failure_hintsto 0 after the first print, subsequent calls toprint_failure_hints()will not produce redundant output.Fixes 701212f08 ("Disable failure hints before we actually run the test")Signed-off-by Li Wang <[email protected]>Cc Cyril Hrubis <[email protected]>
...
lib/tst_test.c static void print_failure_hints(void) · line 915
Quoted 7 lines
+++
b/lib/tst_test.clib/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
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 settingshow_failure_hintsto 0 after the first print, subsequent calls toprint_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
Cyril Hrubis
Reviewed-byHi!
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 settingshow_failure_hintsto 0 after the first print, subsequent calls toprint_failure_hints()will not produce redundant output.Hmm, we do call
print_failure_hints()fromdo_exit()that callsexit()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
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_hintsQuoted 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()fromdo_exit()that callsexit()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 <[email protected]>
Pushed, thank you both.
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp