]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: make TEST-21-DFUZZER work in containers
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 26 Jun 2022 18:52:12 +0000 (20:52 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 26 Jun 2022 20:06:02 +0000 (22:06 +0200)
by avoiding fuzzing networkd and timesyncd when running in a container.

test/units/testsuite-21.sh

index e9bf18603a24c17c491f081af2226ba413c02078..7158688362327e298036d129c6c66b113bf53422 100755 (executable)
@@ -33,17 +33,31 @@ BUS_LIST=(
     org.freedesktop.locale1
     org.freedesktop.login1
     org.freedesktop.machine1
-    org.freedesktop.network1
     org.freedesktop.portable1
     org.freedesktop.resolve1
     org.freedesktop.systemd1
     org.freedesktop.timedate1
-    org.freedesktop.timesync1
 )
 
 # systemd-oomd requires PSI
 if tail -n +1 /proc/pressure/{cpu,io,memory}; then
-    BUS_LIST+=(org.freedesktop.oom1)
+    BUS_LIST+=(
+        org.freedesktop.oom1
+    )
+fi
+
+# Some services require specific conditions:
+#   - systemd-timesyncd can't run in a container
+#   - systemd-networkd can run in a container if it has CAP_NET_ADMIN capability
+if ! systemd-detect-virt --container; then
+    BUS_LIST+=(
+        org.freedesktop.network1
+        org.freedesktop.timesync1
+    )
+elif busctl introspect org.freedesktop.network1 / &>/dev/null; then
+    BUS_LIST+=(
+        org.freedesktop.network1
+    )
 fi
 
 SESSION_BUS_LIST=(