]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Ensure delegation test unit has memory controller
authorMichal Koutný <mkoutny@suse.com>
Thu, 23 May 2024 16:01:24 +0000 (18:01 +0200)
committerMichal Koutný <mkoutny@suse.com>
Thu, 23 May 2024 16:05:25 +0000 (18:05 +0200)
When the test used to be run on distro that doesn't enable memory
accounting by default (such as openSUSE TW), there is no guarantee that
testing unit has memory.* cgroup attributes and delegation test would
fail if they are missing.

Require memory controller explicitly inside the unit so that test can
work in any environment.

test/units/TEST-19-CGROUP.delegate.sh

index 74d36c405dabc0ae72f61e343fcb723f1b3b76b3..022515fc8cc9af2ae0a27001737b0905e4f123e7 100755 (executable)
@@ -32,6 +32,7 @@ for attr in cgroup.threads memory.oom.group memory.reclaim ; do
     if grep -q "$attr" /sys/kernel/cgroup/delegate ; then
         systemd-run --wait \
                     --unit=test-0.service \
+                    --property="MemoryAccounting=1" \
                     --property="DynamicUser=1" \
                     --property="Delegate=" \
                     test -w /sys/fs/cgroup/system.slice/test-0.service/ -a \