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

Merge tag 'linux-kselftest-fixes-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kselftest fixes from Shuah Khan:
"Fixes to the pidfd test"

* tag 'linux-kselftest-fixes-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests/pidfd_test: Remove the erroneous ','
selftests: pidfd: Fix compling warnings
ksefltests: pidfd: Fix wait_states: Test terminated by timeout

+15 -3
+1 -1
tools/testing/selftests/pidfd/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - CFLAGS += -g -I../../../../usr/include/ -pthread 2 + CFLAGS += -g -I../../../../usr/include/ -pthread -Wall 3 3 4 4 TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \ 5 5 pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test
+3 -1
tools/testing/selftests/pidfd/pidfd_test.c
··· 413 413 414 414 c = epoll_wait(epoll_fd, events, MAX_EVENTS, 5000); 415 415 if (c != 1 || !(events[0].events & EPOLLIN)) 416 - ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) ", 416 + ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) " 417 417 "(errno %d)\n", 418 418 test_name, c, events[0].events, errno); 419 419 ··· 435 435 */ 436 436 while (1) 437 437 sleep(1); 438 + 439 + return 0; 438 440 } 439 441 440 442 static void test_pidfd_poll_exec(int use_waitpid)
+11 -1
tools/testing/selftests/pidfd/pidfd_wait.c
··· 95 95 .flags = CLONE_PIDFD | CLONE_PARENT_SETTID, 96 96 .exit_signal = SIGCHLD, 97 97 }; 98 + int pfd[2]; 98 99 pid_t pid; 99 100 siginfo_t info = { 100 101 .si_signo = 0, 101 102 }; 102 103 104 + ASSERT_EQ(pipe(pfd), 0); 103 105 pid = sys_clone3(&args); 104 106 ASSERT_GE(pid, 0); 105 107 106 108 if (pid == 0) { 109 + char buf[2]; 110 + 111 + close(pfd[1]); 107 112 kill(getpid(), SIGSTOP); 113 + ASSERT_EQ(read(pfd[0], buf, 1), 1); 114 + close(pfd[0]); 108 115 kill(getpid(), SIGSTOP); 109 116 exit(EXIT_SUCCESS); 110 117 } 111 118 119 + close(pfd[0]); 112 120 ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WSTOPPED, NULL), 0); 113 121 ASSERT_EQ(info.si_signo, SIGCHLD); 114 122 ASSERT_EQ(info.si_code, CLD_STOPPED); ··· 125 117 ASSERT_EQ(sys_pidfd_send_signal(pidfd, SIGCONT, NULL, 0), 0); 126 118 127 119 ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WCONTINUED, NULL), 0); 120 + ASSERT_EQ(write(pfd[1], "C", 1), 1); 121 + close(pfd[1]); 128 122 ASSERT_EQ(info.si_signo, SIGCHLD); 129 123 ASSERT_EQ(info.si_code, CLD_CONTINUED); 130 124 ASSERT_EQ(info.si_pid, parent_tid); ··· 148 138 149 139 TEST(wait_nonblock) 150 140 { 151 - int pidfd, status = 0; 141 + int pidfd; 152 142 unsigned int flags = 0; 153 143 pid_t parent_tid = -1; 154 144 struct clone_args args = {