Skip to content

Commit dbb011e

Browse files
kolyshkinlifubang
authored andcommitted
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 <[email protected]>
1 parent 8626c71 commit dbb011e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/integration/helpers.bash

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,14 @@ function requires() {
451451
;;
452452
cgroups_swap)
453453
init_cgroup_paths
454-
if [ -v CGROUP_V1 ] && [ ! -e "${CGROUP_MEMORY_BASE_PATH}/memory.memsw.limit_in_bytes" ]; then
455-
skip_me=1
454+
if [ -v CGROUP_V1 ]; then
455+
if [ ! -e "${CGROUP_MEMORY_BASE_PATH}/memory.memsw.limit_in_bytes" ]; then
456+
skip_me=1
457+
fi
458+
elif [ -v CGROUP_V2 ]; then
459+
if [ -z "$(find "$CGROUP_BASE_PATH" -maxdepth 2 -type f -name memory.swap.max -print -quit)" ]; then
460+
skip_me=1
461+
fi
456462
fi
457463
;;
458464
cgroups_cpu_idle)

0 commit comments

Comments
 (0)