summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommi Rantala <tommi.t.rantala@nokia.com>2020-10-08 15:26:26 +0300
committerShuah Khan <skhan@linuxfoundation.org>2020-10-27 17:01:45 -0600
commitb5ec9fe5be5e02e7db9e79aaa9a1ea7a3419d0b5 (patch)
tree078beaeb014bf5b92804ee76ca55ae7f53b1728c
parent0b18fed98bf96ba5ac14ab7c43c8a3364cb0daf8 (diff)
downloadlwn-b5ec9fe5be5e02e7db9e79aaa9a1ea7a3419d0b5.tar.gz
lwn-b5ec9fe5be5e02e7db9e79aaa9a1ea7a3419d0b5.zip
selftests: pidfd: skip test on kcmp() ENOSYS
Skip test if kcmp() is not available, for example if kernel is compiled without CONFIG_CHECKPOINT_RESTORE=y. Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-rw-r--r--tools/testing/selftests/pidfd/pidfd_getfd_test.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/pidfd/pidfd_getfd_test.c b/tools/testing/selftests/pidfd/pidfd_getfd_test.c
index 7758c98be015..0930e2411dfb 100644
--- a/tools/testing/selftests/pidfd/pidfd_getfd_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_getfd_test.c
@@ -204,7 +204,10 @@ TEST_F(child, fetch_fd)
fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0);
ASSERT_GE(fd, 0);
- EXPECT_EQ(0, sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd));
+ ret = sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd);
+ if (ret < 0 && errno == ENOSYS)
+ SKIP(return, "kcmp() syscall not supported");
+ EXPECT_EQ(ret, 0);
ret = fcntl(fd, F_GETFD);
ASSERT_GE(ret, 0);