[CRIU] [PATCH] zdtm.sh: add ability to test pre-dump (v2)

Andrew Vagin avagin at parallels.com
Thu Jan 16 05:05:21 PST 2014


On Thu, Jan 16, 2014 at 04:07:18PM +0400, Andrey Vagin wrote:
> ./test/zdtm.sh -s -i 2 -P ns/static/env00

-s and -P can't be used together, so the right command is:
./test/zdtm.sh -i 2 -P ns/static/env00

> 
> v2: make the help message a bit more detailed
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  test/zdtm.sh | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 695c3fc..8ccdabb 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -454,6 +454,7 @@ EOF
>  	for i in `seq $ITERATIONS`; do
>  		local dump_only=
>  		local postdump=
> +		local dump_cmd="dump"
>  		ddump=`readlink -fm dump/$tname/$PID/$i`
>  		DUMP_PATH=$ddump
>  		echo Dump $PID
> @@ -476,6 +477,7 @@ EOF
>  			if [ "$i" -ne "$ITERATIONS" ]; then
>  				snapopt="$snapopt -R --track-mem"
>  				dump_only=1
> +				[ -n "$PRE_DUMP" ] && dump_cmd="pre-dump"
>  			fi
>  			[ -n "$snappdir" ] && snapopt="$snapopt --prev-images-dir=$snappdir"
>  		fi
> @@ -486,7 +488,7 @@ EOF
>  
>  		save_fds $PID  $ddump/dump.fd
>  		save_maps $PID  $ddump/dump.maps
> -		setsid $CRIU_CPT dump $opts --file-locks --tcp-established $linkremap \
> +		setsid $CRIU_CPT $dump_cmd $opts --file-locks --tcp-established $linkremap \
>  			-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt $postdump
>  		retcode=$?
>  
> @@ -672,6 +674,8 @@ Options:
>  	-n : Batch test
>  	-r : Run test with specified name directly without match or check
>  	-v : Verbose mode
> +	-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.
>  EOF
>  }
>  
> @@ -730,6 +734,19 @@ while :; do
>  		shift
>  		;;
>  	  -s)
> +		if [ -n "$PRE_DUMP" ]; then
> +			echo "-P and -s can not be used together"
> +			exit 1
> +		fi
> +		SNAPSHOT=1
> +		shift
> +		;;
> +	  -P)
> +		if [ -n "$SNAPSHOT" ]; then
> +			echo "-P and -s can not be used together"
> +			exit 1
> +		fi
> +		PRE_DUMP=1
>  		SNAPSHOT=1
>  		shift
>  		;;
> -- 
> 1.8.3.1
> 


More information about the CRIU mailing list