From: Frantisek Sumsal Date: Fri, 9 Feb 2024 11:40:29 +0000 (+0100) Subject: test: adjust test-path to fail gracefully with the new pidfd_spawn stuff X-Git-Tag: v256-rc1~919^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F31224%2Fhead;p=thirdparty%2Fsystemd.git 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'. --- 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