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>
This commit is contained in:
Tommi Rantala 2020-10-08 15:26:26 +03:00 committed by Shuah Khan
parent 0b18fed98b
commit b5ec9fe5be
1 changed files with 4 additions and 1 deletions

View File

@ -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);