Skip to contentSkip to conversation

lib/tst_test: Report 0 if test has both TPASS and TCONF

RFC PATCH New Cyril Hrubis 2 participants 3 messages Sep 7, 2017 – Sep 8, 2017 Library code

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 lib/tst_test: Report 0 if test has both TPASS and TCONF

It's probably a bit more logical to report a succes if only part of the test was skipped and the rest was sucessful. That way we can distinguish tests that were compiled-out completely or where the kernel does not support the particular syscall at all. The difference is about 15 testcases that report TPASS instead of TCONF after this change.

---
 lib/tst_res.c  | 11 ++++++++++-
 lib/tst_test.c |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)
lib/tst_res.c +10 -1
index ff0ad685f..8cf5f0d4a 100644
@@ -91,6 +91,7 @@ static void tst_condense(int tnum, int ttype, const char *tmesg);
 static void tst_print(const char *tcid, int tnum, int ttype, const char *tmesg);
 
 static int T_exitval = 0;	/* exit value used by tst_exit() */
+static int passed_cnt;
 static int T_mode = VERBOSE;	/* flag indicating print mode: VERBOSE, */
 				/* NOPASS, DISCARD */
 
@@ -166,6 +167,9 @@ static void tst_res__(const char *file, const int lineno, int ttype,
 	 */
 	T_exitval |= ttype_result;
 
+	if (ttype_result == TPASS)
+		passed_cnt++;
+
 	check_env();
 
 	/*
@@ -390,7 +394,12 @@ void tst_exit(void)
 
 	tst_flush();
 
-	exit(T_exitval & ~TINFO);
+	T_exitval &= ~TINFO;
+
+	if (T_exitval == TCONF && passed_cnt)
+		T_exitval &= ~TCONF;
+
+	exit(T_exitval);
 }
 
 pid_t tst_fork(void)
lib/tst_test.c +1 -1
index 4c30edab5..f72de82d4 100644
@@ -561,7 +561,7 @@ static void do_exit(int ret)
 		if (results->failed)
 			ret |= TFAIL;
 
-		if (results->skipped)
+		if (results->skipped && !results->passed)
 			ret |= TCONF;
 
 		if (results->warnings)
Signature · 1 line
2.13.0
#1 lore raw

RFC PATCH 1/1 lib/tst_test: Report 0 if test has both TPASS and TCONF

----- Original Message -----

Quoted 5 lines

It's probably a bit more logical to report a succes if only part of the test was skipped and the rest was sucessful. That way we can distinguish tests that were compiled-out completely or where the kernel does not support the particular syscall at all. The difference is about 15 testcases that report TPASS instead of TCONF after this change.

Looks good to me. I've noticed more TCONFs too with your all_filesystems patch, where some filesystems didn't support all features.

Regards,
Jan

#2 lore raw

RFC PATCH 1/1 lib/tst_test: Report 0 if test has both TPASS and TCONF

Hi!

Quoted 8 lines
Quoted 5 lines

It's probably a bit more logical to report a succes if only part of the test was skipped and the rest was sucessful. That way we can distinguish tests that were compiled-out completely or where the kernel does not support the particular syscall at all. The difference is about 15 testcases that report TPASS instead of TCONF after this change.

Looks good to me. I've noticed more TCONFs too with your all_filesystems patch, where some filesystems didn't support all features.

Pushed with your ack.

Signature · 2 lines
Cyril Hrubis
[email protected]