From c8d8fd5b5ce1d625102898991b0d390acaebd7c0 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 22 Jul 2021 17:08:29 -0700 Subject: [PATCH] tests/rootless.sh: fixup for "update rt" test Without this, the test case fails with > Writing 1000000 to /sys/fs/cgroup/cpu,cpuacct/runc-cgroups-integration-test/cpu.rt_period_us > /tmp/bats-run-106836/bats.116418.src: line 548: /sys/fs/cgroup/cpu,cpuacct/runc-cgroups-integration-test/cpu.rt_period_us: Permission denied Since we do not currently have a setup to test this, this went unnoticed (can be seen in RHEL8 though). Signed-off-by: Kir Kolyshkin Signed-off-by: Adrian Reber (cherry picked from commit d44801648677b4eec070a2ccdb65f3e7819d5172) Signed-off-by: Akihiro Suda --- tests/rootless.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/rootless.sh b/tests/rootless.sh index bacea49d6..1bed7eb89 100755 --- a/tests/rootless.sh +++ b/tests/rootless.sh @@ -114,6 +114,15 @@ function enable_cgroup() { # necessary, and might actually be a bug in our impl of cgroup # handling. [[ "$cg" == "cpuset" ]] && chown rootless:rootless "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpuset."{cpus,mems} + # The following is required by "update rt period and runtime". + if [[ "$cg" == "cpu" ]]; then + if [[ -e "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_period_us" ]]; then + chown rootless:rootless "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_period_us" + fi + if [[ -e "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_runtime_us" ]]; then + chown rootless:rootless "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_runtime_us" + fi + fi done # cgroup v2 if [[ -e "$CGROUP_MOUNT/cgroup.controllers" ]]; then