[CRIU] [PATCH v2] test/zdtm: add option -n for batch test

Andrew Vagin avagin at parallels.com
Tue Aug 13 05:38:18 EDT 2013


On Tue, Aug 13, 2013 at 01:34:02AM -0700, Yicheng Qin wrote:
> In batch-test mode, the script skips failed individual tests
> instead of exiting. This ensures that all zdtm tests can be run
> in one pass, which provides better overview of test result.
> 
> Signed-off-by: Yicheng Qin <yichengq at google.com>
> ---
> Changelog since v1:
> - add option -n
> 
>  test/zdtm.sh | 34 +++++++++++++++++++++++++++++++---
>  1 file changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 8881b3a..2ca48f5 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -168,6 +168,7 @@ PAGE_SERVER=0
>  PS_PORT=12345
>  TCPDUMP_PID=
>  COMPILE_ONLY=0
> +BATCH_TEST=0
>  
>  check_criu()
>  {
> @@ -439,7 +440,11 @@ EOF
>  		# with some error code, or checkpoint is complete but return
>  		# code is non-zero because of post dump action.
>  		if [ "$retcode" -ne 0 ] && [[ "$retcode" -ne 32 || -z "$dump_only" ]]; then
> -			echo WARNING: $tname returned $retcode and left running for debug needs
> +			if [ $BATCH_TEST -eq 0 ]; then
> +				echo WARNING: $tname returned $retcode and left running for debug needs
> +			else
> +				echo WARNING: $tname failed and returned $retcode
> +			fi
>  			return 1
>  		fi
>  
> @@ -556,7 +561,15 @@ case_error()
>  
>  	echo "==================== ERROR OVER ===================="
>  )
> -	exit 1
> +	if [ $BATCH_TEST -eq 0 ]; then
> +		exit 1
> +	else
> +		# cleanout failed test to prepare for next one
> +		local tname=`basename $test`
> +		local tdir=`dirname $test`
> +		killall -9 $tname > /dev/null 2>&1
> +		make -C $tdir $tname.cleanout
> +	fi
>  }
>  
>  checkout()
> @@ -635,6 +648,11 @@ while :; do
>  		shift
>  		continue
>  	fi
> +	if [ "$1" = "-n" ]; then
> +		BATCH_TEST=1
> +		shift
> +		continue
> +	fi
>  	break;
>  done
>  
> @@ -661,6 +679,7 @@ Options:
>  	-t : mount tmpfs for dump files
>  	-a <FILE>.tar.gz : save archive with dump files and logs
>  	-g : Generate executables only
> +	-n : Batch test
>  EOF
>  elif [ "${1:0:1}" = '-' ]; then
>  	echo "unrecognized option $1"
> @@ -688,6 +707,15 @@ else
>  	for t in $(echo "$IPC_TEST_LIST" | grep -x "$pattern"); do
>  		run_test $t -n ipc || case_error $t
>  	done
> +
> +	if [ $COMPILE_ONLY -eq 0 ]; then
> +		if [ -n "$ZDTM_FAILED" ]; then

where is ZDTM_FAILED set?

> +			echo ZDTM tests FAIL.
> +		else
> +			echo ZDTM tests PASS.
> +		fi
> +	fi
>  fi
>  
> -[ -n "$TMP_TREE" ] && rm -rf $TMP_TREE || exit 0
> +[ -n "$TMP_TREE" ] && rm -rf $TMP_TREE
> +[ -n "$ZDTM_FAILED" ] && exit 1
> -- 
> 1.8.3
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list