Some of the test cases for fanotify14 do rely on a fairly recent kernel changes. Make sure those are available before triggering relevant tests.
Signed-off-by: Beata Michalska beata.michalska@arm.com --- testcases/kernel/syscalls/fanotify/fanotify14.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c index 4596511f0..8556f70c0 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify14.c +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c @@ -27,6 +27,7 @@ #define _GNU_SOURCE #include "tst_test.h" #include <errno.h> +#include <stdbool.h>
#ifdef HAVE_SYS_FANOTIFY_H #include "fanotify.h" @@ -65,6 +66,12 @@ static struct test_case_t { struct test_case_flags_t mask; int expected_errno; int *pfd; + /* + * This should be handled by min_kver from the test itself, + * but as in this case it's a set of test cases ... + */ + bool verify_kver; + } test_cases[] = { /* FAN_REPORT_FID without class FAN_CLASS_NOTIF is not valid */ { @@ -228,6 +235,7 @@ static struct test_case_t { .mask = { FAN_ACCESS, "anonymous pipe"}, .pfd = pipes, .expected_errno = EINVAL, + .verify_kver = true, }, /* filesystem mark on anonymous pipe is not valid */ { @@ -236,6 +244,7 @@ static struct test_case_t { .mask = { FAN_ACCESS, "anonymous pipe"}, .pfd = pipes, .expected_errno = EINVAL, + .verify_kver = true, }, };
@@ -246,6 +255,11 @@ static void do_test(unsigned int number) tst_res(TINFO, "Test case %d: fanotify_init(%s, O_RDONLY)", number, tc->init.desc);
+ if (tc->verify_kver && tst_kvercmp(6, 5, 0) < 0) { + tst_res(TCONF, "Required kernel version 6.5.0 or higher"); + return; + } + if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) { FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID, fan_report_target_fid_unsupported);