[PATCH 12/16] selftests: timers: nanosleep: Report each test separately

Thomas Weißschuh (Schneider Electric) <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,org.kernel.vger.linux-kernel
Message-ID <20260730-auxclock-nanosleep-prep-v1-12-cd8b61229a7c@linutronix.de>
Currently the test for the sleep functionality itself and the one for
the remaining time are reported together. This makes the test output a
bit confusing, especially as the upcoming tests for auxiliary clocks
will have different results between the two parts.

Report each test part on its own.

This also allows continuing testing other clocks after a single one has failed.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <[email protected]>
---
 tools/testing/selftests/timers/nanosleep.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/timers/nanosleep.c b/tools/testing/selftests/timers/nanosleep.c
index 5037481516df..e69cc0d56445 100644
--- a/tools/testing/selftests/timers/nanosleep.c
+++ b/tools/testing/selftests/timers/nanosleep.c
@@ -139,23 +139,18 @@ static void nanosleep_test_clock(clockid_t clockid)
 
 	while (length <= (NSEC_PER_SEC * 10)) {
 		ret = nanosleep_test(clockid, length);
-		if (ret == KSFT_SKIP) {
-			ksft_test_result_skip("%s\n", clock_name(clockid));
+		if (ret != KSFT_PASS) {
+			ksft_test_result_report(ret, "%s\n", clock_name(clockid));
+			ksft_test_result_skip("%s (remaining)\n", clock_name(clockid));
 			return;
 		}
-		if (ret == KSFT_FAIL) {
-			ksft_test_result_fail("%s\n", clock_name(clockid));
-			ksft_exit_fail();
-		}
+
 		length *= 100;
 	}
+	ksft_test_result_pass("%s\n", clock_name(clockid));
 
 	ret = nanosleep_test_remaining(clockid);
-	if (ret == KSFT_FAIL) {
-		ksft_test_result_fail("%s\n", clock_name(clockid));
-		ksft_exit_fail();
-	}
-	ksft_test_result_pass("%s\n", clock_name(clockid));
+	ksft_test_result_report(ret, "%s (remaining)\n", clock_name(clockid));
 }
 
 int main(int argc, char **argv)
@@ -172,7 +167,7 @@ int main(int argc, char **argv)
 	};
 
 	ksft_print_header();
-	ksft_set_plan(ARRAY_SIZE(tested_clocks));
+	ksft_set_plan(ARRAY_SIZE(tested_clocks) * 2);
 
 	for (size_t clock_index = 0; clock_index < ARRAY_SIZE(tested_clocks); clock_index++) {
 		clockid = tested_clocks[clock_index];
@@ -181,5 +176,5 @@ int main(int argc, char **argv)
 
 		nanosleep_test_clock(clockid);
 	}
-	ksft_exit_pass();
+	ksft_finished();
 }

-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.