[CRIU] [PATCH 4/6] zdtm: Make use of $test consistently

Christopher Covington cov at codeaurora.org
Wed Aug 6 15:02:12 PDT 2014


The $test variable was being used without being locally defined in
the start_test function. Define it locally for uniformity with other
functions and use it where convenient. Also make the definition in
case_error local for uniformity with other functions.

Signed-off-by: Christopher Covington <cov at codeaurora.org>
---
 test/zdtm.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 8d990d8..878d70c 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -363,6 +363,7 @@ start_test()
 {
 	local tdir=$1
 	local tname=$2
+	local test=$(readlink -f $tdir)/$tname
 	export ZDTM_ROOT
 
 	killall -9 $tname > /dev/null 2>&1
@@ -381,14 +382,14 @@ start_test()
 		TPID="$test.pid"
 		unset ZDTM_NEWNS
 	else
-		TPID=$(readlink -f $tdir)/$tname.init.pid
+		TPID=$test.init.pid
 		if [ -z "$ZDTM_ROOT" ]; then
 			mkdir -p dump
 			ZDTM_ROOT=`mktemp -d /tmp/criu-root.XXXXXX`
 			ZDTM_ROOT=`readlink -f $ZDTM_ROOT`
 			mount --bind . $ZDTM_ROOT || return 1
 		fi
-		construct_root $ZDTM_ROOT $tdir/$tname || return 1
+		construct_root $ZDTM_ROOT $test || return 1
 		export ZDTM_NEWNS=1
 		export ZDTM_PIDFILE=$TPID
 		cd $ZDTM_ROOT
@@ -396,7 +397,7 @@ start_test()
 	fi
 
 	if ! make -C $tdir $tname.pid; then
-		echo ERROR: fail to start $tdir/$tname
+		echo ERROR: fail to start $test
 		return 1
 	fi
 
@@ -657,7 +658,7 @@ EOF
 
 case_error()
 {
-	test=${ZP}/${1#ns/}
+	local test=${ZP}/${1#ns/}
 	local test_log=`pwd`/$test.out
 
 	echo "Test: $test, Result: FAIL"
-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.



More information about the CRIU mailing list