]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: fix test-loopback failure when lacking privileges
authorLuca Boccassi <bluca@debian.org>
Sun, 3 Mar 2024 18:15:26 +0000 (18:15 +0000)
committerLuca Boccassi <bluca@debian.org>
Mon, 4 Mar 2024 16:28:10 +0000 (16:28 +0000)
Setting up the loopback might fail due to lack of privileges, as it
happens when running unit tests in the Noble CI environment. Skip
the test when it happens.

1584s  862/1330 systemd:test / test-loopback   FAIL  0.01s   exit status 1
1584s /* test_loopback_setup */
1584s Failed to configure loopback network device, ignoring: Operation not permitted
1584s loopback: Operation not permitted

src/test/test-loopback.c

index 48869ae337def2fe0d0ebc2be139a2cf08384fb6..db6ee0f32dd0a906d3b6f63620cac0d8ae06bafa 100644 (file)
@@ -19,6 +19,8 @@ TEST_RET(loopback_setup) {
         }
 
         r = loopback_setup();
+        if (ERRNO_IS_NEG_PRIVILEGE(r))
+                return log_tests_skipped("lacking privileges");
         if (r < 0)
                 return log_error_errno(r, "loopback: %m");