From 6b076bfa2cd8dba49c09e434101c4e424e173a48 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 15 Dec 2023 12:45:03 +0900 Subject: [PATCH] cgroups.bats: check cgroups_io_weight Signed-off-by: Akihiro Suda --- tests/integration/cgroups.bats | 2 +- tests/integration/helpers.bash | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/integration/cgroups.bats b/tests/integration/cgroups.bats index 790108ba0b4..a9c2ea4856f 100644 --- a/tests/integration/cgroups.bats +++ b/tests/integration/cgroups.bats @@ -132,7 +132,7 @@ function setup() { } @test "runc run (blkio weight)" { - requires cgroups_v2 + requires cgroups_v2 cgroups_io_weight [ $EUID -ne 0 ] && requires rootless_cgroup set_cgroups_path diff --git a/tests/integration/helpers.bash b/tests/integration/helpers.bash index e8a2894b915..0d63e10a37b 100755 --- a/tests/integration/helpers.bash +++ b/tests/integration/helpers.bash @@ -451,6 +451,22 @@ function requires() { skip_me=1 fi ;; + cgroups_io_weight) + local p f f2 + init_cgroup_paths + if [ -v CGROUP_V1 ]; then + p="$CGROUP_CPU_BASE_PATH" + f1="blkio.weight" + f2="blkio.bfq.weight" + elif [ -v CGROUP_V2 ]; then + p="$CGROUP_BASE_PATH" + f1="io.weight" + f2="io.bfq.weight" + fi + if [ -z "$(find "$p" -type f \( -name "$f1" -o -name "$f2" \) -print -quit)" ]; then + skip_me=1 + fi + ;; cgroupns) if [ ! -e "/proc/self/ns/cgroup" ]; then skip_me=1