Skip to content

Commit

Permalink
selftests: skip mincore.check_file_mmap when fs lacks needed support
Browse files Browse the repository at this point in the history
[ Upstream commit dae1d8a ]

Report mincore.check_file_mmap as SKIP instead of FAIL if the underlying
filesystem lacks support of O_TMPFILE or fallocate since such failures
are not really related to mincore functionality.

Cc: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
freefall75 authored and gregkh committed Feb 23, 2022
1 parent 204a239 commit 139fce2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tools/testing/selftests/mincore/mincore_selftest.c
Expand Up @@ -208,15 +208,21 @@ TEST(check_file_mmap)

errno = 0;
fd = open(".", O_TMPFILE | O_RDWR, 0600);
ASSERT_NE(-1, fd) {
TH_LOG("Can't create temporary file: %s",
strerror(errno));
if (fd < 0) {
ASSERT_EQ(errno, EOPNOTSUPP) {
TH_LOG("Can't create temporary file: %s",
strerror(errno));
}
SKIP(goto out_free, "O_TMPFILE not supported by filesystem.");
}
errno = 0;
retval = fallocate(fd, 0, 0, FILE_SIZE);
ASSERT_EQ(0, retval) {
TH_LOG("Error allocating space for the temporary file: %s",
strerror(errno));
if (retval) {
ASSERT_EQ(errno, EOPNOTSUPP) {
TH_LOG("Error allocating space for the temporary file: %s",
strerror(errno));
}
SKIP(goto out_close, "fallocate not supported by filesystem.");
}

/*
Expand Down Expand Up @@ -272,7 +278,9 @@ TEST(check_file_mmap)
}

munmap(addr, FILE_SIZE);
out_close:
close(fd);
out_free:
free(vec);
}

Expand Down

0 comments on commit 139fce2

Please sign in to comment.