[CRIU] test/zdtm: add -g option to generate binary only

Andrew Vagin avagin at parallels.com
Mon Aug 12 03:26:42 EDT 2013


On Fri, Aug 09, 2013 at 08:05:44AM -0700, Yicheng Qin wrote:
> From: Yicheng Qin <yichengq at google.com>
> Subject: [PATCH] test/zdtm: add -g option to generate binary only
> 
> Add -g option in zdtm.sh.
> 
> Using -g option can just generate binaries of all
> tests to run in zdtm. Moreover, appending test name after
> -g option can just generate the binary for the test.
> 
> Signed-off-by: Yicheng Qin <yichengq at google.com>
> ---
>  test/zdtm.sh | 29 +++++++++++++++++++++++++++--
>  1 file changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index f640cd7..9e72fa3 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -156,10 +156,11 @@ TMP_TREE=""
>  SCRIPTDIR=`dirname $CRIU`/test
>  POSTDUMP="--action-script $SCRIPTDIR/post-dump.sh"
>  
> -test -x $CRIU || {
> +# it doesn't need criu binary for compiling test programs
> +if [[ "$1" != "-g" && ! -x $CRIU ]]; then
>   echo "$CRIU is unavailable"

Yours patches are broken. All tab-s are replaced on space-s.

I recommend you to use git send-email. Here is instructions how to tune
it for using gmail smtp:
http://morefedora.blogspot.ru/2009/02/configuring-git-send-email-to-use-gmail.html

>   exit 1
> -}
> +fi
>  
>  ARGS=""
>  
> @@ -538,6 +539,19 @@ checkout()
>   make -C $TMP_TREE -j 32
>  }
>  
> +compile_test()
> +{
> + local test=$1
> +
> + test=${ZP}/${test#ns/}
> + local tname=`basename $test`
> + local tdir=`dirname $test`
> +
> + echo "Compile $test"
> +
> + make -C $tdir $tname || return 1
> +}
> +
>  cd `dirname $0` || exit 1
>  
>  while :; do
> @@ -621,6 +635,16 @@ if [ $# -eq 0 ]; then
>   done
>  elif [ "$1" = "-l" ]; then
>   echo $TEST_LIST $UTS_TEST_LIST $MNT_TEST_LIST $IPC_TEST_LIST | tr ' ' '\n'
> +elif [ "$1" = "-g" ]; then
> + shift
> + if [ $# -eq 0 ]; then
> + for t in $TEST_LIST $UTS_TEST_LIST \
> + $MNT_TEST_LIST $IPC_TEST_LIST; do
> + compile_test $t || case_error $t

I think we can use the main loop and integrate this logic in run_test().
The first benefit in this case is that an exclude pattern will works automaticaly (-g -x).

> + done
> + else
> + compile_test $1 || case_error $1
> + fi
>  elif [ "$1" = "-h" ]; then
>   cat >&2 <<EOF
>  This script is used for executing unit tests.
> @@ -637,6 +661,7 @@ Options:
>   -x <PATTERN>: Exclude pattern
>   -t : mount tmpfs for dump files
>   -a <FILE>.tar.gz : save archive with dump files and logs
> + -g : Generate executables only
>  EOF
>  elif [ "${1:0:1}" = '-' ]; then
>   echo "unrecognized option $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