From a78e21b5001dbe0d2cc6de630fc3e0d62b023ca5 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 28 May 2020 11:45:14 -0700 Subject: [PATCH] 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 --- tests/integration/delete.bats | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/integration/delete.bats b/tests/integration/delete.bats index 44a76fc9..9c80909d 100644 --- a/tests/integration/delete.bats +++ b/tests/integration/delete.bats @@ -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 < 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