Skip to content

Commit 76d2d75

Browse files
committed
selftests/pidfd: adapt to recent changes
Adapt to changes in commit 9133607 ("exit: fix the usage of delay_group_leader->exit_code in do_notify_parent() and pidfs_exit()"). Even if the thread-group leader exited early and succesfully it's exit status will only be reported once the whole thread-group has exited and it will share the exit code of the thread-group. So if the thread-group was SIGKILLed the thread-group leader will also be reported as having been SIGKILLed. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Oleg Nesterov <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 0af2f6b commit 76d2d75

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tools/testing/selftests/pidfd/pidfd_info_test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ TEST_F(pidfd_info, thread_group)
362362
ASSERT_EQ(ioctl(pidfd_leader, PIDFD_GET_INFO, &info), 0);
363363
ASSERT_FALSE(!!(info.mask & PIDFD_INFO_CREDS));
364364
ASSERT_TRUE(!!(info.mask & PIDFD_INFO_EXIT));
365-
/* The thread-group leader exited successfully. Only the specific thread was SIGKILLed. */
366-
ASSERT_TRUE(WIFEXITED(info.exit_code));
367-
ASSERT_EQ(WEXITSTATUS(info.exit_code), 0);
365+
/* Even though the thread-group exited successfully it will still report the group exit code. */
366+
ASSERT_TRUE(WIFSIGNALED(info.exit_code));
367+
ASSERT_EQ(WTERMSIG(info.exit_code), SIGKILL);
368368

369369
/*
370370
* Retrieve exit information for the thread-group leader via the
@@ -375,9 +375,9 @@ TEST_F(pidfd_info, thread_group)
375375
ASSERT_FALSE(!!(info2.mask & PIDFD_INFO_CREDS));
376376
ASSERT_TRUE(!!(info2.mask & PIDFD_INFO_EXIT));
377377

378-
/* The thread-group leader exited successfully. Only the specific thread was SIGKILLed. */
379-
ASSERT_TRUE(WIFEXITED(info2.exit_code));
380-
ASSERT_EQ(WEXITSTATUS(info2.exit_code), 0);
378+
/* Even though the thread-group exited successfully it will still report the group exit code. */
379+
ASSERT_TRUE(WIFSIGNALED(info2.exit_code));
380+
ASSERT_EQ(WTERMSIG(info2.exit_code), SIGKILL);
381381

382382
/* Retrieve exit information for the thread. */
383383
info.mask = PIDFD_INFO_CGROUPID | PIDFD_INFO_EXIT;

0 commit comments

Comments
 (0)