From: Yu Watanabe Date: Wed, 16 Oct 2024 06:12:32 +0000 (+0900) Subject: TEST-55-OOMD: check slice more in detail X-Git-Tag: v257-rc1~207^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=665882f8f3d9dee4dac84d244e253db956fd94ab;p=thirdparty%2Fsystemd.git TEST-55-OOMD: check slice more in detail system and user slice has same name, hence we need to check full path. --- diff --git a/test/units/TEST-55-OOMD.sh b/test/units/TEST-55-OOMD.sh index 43a9919165a..ac496430746 100755 --- a/test/units/TEST-55-OOMD.sh +++ b/test/units/TEST-55-OOMD.sh @@ -96,13 +96,16 @@ else fi test_basic() { + local cgroup_path="${1:?}" + shift + systemctl "$@" start TEST-55-OOMD-testchill.service systemctl "$@" start TEST-55-OOMD-testbloat.service # Verify systemd-oomd is monitoring the expected units. - 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%" + timeout 1m bash -xec "until oomctl | grep -q -F 'Path: $cgroup_path'; do sleep 1; done" + assert_in 'Memory Pressure Limit: 20.00%' \ + "$(oomctl | tac | sed -e '/Memory Pressure Monitored CGroups:/q' | tac | grep -A7 "Path: $cgroup_path")" systemctl "$@" status TEST-55-OOMD-testchill.service @@ -122,14 +125,15 @@ test_basic() { } testcase_basic_system() { - test_basic + test_basic /TEST.slice/TEST-55.slice/TEST-55-OOMD.slice/TEST-55-OOMD-workload.slice } testcase_basic_user() { # Make sure we also work correctly on user units. loginctl enable-linger testuser - test_basic --machine "testuser@.host" --user + test_basic "/user.slice/user-$(id -u testuser).slice/user@$(id -u testuser).service/TEST.slice/TEST-55.slice/TEST-55-OOMD.slice/TEST-55-OOMD-workload.slice" \ + --machine "testuser@.host" --user loginctl disable-linger testuser }