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 <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2024-02-02 15:00:24 -08:00
committed by lfbzhm
parent 8626c7173e
commit dbb011ecd9
+8 -2
View File
@@ -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)