From 71cde065b5492fc1324422710c4d84de51361020 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sun, 26 Jun 2022 20:52:12 +0200 Subject: [PATCH] test: make TEST-21-DFUZZER work in containers by avoiding fuzzing networkd and timesyncd when running in a container. --- test/units/testsuite-21.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test/units/testsuite-21.sh b/test/units/testsuite-21.sh index e9bf18603a..7158688362 100755 --- a/test/units/testsuite-21.sh +++ b/test/units/testsuite-21.sh @@ -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=(