From e7a52b1b33cf6bfb1ea6a471490997af3d15bf39 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 9 Feb 2024 12:40:29 +0100 Subject: [PATCH] test: adjust test-path to fail gracefully with the new pidfd_spawn stuff Since 2e106312e2 the test unit fails with 'resources' result instead of 'exit-code', which the test didn't account for when running unprivileged. Before 2e106312e2: $ /root/systemd/build/test-path Failed to start transient scope unit: Interactive authentication required. Couldn't allocate a scope unit for this test, proceeding without. ... -.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied -.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied ... line 151: path-exists.path: state = running; result = success (left: 29986250) line 151: path-exists.service: state = start; result = success path-exists.service: Main process exited, code=exited, status=219/CGROUP path-exists.service: Failed with result 'exit-code'. line 151: path-exists.path: state = running; result = success (left: 29985948) line 151: path-exists.service: state = failed; result = exit-code Failed to start service path-exists.service, aborting test: failed/exit-code After 2e106312e2: $ /root/systemd/build/test-path Failed to start transient scope unit: Interactive authentication required. Couldn't allocate a scope unit for this test, proceeding without. ... -.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied -.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied path-exists.service: Failed to spawn executor: No such file or directory path-exists.service: Failed to spawn 'start' task: No such file or directory path-exists.service: Failed with result 'resources'. --- src/test/test-path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/test-path.c b/src/test/test-path.c index 22ed88f7e71..e49653a2404 100644 --- a/src/test/test-path.c +++ b/src/test/test-path.c @@ -100,7 +100,8 @@ static int _check_states(unsigned line, service_state_to_string(service->state), service_result_to_string(service->result)); - if (service->state == SERVICE_FAILED && service->main_exec_status.status == EXIT_CGROUP) { + if (service->state == SERVICE_FAILED && + (service->main_exec_status.status == EXIT_CGROUP || service->result == SERVICE_FAILURE_RESOURCES)) { const char *ci = ci_environment(); /* On a general purpose system we may fail to start the service for reasons which are -- 2.47.3