[PATCH] selftests/timers: Skip some posix_timers tests on kernels < 6.13

Wake Liu posted 1 patch 1 month, 4 weeks ago
tools/testing/selftests/timers/posix_timers.c | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
[PATCH] selftests/timers: Skip some posix_timers tests on kernels < 6.13
Posted by Wake Liu 1 month, 4 weeks ago
Several tests in the posix_timers selftest fail on kernels older
than 6.13. These tests check for timer behavior related to SIG_IGN,
which was refactored in the 6.13 kernel cycle, notably by
commit caf77435dd8a ("signal: Handle ignored signals in
do_sigaction(action != SIG_IGN)").

To ensure the selftests pass on older, stable kernels, gate the
affected tests with a ksft_min_kernel_version(6, 13) check.

Signed-off-by: Wake Liu <wakel@google.com>
---
 tools/testing/selftests/timers/posix_timers.c | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c
index f0eceb0faf34..f228e51f8b58 100644
--- a/tools/testing/selftests/timers/posix_timers.c
+++ b/tools/testing/selftests/timers/posix_timers.c
@@ -256,6 +256,11 @@ static void *ignore_thread(void *arg)
 
 static void check_sig_ign(int thread)
 {
+	if (!ksft_min_kernel_version(6, 13)) {
+		// see caf77435dd8a
+		ksft_test_result_skip("Depends on refactor of posix timers in 6.13\n");
+		return;
+	}
 	struct tmrsig tsig = { };
 	struct itimerspec its;
 	unsigned int tid = 0;
@@ -342,6 +347,10 @@ static void check_sig_ign(int thread)
 
 static void check_rearm(void)
 {
+	if (!ksft_min_kernel_version(6, 13)) {
+		ksft_test_result_skip("Depends on refactor of posix timers in 6.13\n");
+		return;
+	}
 	struct tmrsig tsig = { };
 	struct itimerspec its;
 	struct sigaction sa;
@@ -398,6 +407,10 @@ static void check_rearm(void)
 
 static void check_delete(void)
 {
+	if (!ksft_min_kernel_version(6, 13)) {
+		ksft_test_result_skip("Depends on refactor of posix timers in 6.13\n");
+		return;
+	}
 	struct tmrsig tsig = { };
 	struct itimerspec its;
 	struct sigaction sa;
@@ -455,6 +468,10 @@ static inline int64_t calcdiff_ns(struct timespec t1, struct timespec t2)
 
 static void check_sigev_none(int which, const char *name)
 {
+	if (!ksft_min_kernel_version(6, 13)) {
+		ksft_test_result_skip("Depends on refactor of posix timers in 6.13\n");
+		return;
+	}
 	struct timespec start, now;
 	struct itimerspec its;
 	struct sigevent sev;
@@ -493,6 +510,10 @@ static void check_sigev_none(int which, const char *name)
 
 static void check_gettime(int which, const char *name)
 {
+	if (!ksft_min_kernel_version(6, 13)) {
+		ksft_test_result_skip("Depends on refactor of posix timers in 6.13\n");
+		return;
+	}
 	struct itimerspec its, prev;
 	struct timespec start, now;
 	struct sigevent sev;
-- 
2.50.1.703.g449372360f-goog
Re: [PATCH] selftests/timers: Skip some posix_timers tests on kernels < 6.13
Posted by Thomas Gleixner 1 week, 6 days ago
On Thu, Aug 07 2025 at 16:50, Wake Liu wrote:
> Several tests in the posix_timers selftest fail on kernels older
> than 6.13. These tests check for timer behavior related to SIG_IGN,
> which was refactored in the 6.13 kernel cycle, notably by
> commit caf77435dd8a ("signal: Handle ignored signals in
> do_sigaction(action != SIG_IGN)").
>
> To ensure the selftests pass on older, stable kernels, gate the
> affected tests with a ksft_min_kernel_version(6, 13) check.

What's the point of emitting 9 times the same skip message?

There is no value at all and this can nicely be solved in main() by
checking the kernel version once, registering either 10 or 19 tests and
not invoking the tests which depend on 6.13+ in the first place, No?

Thanks,

        tglx