]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-55-OOMD: stop test units when unnecessary
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Oct 2024 06:18:41 +0000 (15:18 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 13 Nov 2024 19:48:10 +0000 (19:48 +0000)
Then, sleep becomes not necessary anymore. This greatly improve performance.

(cherry picked from commit 98a0bb8a6487a1bd0767223f3738525c2b3eae52)

test/units/TEST-55-OOMD.sh

index 43a9919165a04ce8f3af66251011f11ee1f5c495..f36d6ff48d63b3d61fafc683db73996fe6a8ab81 100755 (executable)
@@ -119,6 +119,11 @@ test_basic() {
     # testbloat should be killed and testchill should be fine
     if systemctl "$@" status TEST-55-OOMD-testbloat.service; then exit 42; fi
     if ! systemctl "$@" status TEST-55-OOMD-testchill.service; then exit 24; fi
+
+    systemctl "$@" kill --signal=KILL TEST-55-OOMD-testbloat.service || :
+    systemctl "$@" stop TEST-55-OOMD-testbloat.service
+    systemctl "$@" stop TEST-55-OOMD-testchill.service
+    systemctl "$@" stop TEST-55-OOMD-workload.slice
 }
 
 testcase_basic_system() {
@@ -141,8 +146,6 @@ testcase_preference_avoid() {
         return 0
     fi
 
-    sleep 120 # wait for systemd-oomd kill cool down and elevated memory pressure to come down
-
     mkdir -p /run/systemd/system/TEST-55-OOMD-testbloat.service.d/
     cat >/run/systemd/system/TEST-55-OOMD-testbloat.service.d/99-managed-oom-preference.conf <<EOF
 [Service]
@@ -166,6 +169,13 @@ EOF
     if ! systemctl status TEST-55-OOMD-testbloat.service; then exit 25; fi
     if systemctl status TEST-55-OOMD-testmunch.service; then exit 43; fi
     if ! systemctl status TEST-55-OOMD-testchill.service; then exit 24; fi
+
+    systemctl kill --signal=KILL TEST-55-OOMD-testbloat.service || :
+    systemctl kill --signal=KILL TEST-55-OOMD-testmunch.service || :
+    systemctl stop TEST-55-OOMD-testbloat.service
+    systemctl stop TEST-55-OOMD-testmunch.service
+    systemctl stop TEST-55-OOMD-testchill.service
+    systemctl stop TEST-55-OOMD-workload.slice
 }
 
 run_testcases