diff --git a/test/Makefile b/test/Makefile index 2c15039cd..368769286 100644 --- a/test/Makefile +++ b/test/Makefile @@ -42,7 +42,10 @@ clean: $(Q) $(MAKE) -C libcriu clean $(Q) $(MAKE) -C rpc clean -$(TST): zdtm_ct +mount_cgroups: .FORCE + flock zdtm_mount_cgroups ./zdtm_mount_cgroups + +$(TST): zdtm_ct mount_cgroups .FORCE ./zdtm.sh --ct ${ZDTM_ARGS} $(@) &> $(subst /,_,$@).log || \ { flock Makefile cat $(subst /,_,$@).log; exit 1; } .PHONY: zdtm_ns diff --git a/test/zdtm.sh b/test/zdtm.sh index f84b64b28..b5133c3bf 100755 --- a/test/zdtm.sh +++ b/test/zdtm.sh @@ -318,23 +318,6 @@ exit_callback() } trap exit_callback EXIT -# If a controller is mounted during dumping processes, criu may fail with error: -# Error (cgroup.c:768): cg: Set 3 is not subset of 2 -# so lets mount all test controllers before executing tests. -mount_cgroups() -{ - cat /proc/self/cgroup | grep zdtmtst.defaultroot && return - local tdir - tdir=`mktemp -d zdtm.XXXXXX` - for i in "zdtmtst" "zdtmtst.defaultroot"; do - mount -t cgroup -o none,name=$i zdtm $tdir && - # a fake group prevents destroying of a controller - mkdir $tdir/holder && - umount $tdir || return 1 - done - rmdir $tdir -} - construct_root() { local root=$1 @@ -923,7 +906,6 @@ while :; do # mntns is used to mount /proc # net is used to avoid conflicts of parasite sockets make zdtm_ct && - mount_cgroups && ./zdtm_ct ./zdtm.sh "$@" exit } diff --git a/test/zdtm_mount_cgroups b/test/zdtm_mount_cgroups new file mode 100755 index 000000000..6a1982fb6 --- /dev/null +++ b/test/zdtm_mount_cgroups @@ -0,0 +1,16 @@ +#!/bin/sh + +# If a controller is created during dumping processes, criu may fail with error: +# Error (cgroup.c:768): cg: Set 3 is not subset of 2 +# so lets create all test controllers before executing tests. + +cat /proc/self/cgroup | grep zdtmtst.defaultroot && exit + +tdir=`mktemp -d zdtm.XXXXXX` +for i in "zdtmtst" "zdtmtst.defaultroot"; do + mount -t cgroup -o none,name=$i zdtm $tdir && + # a fake group prevents destroying of a controller + mkdir $tdir/holder && + umount $tdir || exit 1 +done +rmdir $tdir