Skip to content

Commit b1a529b

Browse files
broonieakpm00
authored andcommitted
selftests/mm: skip failed memfd setups in gup_longterm
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: 66bce7a ("selftests/mm: fix test result reporting in gup_longterm") Signed-off-by: Mark Brown <[email protected]> Reported-by: Lorenzo Stoakes <[email protected]> Closes: https://lkml.kernel.org/r/[email protected] Reviewed-by: Lorenzo Stoakes <[email protected]> Tested-by: Lorenzo Stoakes <[email protected]> Acked-by: David Hildenbrand <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 19272b3 commit b1a529b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/testing/selftests/mm/gup_longterm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,11 @@ static void run_with_memfd(test_fn fn, const char *desc)
298298
log_test_start("%s ... with memfd", desc);
299299

300300
fd = memfd_create("test", 0);
301-
if (fd < 0)
301+
if (fd < 0) {
302302
ksft_print_msg("memfd_create() failed (%s)\n", strerror(errno));
303+
log_test_result(KSFT_SKIP);
304+
return;
305+
}
303306

304307
fn(fd, pagesize);
305308
close(fd);
@@ -366,6 +369,8 @@ static void run_with_memfd_hugetlb(test_fn fn, const char *desc,
366369
fd = memfd_create("test", flags);
367370
if (fd < 0) {
368371
ksft_print_msg("memfd_create() failed (%s)\n", strerror(errno));
372+
log_test_result(KSFT_SKIP);
373+
return;
369374
}
370375

371376
fn(fd, hugetlbsize);

0 commit comments

Comments
 (0)