Skip to content

Commit

Permalink
tests/int/helpers: fix cgroups_swap check for v2
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kolyshkin committed Feb 2, 2024
1 parent 7e43636 commit d6351bf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/integration/helpers.bash
Expand Up @@ -423,8 +423,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)
Expand Down

0 comments on commit d6351bf

Please sign in to comment.