]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-cgroup-util: ignore -ENXIO in more places
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Jun 2025 19:00:16 +0000 (21:00 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 1 Jul 2025 15:51:49 +0000 (17:51 +0200)
In https://github.com/systemd/systemd/pull/38003, one test failed:
Unit tests / build (CLANG_ASAN_UBSAN):
src/test/test-cgroup-util.c:237: Assertion failed: Expected "r" to succeed, but got error: No such device or address

Checks for specific errors were added in ca82f0cbe2db096bc7ff81280b5683ea1beae534,
partially relaxed in e92d699dde746355bba893b2375b7937a52d9e05.
cg_pidref_get_unit() and cg_pid_get_slice() enter a deep chain of calls,
so it's hard to guess where the failure occurred. But those two calls
expect the cgroup path to be "well formed". When we're running in CI,
we don't have full control over what is happening on the machine,
so let's suppress that error too.

src/test/test-cgroup-util.c

index 3f3562c87850bf59090946196fa84bcebf47a6a6..8d6a4c39e765e2cab39538198a1dab061569c35d 100644 (file)
@@ -234,9 +234,9 @@ TEST(proc, .sd_booted = true) {
                 r = cg_pid_get_path_shifted(pid.pid, NULL, &path_shifted);
                 ASSERT_OK_OR(r, -ESRCH);
                 r = cg_pidref_get_unit(&pid, &unit);
-                ASSERT_OK_OR(r, -ESRCH);
+                ASSERT_OK_OR(r, -ESRCH, -ENXIO);
                 r = cg_pid_get_slice(pid.pid, &slice);
-                ASSERT_OK_OR(r, -ESRCH);
+                ASSERT_OK_OR(r, -ESRCH, -ENXIO);
 
                 /* Not all processes belong to a specific user or a machine */
                 r = cg_pidref_get_owner_uid(&pid, &uid);