]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: skip test-path on Salsa CI
authorLuca Boccassi <bluca@debian.org>
Sat, 12 Aug 2023 14:15:55 +0000 (15:15 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 13 Aug 2023 09:27:04 +0000 (10:27 +0100)
Salsa is the Debian git forge. In the package build environment test-path
always fails as we cannot set up cgroups and so the path unit fails to
start. Skip the test in that environment.

Unfortunately meson doesn't allow to skip individual tests by name.

src/shared/tests.c
src/test/test-path.c

index ce72be1776ba1c8d448ee13cd3593baa910ebcbc..60e25426343f21cb0902e3cb44c4d38425f44299 100644 (file)
@@ -339,6 +339,8 @@ const char *ci_environment(void) {
                 return (ans = "github-actions");
         if (getenv("AUTOPKGTEST_ARTIFACTS") || getenv("AUTOPKGTEST_TMP"))
                 return (ans = "autopkgtest");
+        if (getenv("SALSA_CI_IMAGES"))
+                return (ans = "salsa-ci");
 
         FOREACH_STRING(var, "CI", "CONTINOUS_INTEGRATION") {
                 /* Those vars are booleans according to Semaphore and Travis docs:
index 92b6b6511495157594a4287de8133e3658ff145f..22ed88f7e716789166c1c6e94e7275373f18348d 100644 (file)
@@ -100,17 +100,24 @@ 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 &&
-                    !ci_environment())
+                if (service->state == SERVICE_FAILED && service->main_exec_status.status == EXIT_CGROUP) {
+                        const char *ci = ci_environment();
+
                         /* 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 developer machines we require proper setup. */
-                        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 (!ci)
+                                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));
+
+                        /* On Salsa we can't setup cgroups so the unit always fails. The test checks if it
+                         * can but continues if it cannot at the beginning, but on Salsa it fails here. */
+                        if (streq(ci, "salsa-ci"))
+                                exit(EXIT_TEST_SKIP);
+                }
 
                 if (n >= end) {
                         log_error("Test timeout when testing %s", UNIT(path)->id);