diff --git a/test/units/TEST-21-DFUZZER.sh b/test/units/TEST-21-DFUZZER.sh index cc02956ac3..6a0288001b 100755 --- a/test/units/TEST-21-DFUZZER.sh +++ b/test/units/TEST-21-DFUZZER.sh @@ -126,37 +126,51 @@ cat /etc/dfuzzer.conf # TODO # * check for possibly newly introduced buses? -BUS_LIST=( - org.freedesktop.home1 - org.freedesktop.hostname1 - org.freedesktop.import1 - org.freedesktop.locale1 - org.freedesktop.login1 - org.freedesktop.machine1 - org.freedesktop.portable1 - org.freedesktop.resolve1 - org.freedesktop.timedate1 +NAME_LIST=( + home + hostname + import + locale + login + machine + portable + resolve + timedate ) -# systemd-oomd requires PSI -if tail -n +1 /proc/pressure/{cpu,io,memory}; then - BUS_LIST+=( - org.freedesktop.oom1 - ) -fi - # Some services require specific conditions: +# - systemd-oomd requires PSI # - systemd-timesyncd can't run in a container # - systemd-networkd can run in a container if it has CAP_NET_ADMIN capability +if tail -n +1 /proc/pressure/{cpu,io,memory}; then + NAME_LIST+=( oom ) +fi + 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 - ) + NAME_LIST+=( timesync ) +fi + +if ip link add dummy-fuzz type dummy; then + # if a dummy interface is created, then let's also setup it for resolved + ip link set dummy-fuzz up + ip address add 192.0.2.1/24 dev dummy-fuzz + + # When we can create a dummy interface, we definitely have CAP_NET_ADMIN + NAME_LIST+=( network ) + + # Create unit files for another dummy interface for networkd + mkdir -p /run/systemd/network + cat >/run/systemd/network/10-dummy-fuzz2.netdev </run/systemd/network/10-dummy-fuzz2.network <