diff --git a/test/units/testsuite-55.sh b/test/units/testsuite-55.sh index afd3053e4d..2b1383ecad 100755 --- a/test/units/testsuite-55.sh +++ b/test/units/testsuite-55.sh @@ -13,15 +13,9 @@ test "$(cat /sys/fs/cgroup/init.scope/memory.high)" != "max" # Loose checks to ensure the environment has the necessary features for systemd-oomd [[ -e /proc/pressure ]] || echo "no PSI" >>/skipped -cgroup_type="$(stat -fc %T /sys/fs/cgroup/)" -if [[ "$cgroup_type" != *"cgroup2"* ]] && [[ "$cgroup_type" != *"0x63677270"* ]]; then - echo "no cgroup2" >>/skipped -fi -if [ ! -f /usr/lib/systemd/systemd-oomd ] && [ ! -f /lib/systemd/systemd-oomd ]; then - echo "no oomd" >>/skipped -fi - -if [[ -e /skipped ]]; then +[[ "$(get_cgroup_hierarchy)" == "unified" ]] || echo "no cgroupsv2" >>/skipped +[[ -x /usr/lib/systemd/systemd-oomd ]] || echo "no oomd" >>/skipped +if [[ -s /skipped ]]; then exit 0 fi @@ -71,9 +65,22 @@ if systemctl is-active systemd-oomd.service; then systemctl restart systemd-oomd.service fi -# Ensure that we can start services even with a very low hard memory cap without oom-kills, but skip under -# sanitizers as they balloon memory usage. -if ! [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then +if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then + # If we're running with sanitizers, sd-executor might pull in quite a significant chunk of shared + # libraries, which in turn causes a lot of pressure that can put us in the front when sd-oomd decides to + # go on a killing spree. This fact is exacerbated further on Arch Linux which ships unstripped gcc-libs, + # so sd-executor pulls in over 30M of libs on startup. Let's make the MemoryHigh= limit a bit more + # generous when running with sanitizers to make the test happy. + systemctl edit --runtime --stdin --drop-in=99-MemoryHigh.conf testsuite-55-testchill.service <