Skip to contentSkip to conversation

selftests/liveupdate: return KSFT_SKIP when all VM tests are skipped

PATCH In review Nevzat Kutay Aydoğdu 3 participants 3 messages Nov 28 – Dec 1

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/liveupdate: return KSFT_SKIP when all VM tests are skipped

When all Live Update VM tests are skipped, run-vmtests.sh reports zero passes and zero failures but exits with status 0. Callers that rely on the exit status can mistake a skipped run for a successful one.

Return KSFT_SKIP (4) when all tests are skipped. Keep returning 1 if any test fails and 0 if at least one test passes and none fail.

Fixes 89dd1421c554 ("selftests/liveupdate: add end to end test infrastructure and scripts")
---
 tools/testing/selftests/liveupdate/run-vmtests.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/liveupdate/run-vmtests.sh +8 -1
index d656ce58c5a7..574dee7b08ce 100755
@@ -91,7 +91,14 @@ function main() {
 		echo "Logs: $output_dir"
 	fi
 
-	exit $((failed != 0))
+	if (( failed > 0 )); then
+		exit 1
+	fi
+
+	if (( passed == 0 && skipped > 0 )); then
+		exit 4
+	fi
+
 }
 
 main "$@"
Signature · 1 line
2.53.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines

When all Live Update VM tests are skipped, run-vmtests.sh reports zero passes and zero failures but exits with status 0. Callers that rely on the exit status can mistake a skipped run for a successful one.

Return KSFT_SKIP (4) when all tests are skipped. Keep returning 1 if any test fails and 0 if at least one test passes and none fail.

Fixes 89dd1421c554 ("selftests/liveupdate: add end to end test infrastructure and scripts")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer
#2 lore raw
In reply to Nevzat Kutay Aydoğdu

Hi,

Quoted 3 lines · Nevzat Kutay Aydoğdu

When all Live Update VM tests are skipped, run-vmtests.sh reports zero passes and zero failures but exits with status 0. Callers that rely on the exit status can mistake a skipped run for a successful one.

Normally kselftests return 0 even when the skipped all the tests.

Quoted 33 lines

Return KSFT_SKIP (4) when all tests are skipped. Keep returning 1 if any test fails and 0 if at least one test passes and none fail.

Fixes 89dd1421c554 ("selftests/liveupdate: add end to end test infrastructure and scripts")
---
 tools/testing/selftests/liveupdate/run-vmtests.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/liveupdate/run-vmtests.sh +8 -1
index d656ce58c5a7..574dee7b08ce 100755
@@ -91,7 +91,14 @@ function main() {
 		echo "Logs: $output_dir"
 	fi
 
-	exit $((failed != 0))
+	if (( failed > 0 )); then
+		exit 1
+	fi
+
+	if (( passed == 0 && skipped > 0 )); then
+		exit 4
+	fi
+
 }
 
 main "$@"
Signature · 1 line
2.53.0
Signature · 2 lines
Sincerely yours,
Mike.