[CRIU] [PATCH] test: create env.sh for environment setting

Andrew Vagin avagin at parallels.com
Mon Aug 19 16:19:45 EDT 2013


Acked-by: Andrew Vagin <avagin at parallels.com>

On Tue, Aug 13, 2013 at 06:00:19PM -0700, Yicheng Qin wrote:
> Currently, env.sh only contains the location of criu executable.
> 
> Signed-off-by: Yicheng Qin <yichengq at google.com>
> ---
>  test/app-emu/java/HelloWorld/run.sh | 3 +--
>  test/app-emu/job/job.exp            | 6 ++++--
>  test/app-emu/lxc/run.sh             | 4 ++--
>  test/app-emu/make/run.sh            | 3 +--
>  test/app-emu/screen/run.sh          | 3 +--
>  test/app-emu/tarbz/run.sh           | 2 +-
>  test/app-emu/vnc/run.sh             | 3 +--
>  test/env.sh                         | 4 ++++
>  test/mem-snap/run-predump-2.sh      | 3 ++-
>  test/mem-snap/run-predump.sh        | 3 ++-
>  test/mem-snap/run-snap.sh           | 3 ++-
>  test/tcp/run.sh                     | 3 ++-
>  test/zdtm.sh                        | 3 ++-
>  13 files changed, 25 insertions(+), 18 deletions(-)
>  create mode 100755 test/env.sh
> 
> diff --git a/test/app-emu/java/HelloWorld/run.sh b/test/app-emu/java/HelloWorld/run.sh
> index 7f94d3a..0ed6afd 100644
> --- a/test/app-emu/java/HelloWorld/run.sh
> +++ b/test/app-emu/java/HelloWorld/run.sh
> @@ -1,8 +1,7 @@
>  #!/bin/bash
>  
>  source ../../../functions.sh || exit 1
> -
> -criu="../../../../criu"
> +source ../../../env.sh || exit 1
>  
>  cleanup_class() {
>  	rm -f ./*.class
> diff --git a/test/app-emu/job/job.exp b/test/app-emu/job/job.exp
> index 1b9b7fb..1409103 100755
> --- a/test/app-emu/job/job.exp
> +++ b/test/app-emu/job/job.exp
> @@ -1,5 +1,7 @@
>  #!/usr/bin/expect
>  
> +source ../../env.sh || exit 1
> +
>  exec rm -rf ./dump
>  exec mkdir ./dump
>  
> @@ -21,7 +23,7 @@ switch $current {
>  			puts "FAIL: Timed out on ready"
>  			exit -1
>  		}
> -		system ../../../criu dump -v4 -D ./dump -o dump.log -j -t $pid
> +		system $criu dump -v4 -D ./dump -o dump.log -j -t $pid
>  		system echo "$pid" > ./dump/pid.pid
>  		exit 0
>  	}
> @@ -37,7 +39,7 @@ switch $current {
>  			exit -1
>  		}
>  
> -		spawn ../../../criu restore -v4 -D ./dump -o restore.log -j
> +		spawn $criu restore -v4 -D ./dump -o restore.log -j
>  		#
>  		# spawn doesn't wait for restore to complete, so
>  		# add some sleep here. Still better would be to
> diff --git a/test/app-emu/lxc/run.sh b/test/app-emu/lxc/run.sh
> index 3b86f00..3664f5f 100755
> --- a/test/app-emu/lxc/run.sh
> +++ b/test/app-emu/lxc/run.sh
> @@ -1,11 +1,11 @@
>  #!/bin/bash
>  
> +source ../../env.sh || exit 1
> +
>  [ -z "$CR_IP_TOOL" ] && CR_IP_TOOL=ip
>  
>  cd `dirname $0`
>  
> -criu="../../../criu"
> -
>  name=$1
>  [ -z "$name" ] && { cat <<EOF
>  Usage: $0 NAME [PID]"
> diff --git a/test/app-emu/make/run.sh b/test/app-emu/make/run.sh
> index 582d4d7..7cb44c7 100644
> --- a/test/app-emu/make/run.sh
> +++ b/test/app-emu/make/run.sh
> @@ -1,8 +1,7 @@
>  #!/bin/bash
>  
>  source ../../functions.sh || exit 1
> -
> -criu="../../../criu"
> +source ../../env.sh || exit 1
>  
>  cleanup_wd() {
>  	rm -f "ref-*"
> diff --git a/test/app-emu/screen/run.sh b/test/app-emu/screen/run.sh
> index 67c9913..3227491 100644
> --- a/test/app-emu/screen/run.sh
> +++ b/test/app-emu/screen/run.sh
> @@ -1,8 +1,7 @@
>  #!/bin/bash
>  
>  source ../../functions.sh || exit 1
> -
> -criu="../../../criu"
> +source ../../env.sh || exit 1
>  
>  set -x
>  
> diff --git a/test/app-emu/tarbz/run.sh b/test/app-emu/tarbz/run.sh
> index 0a48900..677c6de 100644
> --- a/test/app-emu/tarbz/run.sh
> +++ b/test/app-emu/tarbz/run.sh
> @@ -1,8 +1,8 @@
>  #!/bin/bash
>  
>  source ../../functions.sh || exit 1
> +source ../../env.sh || exit 1
>  
> -criu="../../../criu"
>  DEPTH=3
>  SPAN=5
>  archref="arch-ref.tar.bz2"
> diff --git a/test/app-emu/vnc/run.sh b/test/app-emu/vnc/run.sh
> index 7445d63..b3a9822 100755
> --- a/test/app-emu/vnc/run.sh
> +++ b/test/app-emu/vnc/run.sh
> @@ -1,8 +1,7 @@
>  set -m
>  
>  source ../../functions.sh || exit 1
> -
> -criu="../../../criu"
> +source ../../env.sh || exit 1
>  
>  mkdir data
>  
> diff --git a/test/env.sh b/test/env.sh
> new file mode 100755
> index 0000000..ab015e0
> --- /dev/null
> +++ b/test/env.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +
> +CRIU=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../criu)
> +criu=$CRIU
> diff --git a/test/mem-snap/run-predump-2.sh b/test/mem-snap/run-predump-2.sh
> index bb336e8..3fc2f74 100755
> --- a/test/mem-snap/run-predump-2.sh
> +++ b/test/mem-snap/run-predump-2.sh
> @@ -1,12 +1,13 @@
>  #!/bin/bash
>  
> +source ../env.sh || exit 1
> +
>  function fail {
>  	echo "$@"
>  	exit 1
>  }
>  set -x
>  
> -CRIU="../../criu"
>  IMGDIR="dump/"
>  
>  rm -rf "$IMGDIR"
> diff --git a/test/mem-snap/run-predump.sh b/test/mem-snap/run-predump.sh
> index edfd26f..741d8eb 100755
> --- a/test/mem-snap/run-predump.sh
> +++ b/test/mem-snap/run-predump.sh
> @@ -1,5 +1,7 @@
>  #!/bin/bash
>  
> +source ../env.sh || exit 1
> +
>  USEPS=0
>  
>  if [ "$1" = "-s" ]; then
> @@ -18,7 +20,6 @@ function fail {
>  }
>  set -x
>  
> -CRIU="../../criu"
>  IMGDIR="dump/"
>  
>  rm -rf "$IMGDIR"
> diff --git a/test/mem-snap/run-snap.sh b/test/mem-snap/run-snap.sh
> index 08f7669..d2a6207 100755
> --- a/test/mem-snap/run-snap.sh
> +++ b/test/mem-snap/run-snap.sh
> @@ -1,5 +1,7 @@
>  #!/bin/bash
>  
> +source ../env.sh || exit 1
> +
>  USEPS=0
>  
>  if [ "$1" = "-s" ]; then
> @@ -18,7 +20,6 @@ function fail {
>  }
>  set -x
>  
> -CRIU="../../criu"
>  IMGDIR="dump/"
>  
>  rm -rf "$IMGDIR"
> diff --git a/test/tcp/run.sh b/test/tcp/run.sh
> index 43a0674..702879d 100755
> --- a/test/tcp/run.sh
> +++ b/test/tcp/run.sh
> @@ -1,5 +1,7 @@
>  #!/bin/bash
>  
> +source ../env.sh || exit 1
> +
>  set -x
>  
>  PORT=12345
> @@ -7,7 +9,6 @@ CLN_PIPE="./clnt_pipe"
>  SRV_LOG="./srv.log"
>  CLN_LOG="./cln.log"
>  DDIR="dump"
> -CRIU="../../criu"
>  
>  TEXT=$(hexdump -C /dev/urandom | head -n 1)
>  
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 61aae6c..71fc8e3 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -150,7 +150,8 @@ fanotify00
>  sk-netlink
>  "
>  
> -CRIU=$(readlink -f `dirname $0`/../criu)
> +source $(readlink -f `dirname $0`/env.sh) || exit 1
> +
>  CRIU_CPT=$CRIU
>  TMP_TREE=""
>  SCRIPTDIR=`dirname $CRIU`/test
> -- 
> 1.8.3
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list