Commit f194124e authored by Pavel Tikhomirov's avatar Pavel Tikhomirov Committed by Andrei Vagin

zdtm: cleanup zdtmtst and zdtmtst.defaultroot cgroups after finishing test

After running criu test, docker on the node becomes unusable, as it is
confused by our leftover cgroups. Surely docker should be fixed to
ignore custom cgroups (https://github.com/moby/moby/issues/37601), but
we should not leave them after test also.

v2: rmdir the holder only if it exists, remove racy wait and remove
wrongly added cleanup method in class criu
v3: bring back missed semicolon
Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 07da7b0f
...@@ -569,6 +569,10 @@ class zdtm_test: ...@@ -569,6 +569,10 @@ class zdtm_test:
subprocess.check_call(["make", "-C", "zdtm/"]) subprocess.check_call(["make", "-C", "zdtm/"])
subprocess.check_call(["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups"]) subprocess.check_call(["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups"])
@staticmethod
def cleanup():
subprocess.check_call(["flock", "zdtm_mount_cgroups.lock", "./zdtm_umount_cgroups"])
class inhfd_test: class inhfd_test:
def __init__(self, name, desc, flavor, freezer): def __init__(self, name, desc, flavor, freezer):
...@@ -674,6 +678,10 @@ class inhfd_test: ...@@ -674,6 +678,10 @@ class inhfd_test:
def available(): def available():
pass pass
@staticmethod
def cleanup():
pass
class groups_test(zdtm_test): class groups_test(zdtm_test):
def __init__(self, name, desc, flavor, freezer): def __init__(self, name, desc, flavor, freezer):
...@@ -2200,3 +2208,6 @@ for tst in test_classes.values(): ...@@ -2200,3 +2208,6 @@ for tst in test_classes.values():
tst.available() tst.available()
opts['action'](opts) opts['action'](opts)
for tst in test_classes.values():
tst.cleanup()
#!/bin/sh
# Lets delete all test controllers after executing tests.
cat /proc/self/cgroup | grep -q zdtmtst.defaultroot || exit 0
tdir=`mktemp -d zdtm.XXXXXX`
for i in "zdtmtst" "zdtmtst.defaultroot"; do
mount -t cgroup -o none,name=$i zdtm $tdir || { rmdir $tdir; exit 1; }
# remove a fake group if exists
if [ -d "$tdir/holder" ]; then
rmdir $tdir/holder || { umount -l $tdir && rmdir $tdir; exit 1; }
fi
umount -l $tdir || exit 1;
done
rmdir $tdir
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment