]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-path: Skip test when we can't create a cgroup
authorDaan De Meyer <daan@amutable.com>
Wed, 20 May 2026 17:21:13 +0000 (17:21 +0000)
committerDaan De Meyer <daan@amutable.com>
Wed, 20 May 2026 17:22:35 +0000 (17:22 +0000)
Instead of having CI runner specific checks, let's just
skip the test if we get EXIT_CGROUP which is what we get
when we can't create a cgroup. This makes the check work
independently of CI runner, and specifically also on github
actions.

src/test/test-path.c

index b02f7e2e7f7d6523f5855fdcb3744107040da557..52b9d75f6013fbe2eaaade9df1b70cb66a0f1577 100644 (file)
@@ -121,19 +121,16 @@ static int _check_states(
                         last_service_result = service->result;
                 }
 
+                /* We may fail to start the service for reasons which are not under our control: cgroup
+                 * setup denied, permission limits, resource exhaustion, etc. RESOURCES is terminal here
+                 * for path units that don't auto-retry (PathChanged, PathModified) — they'd just sit in
+                 * the failure state until the test timeout. Skip rather than wait. */
                 if (service->state == SERVICE_FAILED &&
-                    (service->main_exec_status.status == EXIT_CGROUP || service->result == SERVICE_FAILURE_RESOURCES)) {
-                        /* On a general purpose system we may fail to start the service for reasons which are
-                         * not under our control: permission limits, resource exhaustion, etc. Let's skip the
-                         * test in those cases. On CI we expect a properly configured environment, except for
-                         * Salsa where we can't set up cgroups so the unit always fails. */
-                        const char *ci = ci_environment();
-                        if (!ci || streq(ci, "salsa-ci"))
-                                return log_tests_skipped("Failed to start service %s: %s/%s",
-                                                         UNIT(service)->id,
-                                                         service_state_to_string(service->state),
-                                                         service_result_to_string(service->result));
-                }
+                    (service->main_exec_status.status == EXIT_CGROUP || service->result == SERVICE_FAILURE_RESOURCES))
+                        return log_tests_skipped("Failed to start service %s: %s/%s",
+                                                 UNIT(service)->id,
+                                                 service_state_to_string(service->state),
+                                                 service_result_to_string(service->result));
 
                 /* SERVICE_FAILURE_START_LIMIT_HIT is terminal: the unit won't recover without an explicit
                  * reset, so further looping is pointless. Skip the test rather than burning the 30s timeout. */