public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Ricardo Branco <rbranco@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] userfaultfd: Do not use min_kver as gate for test
Date: Wed, 28 Jan 2026 12:54:28 +0100	[thread overview]
Message-ID: <20260128115432.21199-1-rbranco@suse.de> (raw)

Do not use .min_kver to decide whether the test should run and instead
check for the presence of /dev/userfaultfd at runtime.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
---
 .../kernel/syscalls/userfaultfd/userfaultfd03.c    | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c
index ba87bf6e4..d6e1897db 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c
@@ -13,6 +13,7 @@
 
 #include "config.h"
 #include <poll.h>
+#include <unistd.h>
 #include "tst_test.h"
 #include "tst_safe_macros.h"
 #include "tst_safe_pthread.h"
@@ -23,6 +24,17 @@ static char *page;
 static void *copy_page;
 static int uffd;
 
+static void setup(void)
+{
+	if (access("/dev/userfaultfd", F_OK) == 0)
+		return;
+
+	if (tst_kvercmp(6, 1, 0) < 0)
+		tst_brk(TCONF, "/dev/userfaultfd is missing (kernel < 6.1)");
+
+	tst_brk(TBROK, "/dev/userfaultfd is missing (kernel >= 6.1)");
+}
+
 static int open_userfaultfd(int flags)
 {
 	int fd, fd2;
@@ -117,6 +129,6 @@ static void run(void)
 
 static struct tst_test test = {
 	.needs_root = 1,
+	.setup = setup,
 	.test_all = run,
-	.min_kver = "5.11",
 };
-- 
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-01-28 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 11:54 Ricardo Branco [this message]
2026-01-28 12:50 ` [LTP] [PATCH] userfaultfd: Do not use min_kver as gate for test Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260128115432.21199-1-rbranco@suse.de \
    --to=rbranco@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox