tests/int/delete.bats: fixups

1. __runc does not set $status, so the check is misleading.

2. Add set +eux to the nest.sh script so we can error out early, and see
   what is going on.

3. Doing "echo +io" > cgroup.controllers is giving an error on my
   machine ("sh: write error: Operation not supported"). It is probably
   fine to just enable pids controller.

4. Add status check for runc exec nest.sh

5. Remove the second check for cgroup.threads contents -- it was already
   checked earlier (the output of nest.sh script).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-05-28 11:45:14 -07:00
parent 0ac92aab3f
commit a78e21b500
1 changed files with 4 additions and 7 deletions

View File

@ -71,7 +71,6 @@ function teardown() {
# create a sub process
__runc exec -d test_busybox sleep 1d
[ "$status" -eq 0 ]
# find the pid of sleep
pid=$(__runc exec test_busybox ps -a | grep 1d | awk '{print $1}')
@ -79,8 +78,9 @@ function teardown() {
# create subcgroups
cat <<EOF > nest.sh
set -e -u -x
cd /sys/fs/cgroup
for f in \$(cat cgroup.controllers); do echo +\$f > cgroup.subtree_control; done
echo +pids > cgroup.subtree_control
mkdir foo
cd foo
echo threaded > cgroup.type
@ -88,15 +88,12 @@ function teardown() {
cat cgroup.threads
EOF
cat nest.sh | runc exec test_busybox sh
[[ ${output} =~ [0-9]+ ]]
[ "$status" -eq 0 ]
[[ "$output" =~ [0-9]+ ]]
# check create subcgroups success
[ -d $CGROUP_PATH/foo ]
# check cgroup.threads' value
runc exec test_busybox cat /sys/fs/cgroup/foo/cgroup.threads
[[ ${output} =~ [0-9]+ ]]
# force delete test_busybox
runc delete --force test_busybox