[CRIU] [PATCH] zdtm: add ability to execute non-namespacess tests concurrently

Ruslan Kuprieiev kupruser at gmail.com
Wed Aug 13 04:19:01 PDT 2014


08.08.2014 21:31, Andrey Vagin пишет:
> For that zdtm.sh is executed in pidns to avoid pid conflicts.
>
> Cc: Christopher Covington <cov at codeaurora.org>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>   test/Makefile | 10 +++++-----
>   test/zdtm.sh  | 21 +++++++++++++++++++++
>   2 files changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/test/Makefile b/test/Makefile
> index 351b37b..5d04805 100644
> --- a/test/Makefile
> +++ b/test/Makefile
> @@ -16,11 +16,9 @@ other: .FORCE
>   		$(MAKE) -C $$t run || break;	\
>   	done					\
>   
> -zdtm: .FORCE
> +zdtm: .FORCE
>   	$(MAKE) zdtm_ns
> -	for t in $(shell echo "$(TST)" | tr ' ' '\n' | grep -Pv $(EXP)); do \
> -		$(MAKE) $$t || break;	\
> -	done
> +	$(MAKE) zdtm_nons
>   .PHONY: zdtm
>   
>   fault-injection: .FORCE
> @@ -28,7 +26,9 @@ fault-injection: .FORCE
>   .PHONY: fault-injection
>   
>   zdtm_ns: $(shell echo "$(TST)" | tr ' ' '\n' | grep -P $(EXP))
> +zdtm_nons: $(shell echo "$(TST)" | tr ' ' '\n' | grep -vP $(EXP))
> +
>   $(TST):
> -	./zdtm.sh ${ZDTM_ARGS} $(@) &> $(subst /,_,$@).log || \
> +	./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 d1a710d..b6c8095 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -762,6 +762,7 @@ Options:
>   	-P : Make pre-dump instead of dump on all iterations except the last one
>   	-s : Make iterative snapshots. Only the last one will be checked.
>   	--auto-dedup : Make auto-dedup on restore. Check sizes of pages imges, it must be zero.
> +	--ct : re-execute $0 in a container
>   EOF
>   }
>   
> @@ -868,6 +869,26 @@ while :; do
>   		usage
>   		exit 0
>   		;;
> +	  --ct)
> +		[ -z "$ZDTM_SH_IN_CT" ] && {
> +			export ZDTM_SH_IN_CT=1
> +			shift
> +			args="$@"
> +			# pidns is used to avoid conflicts
> +			# mntns is used to mount /proc
> +			# net is used to avoid conflicts of parasite sockets
> +			unshare --pid --mount --ipc --net -- bash -c "
> +

On ubuntu server 14.04 "make test" leads to error "unshare: unrecognized 
option '--pid'".

> 				(
> +					ip link set up dev lo &&
> +					mount --make-rprivate / &&
> +					umount -l /proc &&
> +					mount -t proc proc /proc/ &&
> +					./zdtm.sh $args
> +				)"
> +			exit
> +		}
> +		shift
> +		;;
>   	  -*)
>   		echo "Unrecognized option $1, aborting!" 1>&2
>   		usage



More information about the CRIU mailing list