@@ -96,7 +96,15 @@ static void do_test(int fd, size_t size, enum test_type type, bool shared)
int ret;
if (ftruncate(fd, size)) {
- ksft_test_result_fail("ftruncate() failed (%s)\n", strerror(errno));
+ if (errno == ENOENT) {
+ /*
+ * This can happen if the file has been unlinked and the
+ * filesystem doesn't support truncating unlinked files.
+ */
+ ksft_test_result_skip("ftruncate() failed with ENOENT");
+ } else {
+ ksft_test_result_fail("ftruncate() failed (%s)\n", strerror(errno));
+ }
return;
}
Some filesystems don't support funtract()ing unlinked files. They return ENOENT. In that case, skip the test. Signed-off-by: Brendan Jackman <jackmanb@google.com> --- tools/testing/selftests/mm/gup_longterm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)