[LTP] [PATCH 2/2] tst_test: Don't print hints if failed to acquire

Petr Vorel pvorel@suse.cz
Mon May 27 22:28:58 CEST 2024


It does not make much sense to print hints when it failed to acquire the
device. It can be misleading.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_test.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 8c212c983..834acda0e 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -88,6 +88,9 @@ int TST_ERR;
 int TST_PASS;
 long TST_RET;
 
+static struct tst_device tdev;
+struct tst_device *tst_device;
+
 static void do_cleanup(void);
 static void do_exit(int ret) __attribute__ ((noreturn));
 
@@ -883,7 +886,9 @@ static void do_exit(int ret)
 
 		if (results->broken) {
 			ret |= TBROK;
-			print_failure_hints();
+
+			if (!(tst_test->needs_device && !tdev.dev))
+				print_failure_hints();
 		}
 
 		fprintf(stderr, "\nSummary:\n");
@@ -965,9 +970,6 @@ static const char *get_tid(char *argv[])
 	return argv[0];
 }
 
-static struct tst_device tdev;
-struct tst_device *tst_device;
-
 static void assert_test_fn(void)
 {
 	int cnt = 0;
-- 
2.43.0



More information about the ltp mailing list