]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/mm: skip failed memfd setups in gup_longterm
authorMark Brown <broonie@kernel.org>
Thu, 5 Jun 2025 21:34:31 +0000 (22:34 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 12 Jun 2025 05:42:34 +0000 (22:42 -0700)
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
behavior to avoid hitting failures when hugetlb isn't configured.

Link: https://lkml.kernel.org/r/20250605-selftest-mm-gup-longterm-tweaks-v1-1-2fae34b05958@kernel.org
Fixes: 66bce7afbaca ("selftests/mm: fix test result reporting in gup_longterm")
Signed-off-by: Mark Brown <broonie@kernel.org>
Reported-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Closes: https://lkml.kernel.org/r/a76fc252-0fe3-4d4b-a9a1-4a2895c2680d@lucifer.local
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Tested-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/gup_longterm.c

index 8a97ac5176a48e93acb68b2d9a19c23b1ef7916c..29047d2e0c49fa033acce16b71372df62164e55a 100644 (file)
@@ -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);