[LTP] [PATCH 2/4] controllers/memcg: Skip functional tests when mounted under cgroup2 hierarchy
Luke Nowakowski-Krijger
luke.nowakowskikrijger@canonical.com
Sat Nov 27 01:04:23 CET 2021
Skip all of the tests when the memory controller is mounted under the
cgroup2 hierarchy due to the tests mainly testing features related to
the cgroup1 memory controller interface.
Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
---
.../kernel/controllers/memcg/functional/memcg_lib.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index 1b76b6597..38e494ea6 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -104,6 +104,14 @@ memcg_setup()
tst_brk TCONF "Either kernel does not support Memory Resource Controller or feature not enabled"
fi
+ # Most of the tests here are testing specific parts of the cgroup v1 memory interface that is
+ # not present for cgroup2, so if it is already mounted on a cgroup2 hierarchy we should skip
+ # the test.
+ cgroup_mount_point=$(grep -w cgroup2 /proc/mounts | cut -f 2 | cut -d " " -f2)
+ if grep -q memory "$cgroup_mount_point"/cgroup.controllers; then
+ tst_brk TCONF "memory controller mounted on cgroup v2 hierarchy, skipping test."
+ fi
+
ROD mkdir /dev/memcg
ROD mount -t cgroup -omemory memcg /dev/memcg
--
2.32.0
More information about the ltp
mailing list