]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-path: Fail earlier on start-limit-hit
authorDaan De Meyer <daan@amutable.com>
Wed, 20 May 2026 08:52:21 +0000 (08:52 +0000)
committerDaan De Meyer <daan@amutable.com>
Wed, 20 May 2026 16:04:26 +0000 (16:04 +0000)
src/test/test-path.c

index 512eb96ead60f94b6650cb887b191a762227d5f6..d9e11fd0294502caddec2c13e3bfc2fc7fffd2d5 100644 (file)
@@ -118,6 +118,17 @@ static int _check_states(unsigned line,
                                 exit(EXIT_TEST_SKIP);
                 }
 
+                /* SERVICE_FAILURE_START_LIMIT_HIT is terminal: the unit won't recover without an explicit
+                 * reset, so further looping is pointless. Abort the subtest rather than burning the 30s
+                 * timeout. */
+                if (service->state == SERVICE_FAILED &&
+                    service->result == SERVICE_FAILURE_START_LIMIT_HIT)
+                        return log_notice_errno(SYNTHETIC_ERRNO(ECANCELED),
+                                                "Failed to start service %s, aborting test: %s/%s",
+                                                UNIT(service)->id,
+                                                service_state_to_string(service->state),
+                                                service_result_to_string(service->result));
+
                 if (n >= end) {
                         log_error("Test timeout when testing %s", UNIT(path)->id);
                         exit(EXIT_FAILURE);