test-cgroup: Ignore ENOENT from cg_create(); test-cgroup-util: Ignore ENXIO in one more place (#38158)
This was the only test failure building systemd-252-51.el9 in a container, also previously reported against 252-rc1 under Gentoo in #25015 This is a forward-port of the patch we actually started using for CIQ's builds of the EL9-derived package, which was: ```diff --- systemd-252/src/test/test-cgroup.c 2022-10-31 18:59:18.000000000 +0000 +++ systemd-252-test/src/test/test-cgroup.c 2025-07-10 00:47:07.541000000 +0000 @@ -62,7 +62,7 @@ log_info("Paths for test:\n%s\n%s", test_a, test_b); r = cg_create(SYSTEMD_CGROUP_CONTROLLER, test_a); - if (IN_SET(r, -EPERM, -EACCES, -EROFS)) { + if (IN_SET(r, -EPERM, -EACCES, -EROFS, -ENOENT)) { log_info_errno(r, "Skipping %s: %m", __func__); return; } ``` I confirmed that the `ERRNO_IS_NEG_FS_WRITE_REFUSED` macro is equivalent to checking the first 3 error codes above, so the addition of the check for `ENOENT` is still just as relevant as it was in 252, but adding it into the macro would be inconsistent with its name, description, and possible other uses. Hence, in this PR I'm adding the extra check into the `if`.
This commit is contained in:
@@ -258,7 +258,7 @@ TEST(proc, .sd_booted = true) {
|
||||
ASSERT_OK_OR(r4, -ESRCH, -ENXIO);
|
||||
ASSERT_OK_OR(r5, -ESRCH, -ENXIO);
|
||||
ASSERT_OK_OR(r6, -ESRCH, -ENXIO);
|
||||
ASSERT_OK_OR(r7, -ESRCH, -ENOENT);
|
||||
ASSERT_OK_OR(r7, -ESRCH, -ENXIO, -ENOENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ TEST(cg_create) {
|
||||
(void) cg_trim(test_b, /* delete_root= */ true);
|
||||
|
||||
r = cg_create(test_a);
|
||||
if (ERRNO_IS_NEG_FS_WRITE_REFUSED(r))
|
||||
if (ERRNO_IS_NEG_FS_WRITE_REFUSED(r) || r == -ENOENT)
|
||||
return (void) log_tests_skipped_errno(r, "%s: Failed to create cgroup %s", __func__, test_a);
|
||||
|
||||
ASSERT_OK_EQ(r, 1);
|
||||
|
||||
Reference in New Issue
Block a user