[CRIU] [PATCH 2/7] test/zdtm.sh cleanup: mark local variables as such

Andrew Vagin avagin at parallels.com
Tue Feb 7 02:33:02 EST 2012


On Mon, Feb 06, 2012 at 08:57:24PM +0400, Kir Kolyshkin wrote:
> Signed-off-by: Kir Kolyshkin <kir at openvz.org>
> ---
>  test/zdtm.sh |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 4d38e89..9abdd94 100644
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -44,15 +44,15 @@ CRTOOLS=`pwd`/`dirname $0`/../crtools
>  
>  run_test()
>  {
> -	test=$ZP/$1
> -	tname=`basename $test`
> -	tdir=`dirname $test`
> +	local test=$ZP/$1
> +	local tname=`basename $test`
> +	local tdir=`dirname $test`
>  
>  	killall -9 $tname
>  	make -C $tdir cleanout $tname.pid
>  
> -	pid=`cat $test.pid` || return 1
> -	ddump="dump/$tname/$pid"
> +	local pid=`cat $test.pid` || return 1
It's not the same.
[avagin at dhcp-10-30-19-46 crtools]$ cat test.sh 
asd ()
{
	local pid=`cat $test.pid` || exit 1
}
asd
exit 0
[avagin at dhcp-10-30-19-46 crtools]$ bash -x test.sh 
+ asd
++ cat .pid
cat: .pid: No such file or directory
+ local pid=
+ exit 0

I did not know about that too, so all this patches were committed.
I will fix it.
> +	local ddump="dump/$tname/$pid"
>  	DUMP_PATH=`pwd`"/"$ddump
>  
>  	echo Dump $pid
> @@ -80,8 +80,8 @@ run_test()
>  
>  case_error()
>  {
> -	test=$ZP/$1
> -	test_log="`pwd`/$test.out"
> +	local test=$ZP/$1
> +	local test_log="`pwd`/$test.out"
>  
>  	echo "Test: $test"
>  	echo "====================== ERROR ======================"
> -- 
> 1.7.5.4
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list