diff mbox series

[GIT,PULL] Kselftest fixes update for Linux 6.1-rc4

Message ID 6eae8f0b-2050-3c0f-828d-8b87262b1cef@linuxfoundation.org
State New
Headers show
Series [GIT,PULL] Kselftest fixes update for Linux 6.1-rc4 | expand

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-fixes-6.1-rc4

Commit Message

Shuah Khan Nov. 3, 2022, 1:33 p.m. UTC
Hi Linus,

Please pull the following Kselftest fixes update for Linux 6.1-rc4.

This Kselftest fixes update for Linux 6.1-rc4 consists of fixes to
pidfd test.

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit cb05c81ada76a30a25a5f79b249375e33473af33:

   selftests/ftrace: fix dynamic_events dependency check (2022-10-18 14:27:23 -0600)

are available in the Git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-fixes-6.1-rc4

for you to fetch changes up to 89c1017aac67ca81973b7c8eac5d021315811a93:

   selftests/pidfd_test: Remove the erroneous ',' (2022-11-02 03:09:57 -0600)

----------------------------------------------------------------
linux-kselftest-fixes-6.1-rc4

This Kselftest fixes update for Linux 6.1-rc4 consists of fixes to
pidfd test.

----------------------------------------------------------------
Li Zhijian (2):
       ksefltests: pidfd: Fix wait_states: Test terminated by timeout
       selftests: pidfd: Fix compling warnings

Zhao Gongyi (1):
       selftests/pidfd_test: Remove the erroneous ','

  tools/testing/selftests/pidfd/Makefile     |  2 +-
  tools/testing/selftests/pidfd/pidfd_test.c |  4 +++-
  tools/testing/selftests/pidfd/pidfd_wait.c | 12 +++++++++++-
  3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------

Comments

pr-tracker-bot@kernel.org Nov. 3, 2022, 6:31 p.m. UTC | #1
The pull request you sent on Thu, 3 Nov 2022 07:33:57 -0600:

> git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-fixes-6.1-rc4

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/5fdf9c45473569e87cc4206e80f186fc85b9eff9

Thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/pidfd/Makefile b/tools/testing/selftests/pidfd/Makefile
index f4a2f28f926b..778b6cdc8aed 100644
--- a/tools/testing/selftests/pidfd/Makefile
+++ b/tools/testing/selftests/pidfd/Makefile
@@ -1,5 +1,5 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
-CFLAGS += -g -I../../../../usr/include/ -pthread
+CFLAGS += -g -I../../../../usr/include/ -pthread -Wall
 
 TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \
 	pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test
diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
index 9a2d64901d59..e2dd4ed84984 100644
--- a/tools/testing/selftests/pidfd/pidfd_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_test.c
@@ -413,7 +413,7 @@  static void poll_pidfd(const char *test_name, int pidfd)
 
 	c = epoll_wait(epoll_fd, events, MAX_EVENTS, 5000);
 	if (c != 1 || !(events[0].events & EPOLLIN))
-		ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) ",
+		ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) "
 				   "(errno %d)\n",
 				   test_name, c, events[0].events, errno);
 
@@ -435,6 +435,8 @@  static int child_poll_exec_test(void *args)
 	 */
 	while (1)
 		sleep(1);
+
+	return 0;
 }
 
 static void test_pidfd_poll_exec(int use_waitpid)
diff --git a/tools/testing/selftests/pidfd/pidfd_wait.c b/tools/testing/selftests/pidfd/pidfd_wait.c
index 070c1c876df1..0dcb8365ddc3 100644
--- a/tools/testing/selftests/pidfd/pidfd_wait.c
+++ b/tools/testing/selftests/pidfd/pidfd_wait.c
@@ -95,20 +95,28 @@  TEST(wait_states)
 		.flags = CLONE_PIDFD | CLONE_PARENT_SETTID,
 		.exit_signal = SIGCHLD,
 	};
+	int pfd[2];
 	pid_t pid;
 	siginfo_t info = {
 		.si_signo = 0,
 	};
 
+	ASSERT_EQ(pipe(pfd), 0);
 	pid = sys_clone3(&args);
 	ASSERT_GE(pid, 0);
 
 	if (pid == 0) {
+		char buf[2];
+
+		close(pfd[1]);
 		kill(getpid(), SIGSTOP);
+		ASSERT_EQ(read(pfd[0], buf, 1), 1);
+		close(pfd[0]);
 		kill(getpid(), SIGSTOP);
 		exit(EXIT_SUCCESS);
 	}
 
+	close(pfd[0]);
 	ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WSTOPPED, NULL), 0);
 	ASSERT_EQ(info.si_signo, SIGCHLD);
 	ASSERT_EQ(info.si_code, CLD_STOPPED);
@@ -117,6 +125,8 @@  TEST(wait_states)
 	ASSERT_EQ(sys_pidfd_send_signal(pidfd, SIGCONT, NULL, 0), 0);
 
 	ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WCONTINUED, NULL), 0);
+	ASSERT_EQ(write(pfd[1], "C", 1), 1);
+	close(pfd[1]);
 	ASSERT_EQ(info.si_signo, SIGCHLD);
 	ASSERT_EQ(info.si_code, CLD_CONTINUED);
 	ASSERT_EQ(info.si_pid, parent_tid);
@@ -138,7 +148,7 @@  TEST(wait_states)
 
 TEST(wait_nonblock)
 {
-	int pidfd, status = 0;
+	int pidfd;
 	unsigned int flags = 0;
 	pid_t parent_tid = -1;
 	struct clone_args args = {