d0811f
From a2deeaeaa90d493ef8a2b20656745cd0531a1b30 Mon Sep 17 00:00:00 2001
d0811f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
d0811f
Date: Fri, 31 Jul 2020 10:36:57 +0200
d0811f
Subject: [PATCH 2/2] test-path: do not fail the test if we fail to start some
d0811f
 service
d0811f
d0811f
The test was failing because it couldn't start the service:
d0811f
d0811f
path-modified.service: state = failed; result = exit-code
d0811f
path-modified.path: state = waiting; result = success
d0811f
path-modified.service: state = failed; result = exit-code
d0811f
path-modified.path: state = waiting; result = success
d0811f
path-modified.service: state = failed; result = exit-code
d0811f
path-modified.path: state = waiting; result = success
d0811f
path-modified.service: state = failed; result = exit-code
d0811f
path-modified.path: state = waiting; result = success
d0811f
path-modified.service: state = failed; result = exit-code
d0811f
path-modified.path: state = waiting; result = success
d0811f
path-modified.service: state = failed; result = exit-code
d0811f
Failed to connect to system bus: No such file or directory
d0811f
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
d0811f
path-modified.service: Failed to create cgroup /system.slice/kojid.service/path-modified.service: Permission denied
d0811f
path-modified.service: Failed to attach to cgroup /system.slice/kojid.service/path-modified.service: No such file or directory
d0811f
path-modified.service: Failed at step CGROUP spawning /bin/true: No such file or directory
d0811f
path-modified.service: Main process exited, code=exited, status=219/CGROUP
d0811f
path-modified.service: Failed with result 'exit-code'.
d0811f
Test timeout when testing path-modified.path
d0811f
d0811f
Let's just ignore the failure here. Services can occasionally fail to start,
d0811f
there's not much we can do in that case.
d0811f
---
d0811f
 src/test/test-path.c | 8 ++++++++
d0811f
 1 file changed, 8 insertions(+)
d0811f
d0811f
diff --git a/src/test/test-path.c b/src/test/test-path.c
d0811f
index 63b709c8da..6c0db53f10 100644
d0811f
--- a/src/test/test-path.c
d0811f
+++ b/src/test/test-path.c
d0811f
@@ -98,6 +98,14 @@ static void check_states(Manager *m, Path *path, Service *service, PathState pat
d0811f
                                 service_state_to_string(service->state),
d0811f
                                 service_result_to_string(service->result));
d0811f
 
d0811f
+                if (service->state == SERVICE_FAILED) {
d0811f
+                        log_warning("Failed to start service %s, ignoring: %s/%s",
d0811f
+                                    UNIT(service)->id,
d0811f
+                                    service_state_to_string(service->state),
d0811f
+                                    service_result_to_string(service->result));
d0811f
+                        break;
d0811f
+                }
d0811f
+
d0811f
                 if (now(CLOCK_MONOTONIC) >= end) {
d0811f
                         log_error("Test timeout when testing %s", UNIT(path)->id);
d0811f
                         exit(EXIT_FAILURE);