summary refs log tree commit diff
path: root/tools/testing
diff options
context:
space:
mode:
authorCristian Marussi <cristian.marussi@arm.com>2022-01-26 10:27:23 +0000
committerShuah Khan <skhan@linuxfoundation.org>2022-01-27 16:31:07 -0700
commitac9e0a250bb155078601a5b999aab05f2a04d1ab (patch)
tree26e0dd8500eb85970742af3b1dba8818585dd82f /tools/testing
parentea3396725aa143dd42fe388cb67e44c90d2fb719 (diff)
downloadlinux-ac9e0a250bb155078601a5b999aab05f2a04d1ab.tar.gz
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>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/openat2/openat2_test.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c
index 1bddbe934204..7fb902099de4 100644
--- a/tools/testing/selftests/openat2/openat2_test.c
+++ b/tools/testing/selftests/openat2/openat2_test.c
@@ -259,6 +259,16 @@ void test_openat2_flags(void)
 		unlink(path);
 
 		fd = sys_openat2(AT_FDCWD, path, &test->how);
+		if (fd < 0 && fd == -EOPNOTSUPP) {
+			/*
+			 * Skip the testcase if it failed because not supported
+			 * by FS. (e.g. a valid O_TMPFILE combination on NFS)
+			 */
+			ksft_test_result_skip("openat2 with %s fails with %d (%s)\n",
+					      test->name, fd, strerror(-fd));
+			goto next;
+		}
+
 		if (test->err >= 0)
 			failed = (fd < 0);
 		else
@@ -303,7 +313,7 @@ skip:
 		else
 			resultfn("openat2 with %s fails with %d (%s)\n",
 				 test->name, test->err, strerror(-test->err));
-
+next:
 		free(fdpath);
 		fflush(stdout);
 	}