[CRIU] [PATCH 2/2] tests: add a test for --cgroup-root

Andrew Vagin avagin at parallels.com
Mon Aug 25 07:19:46 PDT 2014


On Fri, Aug 15, 2014 at 05:02:22PM -0500, Tycho Andersen wrote:
> diff --git a/test/zdtm/live/static/cgroup02.hook b/test/zdtm/live/static/cgroup02.hook
> new file mode 100755
> index 0000000..c99f4ea
> --- /dev/null
> +++ b/test/zdtm/live/static/cgroup02.hook
> @@ -0,0 +1,27 @@
> +#!/bin/bash
> +
> +set -e
> +
> +rmroots() {
> +	echo "Cleaning $tname"
> +
> +	set +e

Tycho, could you explain why do we need "set +e" here? Can we
remove it, if we will check existance of a directory?

test -d "$tname/oldroot" && rmdir "$tname/oldroot"

> +	rmdir "$tname/oldroot"
> +	rmdir "$tname/newroot"

And here is one more problem. the newroot directory is created for all
controllers, but currently test cleans up it only for the zdtmtst
controller. We need to find a way to clean up all other conntrollers.
Tests are executed on a node, which is rebooted only for updating
kernel, so if we will not clean up all other controllers, we can eat all
memory.

Thanks, Andrew.

> +	rmdir "$tname/zdtmtstroot"
> +	set -e
> +
> +	echo "Left there is:"
> +	ls "$tname"
> +	umount "$tname"
> +	rmdir "$tname"
> +}
> +
> +tname=$(mktemp -d cgclean.XXXXXX)
> +mount -t cgroup none $tname -o "none,name=zdtmtst"
> +rmroots
> +
> +tname=$(mktemp -d cgclean.XXXXXX)
> +mount -t cgroup none $tname -o "none,name=defaultroot"
> +rmroots
> +
> diff --git a/test/zdtm/live/static/cgroup02.opts b/test/zdtm/live/static/cgroup02.opts
> new file mode 100644
> index 0000000..159938e
> --- /dev/null
> +++ b/test/zdtm/live/static/cgroup02.opts
> @@ -0,0 +1 @@
> +--manage-cgroups --cgroup-root /newroot --cgroup-root name=zdtmtst:/zdtmtstroot
> -- 
> 1.9.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list