Unlike the other cases gup_longterm's memfd tests previously skipped the
test when failing to set up the file descriptor to test, restore this
behaviour.

Signed-off-by: Mark Brown <broo...@kernel.org>
---
 tools/testing/selftests/mm/gup_longterm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/gup_longterm.c 
b/tools/testing/selftests/mm/gup_longterm.c
index 8a97ac5176a4..29047d2e0c49 100644
--- a/tools/testing/selftests/mm/gup_longterm.c
+++ b/tools/testing/selftests/mm/gup_longterm.c
@@ -298,8 +298,11 @@ static void run_with_memfd(test_fn fn, const char *desc)
        log_test_start("%s ... with memfd", desc);
 
        fd = memfd_create("test", 0);
-       if (fd < 0)
+       if (fd < 0) {
                ksft_print_msg("memfd_create() failed (%s)\n", strerror(errno));
+               log_test_result(KSFT_SKIP);
+               return;
+       }
 
        fn(fd, pagesize);
        close(fd);
@@ -366,6 +369,8 @@ static void run_with_memfd_hugetlb(test_fn fn, const char 
*desc,
        fd = memfd_create("test", flags);
        if (fd < 0) {
                ksft_print_msg("memfd_create() failed (%s)\n", strerror(errno));
+               log_test_result(KSFT_SKIP);
+               return;
        }
 
        fn(fd, hugetlbsize);

---
base-commit: ec7714e4947909190ffb3041a03311a975350fe0
change-id: 20250603-selftest-mm-gup-longterm-tweaks-e685a8ae9751

Best regards,
-- 
Mark Brown <broo...@kernel.org>


Reply via email to