From dbb011ecd9ffcd9e02ed92ca6c3e1ff051125bcf Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 2 Feb 2024 15:00:24 -0800 Subject: [PATCH] tests/int/helpers: fix cgroups_swap check for v2 In case of cgroup v2, there's no memory.swap.max in the top-level cgroup, so we have to use find. Signed-off-by: Kir Kolyshkin --- tests/integration/helpers.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/integration/helpers.bash b/tests/integration/helpers.bash index 4702d9714..8124abbd7 100755 --- a/tests/integration/helpers.bash +++ b/tests/integration/helpers.bash @@ -451,8 +451,14 @@ function requires() { ;; cgroups_swap) init_cgroup_paths - if [ -v CGROUP_V1 ] && [ ! -e "${CGROUP_MEMORY_BASE_PATH}/memory.memsw.limit_in_bytes" ]; then - skip_me=1 + if [ -v CGROUP_V1 ]; then + if [ ! -e "${CGROUP_MEMORY_BASE_PATH}/memory.memsw.limit_in_bytes" ]; then + skip_me=1 + fi + elif [ -v CGROUP_V2 ]; then + if [ -z "$(find "$CGROUP_BASE_PATH" -maxdepth 2 -type f -name memory.swap.max -print -quit)" ]; then + skip_me=1 + fi fi ;; cgroups_cpu_idle)