]> 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)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Oct 2024 06:18:41 +0000 (15:18 +0900)
Then, sleep becomes not necessary anymore. This greatly improve performance.

test/units/TEST-55-OOMD.sh

index ac496430746a9375b71d13377183941ab57fb738..84f4283fbfccae995239bb7a20427234e82da9a2 100755 (executable)
@@ -122,6 +122,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() {
@@ -145,8 +150,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]
@@ -170,6 +173,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