Skip to contentSkip to conversation

Disable failure hints before we actually run the test

PATCH In review Cyril Hrubis 2 participants 3 messages Sep 18, 2024 – Oct 1, 2024 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Disable failure hints before we actually run the test

This is patch based on a suggestion from Peter Vorel:

http://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

Peter proposed not to print failure hints (the tags) if we fail to acquire the device. This patch extends it for the whole test library intialization and enables the failure hints right before we jump into the test function.

---

v2: Move the show_failure_hints = 1 deeper into the library as requested
by Martin.

 lib/tst_test.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/tst_test.c +8 -2
index 918bee2a1..d226157e0 100644
@@ -899,6 +899,8 @@ static void print_failure_hint(const char *tag, const char *hint,
 	}
 }
 
+static int show_failure_hints;
+
 /* update also docparse/testinfo.pl */
 static void print_failure_hints(void)
 {
@@ -919,7 +921,8 @@ static void do_exit(int ret)
 
 		if (results->failed) {
 			ret |= TFAIL;
-			print_failure_hints();
+			if (show_failure_hints)
+				print_failure_hints();
 		}
 
 		if (results->skipped && !results->passed)
@@ -930,7 +933,8 @@ static void do_exit(int ret)
 
 		if (results->broken) {
 			ret |= TBROK;
-			print_failure_hints();
+			if (show_failure_hints)
+				print_failure_hints();
 		}
 
 		fprintf(stderr, "\nSummary:\n");
@@ -1723,6 +1727,8 @@ static int fork_testrun(void)
 
 	alarm(results->timeout);
 
+	show_failure_hints = 1;
+
 	test_pid = fork();
 	if (test_pid < 0)
 		tst_brk(TBROK | TERRNO, "fork()");
Signature · 5 lines
2.44.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Cyril Hrubis

This is patch based on a suggestion from Peter Vorel:

http://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

Quoted 8 lines

Peter proposed not to print failure hints (the tags) if we fail to acquire the device. This patch extends it for the whole test library intialization and enables the failure hints right before we jump into the test function.

Signature · 5 lines
Regards,
Li Wang

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

Hi!
Thanks for the review, applied.

Signature · 5 lines
Cyril Hrubis
[email protected]

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