mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
tests/int/cgroups: use heredoc to break a long line
This is mostly to improve readability. While at it, make the script more
robust by adding -e option to shell. The exception is echo $pid which is
opportunistic and may fail depending on the order of pids in the file.
Also, remove the empty comment and a shellcheck annotation.
Fixes: c91fe9ae
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -113,11 +113,15 @@ function setup() {
|
||||
[[ ${lines[0]} = "0::/foo" ]]
|
||||
|
||||
# teardown: remove "/foo"
|
||||
# shellcheck disable=SC2016
|
||||
runc exec test_cgroups_group sh -uxc 'echo -memory > /sys/fs/cgroup/cgroup.subtree_control; for f in $(cat /sys/fs/cgroup/foo/cgroup.procs); do echo $f > /sys/fs/cgroup/cgroup.procs; done; rmdir /sys/fs/cgroup/foo'
|
||||
cat <<'EOF' | runc exec test_cgroups_group sh -eux
|
||||
echo -memory > /sys/fs/cgroup/cgroup.subtree_control
|
||||
for pid in $(cat /sys/fs/cgroup/foo/cgroup.procs); do
|
||||
echo $pid > /sys/fs/cgroup/cgroup.procs || true
|
||||
done
|
||||
rmdir /sys/fs/cgroup/foo
|
||||
EOF
|
||||
runc exec test_cgroups_group test ! -d /sys/fs/cgroup/foo
|
||||
[ "$status" -eq 0 ]
|
||||
#
|
||||
}
|
||||
|
||||
@test "runc run (cgroup v1 + unified resources should fail)" {
|
||||
|
||||
Reference in New Issue
Block a user