[CRIU] [PATCH v2] test/zdtm: use TEST_PATTERN as argument
Andrew Vagin
avagin at parallels.com
Tue Aug 13 05:35:10 EDT 2013
On Tue, Aug 13, 2013 at 01:48:37AM -0700, Yicheng Qin wrote:
> Use TEST_PATTERN instead of TEST_NAME as argument.
> All previous zdtm commands can be used still.
> It is useful to run certain part of tests.
>
> Example of running in-namespace tests only:
> ./test/zdtm.sh ^ns/.*
>
Acked-by: Andrew Vagin <avagin at parallels.com>
> Signed-off-by: Yicheng Qin <yichengq at google.com>
> ---
> Changelog since v1:
> - delete wrong local attr on variable
>
> test/zdtm.sh | 49 ++++++++++++++++++++++---------------------------
> 1 file changed, 22 insertions(+), 27 deletions(-)
>
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index b370a9e..7334ab1 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -642,32 +642,14 @@ if [ $COMPILE_ONLY -eq 0 ]; then
> check_criu || exit 1
> fi
>
> -if [ $# -eq 0 ]; then
> -
> - if [ $COMPILE_ONLY -eq 0 ]; then
> - check_mainstream || exit 1
> - fi
> -
> - for t in $TEST_LIST; do
> - run_test $t || case_error $t
> - done
> - for t in $UTS_TEST_LIST; do
> - run_test $t -n uts || case_error $t
> - done
> - for t in $MNT_TEST_LIST; do
> - run_test $t -n mnt || case_error $t
> - done
> - for t in $IPC_TEST_LIST; do
> - run_test $t -n ipc || case_error $t
> - done
> -elif [ "$1" = "-l" ]; then
> +if [ "$1" = "-l" ]; then
> echo $TEST_LIST $UTS_TEST_LIST $MNT_TEST_LIST $IPC_TEST_LIST | tr ' ' '\n'
> elif [ "$1" = "-h" ]; then
> cat >&2 <<EOF
> This script is used for executing unit tests.
> Usage:
> zdtm.sh [OPTIONS]
> -zdtm.sh [OPTIONS] [TEST NAME]
> +zdtm.sh [OPTIONS] [TEST PATTERN]
> Options:
> -l : Show list of tests.
> -d : Dump a test process and check that this process can continue working.
> @@ -683,15 +665,28 @@ EOF
> elif [ "${1:0:1}" = '-' ]; then
> echo "unrecognized option $1"
> else
> - if echo $UTS_TEST_LIST | fgrep -qw $1; then
> - run_test $1 -n uts || case_error $1
> - elif echo $MNT_TEST_LIST | fgrep -qw $1; then
> - run_test $1 -n mnt || case_error $1
> - elif echo $IPC_TEST_LIST | fgrep -qw $1; then
> - run_test $1 -n ipc || case_error $1
> + if [ $COMPILE_ONLY -eq 0 ]; then
> + check_mainstream || exit 1
> + fi
> +
> + if [ $# -eq 0 ]; then
> + pattern='.*'
> else
> - run_test $1 || case_error $1
> + pattern=$1
> fi
> +
> + for t in $(echo "$TEST_LIST" | grep -x "$pattern"); do
> + run_test $t || case_error $t
> + done
> + for t in $(echo "$UTS_TEST_LIST" | grep -x "$pattern"); do
> + run_test $t -n uts || case_error $t
> + done
> + for t in $(echo "$MNT_TEST_LIST" | grep -x "$pattern"); do
> + run_test $t -n mnt || case_error $t
> + done
> + for t in $(echo "$IPC_TEST_LIST" | grep -x "$pattern"); do
> + run_test $t -n ipc || case_error $t
> + done
> fi
>
> [ -n "$TMP_TREE" ] && rm -rf $TMP_TREE || exit 0
> --
> 1.8.3
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list