From 10a04f6fd23d23b7c8adc4ad2720dccefe4de9ee Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 13 Feb 2026 21:37:56 +0000 Subject: [PATCH] test: do not fail when parsing PID that isn't thread-group leader (#40677) ``` TEST-02-UNITTESTS.sh[4382]: [ 707.393188] test-cgroup-util[426]: Failed to open pidfd for pid 414: Invalid argument TEST-02-UNITTESTS.sh[4382]: [ 707.393193] test-cgroup-util[426]: src/test/test-cgroup-util.c:249: Assertion failed: Expected "r = proc_dir_read_pidref(d, &pid)" to succeed, but got error: -22/EINVAL ``` The kernel can return EINVAL on pidfd_open() when the selected PID is not a thread group leader. Don't fail the test, as we are iterating on everything, so this can seldomly happen. --- src/test/test-cgroup-util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c index b8393f33683..53f617b7213 100644 --- a/src/test/test-cgroup-util.c +++ b/src/test/test-cgroup-util.c @@ -246,7 +246,10 @@ TEST(proc, .sd_booted = true) { _cleanup_(pidref_done) PidRef pid = PIDREF_NULL; uid_t uid = UID_INVALID; - ASSERT_OK(r = proc_dir_read_pidref(d, &pid)); + r = proc_dir_read_pidref(d, &pid); + if (r == -EINVAL) /* Can happen if we pick a non-thread-group leader */ + continue; + ASSERT_OK(r); if (r == 0) break; -- 2.47.3