[CRIU] test/zdtm: add -n option to run in-namespace tests only

Andrew Vagin avagin at parallels.com
Mon Aug 12 04:02:16 EDT 2013


On Fri, Aug 09, 2013 at 08:08:11AM -0700, Yicheng Qin wrote:
> From: Yicheng Qin <yichengq at google.com>
> Subject: [PATCH] test/zdtm: add -n option to run in-namespace tests only
> 
> Support -n option in zdtm, which means that only in-namespace tests
> will be run.

zdtm.sh [OPTIONS] [TEST NAME]
What do you think, if we change [TEST NAME] on [TEST PATTER]?

For example:
bash test/zdtm.sh 'ns/*'
This command runs in-namespace tests only

I would prefer this variant, because it's more functional.

Could you implement this functionality?

Thanks.

> 
> Signed-off-by: Yicheng Qin <yichengq at google.com>
> ---
>  test/zdtm.sh | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 5b064f7..6db2bf0 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -173,6 +173,7 @@ CLEANUP=0
>  PAGE_SERVER=0
>  PS_PORT=12345
>  TCPDUMP_PID=
> +NS_TEST_ONLY=0
>  
>  check_mainstream()
>  {
> @@ -358,6 +359,11 @@ run_test()
>   expr "$test" : 'ns/' > /dev/null && PIDNS=1 || PIDNS=""
>   test=${ZP}/${test#ns/}
>  
> + # option '-n' to skip tests without namespace
> + if [[ $NS_TEST_ONLY -eq 1 ]] && [[ "$PIDNS" == "" ]]; then
> + return
> + fi
> +
>   shift
>   local args=$*
>   local tname=`basename $test`
> @@ -629,6 +635,11 @@ while :; do
>   shift
>   continue;
>   fi
> + if [ "$1" = "-n" ]; then
> + shift
> + NS_TEST_ONLY=1
> + continue
> + fi
>   if [ "$1" = "-s" ]; then
>   SNAPSHOT=1
>   shift
> @@ -682,6 +693,7 @@ Options:
>   -t : mount tmpfs for dump files
>   -a <FILE>.tar.gz : save archive with dump files and logs
>   -g : Generate executables only
> + -n : Run tests in namespace 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