Skip to content

Commit ac9e0a2

Browse files
cris-mashuahkh
authored andcommitted
selftests: openat2: Skip testcases that fail with EOPNOTSUPP
Skip testcases that fail since the requested valid flags combination is not supported by the underlying filesystem. Cc: Aleksa Sarai <cyphar@cyphar.com> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent ea33967 commit ac9e0a2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/testing/selftests/openat2/openat2_test.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ void test_openat2_flags(void)
259259
unlink(path);
260260

261261
fd = sys_openat2(AT_FDCWD, path, &test->how);
262+
if (fd < 0 && fd == -EOPNOTSUPP) {
263+
/*
264+
* Skip the testcase if it failed because not supported
265+
* by FS. (e.g. a valid O_TMPFILE combination on NFS)
266+
*/
267+
ksft_test_result_skip("openat2 with %s fails with %d (%s)\n",
268+
test->name, fd, strerror(-fd));
269+
goto next;
270+
}
271+
262272
if (test->err >= 0)
263273
failed = (fd < 0);
264274
else
@@ -303,7 +313,7 @@ void test_openat2_flags(void)
303313
else
304314
resultfn("openat2 with %s fails with %d (%s)\n",
305315
test->name, test->err, strerror(-test->err));
306-
316+
next:
307317
free(fdpath);
308318
fflush(stdout);
309319
}

0 commit comments

Comments
 (0)