[tip: timers/core] selftests: timers: nanosleep: Report each test separately

From: tip-bot2 for Thomas Weißschuh (Schneider Electric)

Date: Tue Aug 11 2026 - 12:26:23 EST


The following commit has been merged into the timers/core branch of tip:

Commit-ID: a1211288234058b0d13e2cc4a910b556c5308fdd
Gitweb: https://git.kernel.org/tip/a1211288234058b0d13e2cc4a910b556c5308fdd
Author: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@xxxxxxxxxxxxx>
AuthorDate: Mon, 03 Aug 2026 12:04:44 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Tue, 11 Aug 2026 18:11:21 +02:00

selftests: timers: nanosleep: Report each test separately

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) <thomas.weissschuh@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-13-910cbd485390@xxxxxxxxxxxxx
---
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 dd899dc..b45e4c8 100644
--- a/tools/testing/selftests/timers/nanosleep.c
+++ b/tools/testing/selftests/timers/nanosleep.c
@@ -142,23 +142,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)
@@ -175,7 +170,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];
@@ -184,5 +179,5 @@ int main(int argc, char **argv)

nanosleep_test_clock(clockid);
}
- ksft_exit_pass();
+ ksft_finished();
}