]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-55-OOMD: improve ephemeral configuration readability 28063/head
authorLuca Boccassi <bluca@debian.org>
Fri, 16 Jun 2023 23:06:38 +0000 (00:06 +0100)
committerLuca Boccassi <bluca@debian.org>
Fri, 16 Jun 2023 23:08:09 +0000 (00:08 +0100)
test/units/testsuite-55.sh

index 4503553eac2fa7a970d44a17b46bb08225930725..1433e79c5b9b0b9ce2ea7de1294ada5d2fa83e28 100755 (executable)
@@ -26,14 +26,29 @@ rm -rf /run/systemd/system/testsuite-55-testbloat.service.d
 
 # Configure oomd explicitly to avoid conflicts with distro dropins
 mkdir -p /run/systemd/oomd.conf.d/
-echo -e "[OOM]\nDefaultMemoryPressureDurationSec=2s" >/run/systemd/oomd.conf.d/99-oomd-test.conf
+cat >/run/systemd/oomd.conf.d/99-oomd-test.conf <<EOF
+[OOM]
+DefaultMemoryPressureDurationSec=2s
+EOF
+
 mkdir -p /run/systemd/system/-.slice.d/
-echo -e "[Slice]\nManagedOOMSwap=auto" >/run/systemd/system/-.slice.d/99-oomd-test.conf
+cat >/run/systemd/system/-.slice.d/99-oomd-test.conf <<EOF
+[Slice]
+ManagedOOMSwap=auto
+EOF
+
 mkdir -p /run/systemd/system/user@.service.d/
-echo -e "[Service]\nManagedOOMMemoryPressure=auto\nManagedOOMMemoryPressureLimit=0%" >/run/systemd/system/user@.service.d/99-oomd-test.conf
+cat >/run/systemd/system/user@.service.d/99-oomd-test.conf <<EOF
+[Service]
+ManagedOOMMemoryPressure=auto
+ManagedOOMMemoryPressureLimit=0%
+EOF
 
 mkdir -p /run/systemd/system/systemd-oomd.service.d/
-echo -e "[Service]\nEnvironment=SYSTEMD_LOG_LEVEL=debug" >/run/systemd/system/systemd-oomd.service.d/debug.conf
+cat >/run/systemd/system/systemd-oomd.service.d/debug.conf <<EOF
+[Service]
+Environment=SYSTEMD_LOG_LEVEL=debug
+EOF
 
 systemctl daemon-reload
 
@@ -123,8 +138,10 @@ if setfattr -n user.xattr_test -v 1 /sys/fs/cgroup/; then
     sleep 120 # wait for systemd-oomd kill cool down and elevated memory pressure to come down
 
     mkdir -p /run/systemd/system/testsuite-55-testbloat.service.d/
-    echo "[Service]" >/run/systemd/system/testsuite-55-testbloat.service.d/override.conf
-    echo "ManagedOOMPreference=avoid" >>/run/systemd/system/testsuite-55-testbloat.service.d/override.conf
+    cat >/run/systemd/system/testsuite-55-testbloat.service.d/override.conf <<EOF
+[Service]
+ManagedOOMPreference=avoid
+EOF
 
     systemctl daemon-reload
     systemctl start testsuite-55-testchill.service