Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tommi Rantala and committed by
Shuah Khan
b5ec9fe5 0b18fed9

+4 -1
+4 -1
tools/testing/selftests/pidfd/pidfd_getfd_test.c
··· 204 204 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); 205 205 ASSERT_GE(fd, 0); 206 206 207 - EXPECT_EQ(0, sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd)); 207 + ret = sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd); 208 + if (ret < 0 && errno == ENOSYS) 209 + SKIP(return, "kcmp() syscall not supported"); 210 + EXPECT_EQ(ret, 0); 208 211 209 212 ret = fcntl(fd, F_GETFD); 210 213 ASSERT_GE(ret, 0);