]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-55-OOMD: check global config earlier
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Oct 2024 05:52:49 +0000 (14:52 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Oct 2024 06:16:16 +0000 (15:16 +0900)
'Default Memory Pressure Duration' field in oomctl, which can be configured
with DefaultMemoryPressureDurationSec= in oomd.conf, is a global config.
Let's check it earlier.

This also drops unnecessary cleanup at the beginning.

test/units/TEST-55-OOMD.sh

index 4a7c7f78aecc9d5d9c5542c223d3c183b9b5fbd2..2b003c9f73d433333607e7d751d41cb933fb24aa 100755 (executable)
@@ -19,8 +19,6 @@ if [[ -s /skipped ]]; then
     exit 77
 fi
 
-rm -rf /run/systemd/system/TEST-55-OOMD-testbloat.service.d
-
 # Activate swap file if we are in a VM
 if systemd-detect-virt --vm --quiet; then
     swapoff --all
@@ -73,6 +71,9 @@ if systemctl is-active systemd-oomd.service; then
     systemctl restart systemd-oomd.service
 fi
 
+# Check if the oomd.conf drop-in config is loaded.
+assert_in 'Default Memory Pressure Duration: 2s' "$(oomctl)"
+
 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
@@ -99,7 +100,6 @@ systemctl start TEST-55-OOMD-testbloat.service
 timeout 1m bash -xec 'until oomctl | grep "/TEST-55-OOMD-workload.slice"; do sleep 1; done'
 oomctl | grep "/TEST-55-OOMD-workload.slice"
 oomctl | grep "20.00%"
-oomctl | grep "Default Memory Pressure Duration: 2s"
 
 systemctl status TEST-55-OOMD-testchill.service
 
@@ -128,7 +128,6 @@ systemctl start --machine "testuser@.host" --user TEST-55-OOMD-testbloat.service
 timeout 1m bash -xec 'until oomctl | grep "/TEST-55-OOMD-workload.slice"; do sleep 1; done'
 oomctl | grep -E "/user.slice.*/TEST-55-OOMD-workload.slice"
 oomctl | grep "20.00%"
-oomctl | grep "Default Memory Pressure Duration: 2s"
 
 systemctl --machine "testuser@.host" --user status TEST-55-OOMD-testchill.service