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 <wa...@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


Reply via email to