Skip to contentSkip to conversation

selftests/harness: Actually report SKIP for signal tests

PATCH New Kees Cook 1 participant 1 message Aug 7, 2023

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 selftests/harness: Actually report SKIP for signal tests

Tests that were expecting a signal were not correctly checking for a SKIP condition. Move the check before the signal checking when processing test result.

Cc Shuah Khan <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Will Drewry <[email protected]>
Fixes 9847d24af95c ("selftests/harness: Refactor XFAIL into SKIP")
---
 tools/testing/selftests/kselftest_harness.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
tools/testing/selftests/kselftest_harness.h +5 -6
index 5fd49ad0c696..e05ac8261046 100644
@@ -938,7 +938,11 @@ void __wait_for_test(struct __test_metadata *t)
 		fprintf(TH_LOG_STREAM,
 			"# %s: Test terminated by timeout\n", t->name);
 	} else if (WIFEXITED(status)) {
-		if (t->termsig != -1) {
+		if (WEXITSTATUS(status) == 255) {
+			/* SKIP */
+			t->passed = 1;
+			t->skip = 1;
+		} else if (t->termsig != -1) {
 			t->passed = 0;
 			fprintf(TH_LOG_STREAM,
 				"# %s: Test exited normally instead of by signal (code: %d)\n",
@@ -950,11 +954,6 @@ void __wait_for_test(struct __test_metadata *t)
 			case 0:
 				t->passed = 1;
 				break;
-			/* SKIP */
-			case 255:
-				t->passed = 1;
-				t->skip = 1;
-				break;
 			/* Other failure, assume step report. */
 			default:
 				t->passed = 0;
Signature · 1 line
2.34.1