mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
tests/int: fix "update rt period and runtime" for rootless
Since commitf09a3e1b8d, the value passed on to read starts with a slash, resulting in the first element of the array to be empty. As a result, the test tries to write to the top-level cgroup, which fails when rootless: > # Writing 1000000 to /sys/fs/cgroup/cpu,cpuacct//cpu.rt_period_us > # /tmp/bats-run-106184/bats.115768.src: line 548: /sys/fs/cgroup/cpu,cpuacct//cpu.rt_period_us: Permission denied To fix, remove the leading slash. An alternative fix would be to do "for ((i = 1;" instead of "i = 0", but that seems less readable. Fixes:f09a3e1b8dSigned-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit86af524866) Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
committed by
Akihiro Suda
parent
76c047f1b1
commit
257018e76c
@@ -537,7 +537,7 @@ EOF
|
||||
root_period=$(cat "${CGROUP_CPU_BASE_PATH}/cpu.rt_period_us")
|
||||
root_runtime=$(cat "${CGROUP_CPU_BASE_PATH}/cpu.rt_runtime_us")
|
||||
# the following IFS magic sets dirs=("runc-cgroups-integration-test" "test-cgroup")
|
||||
IFS='/' read -r -a dirs <<<"$REL_CGROUPS_PATH"
|
||||
IFS='/' read -r -a dirs <<<"${REL_CGROUPS_PATH#/}"
|
||||
for ((i = 0; i < ${#dirs[@]}; i++)); do
|
||||
local target="$CGROUP_CPU_BASE_PATH"
|
||||
for ((j = 0; j <= i; j++)); do
|
||||
|
||||
Reference in New Issue
Block a user