[CRIU] [PATCH v6] zdtm: print test dir, dump and restore path (if any) in case of error

Kinsbursky Stanislav skinsbursky at openvz.org
Mon Jan 30 06:54:26 EST 2012


From: Stanislav Kinsbursky <skinsbursky at parallels.com>

v6: silly "/" miss fixed

v5: it finally workks as expected

v4: fixed wrong error print after successfull  run on all zdtm tests

v3: spaces removed

v2: print test output file path  (if present)

Print dump and restore file in case of running all tests suit.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at parallels.com>

---
 test/zdtm.sh |   35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 2586186..864b28e 100644
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-ZP="zdtm/live/"
+ZP="zdtm/live"
 
 TEST_LIST="\
 $ZP/static/pipe00
@@ -67,29 +67,40 @@ run_test()
 	cat $test.out | grep PASS || return 2
 }
 
+case_error()
+{
+	test=$1
+	echo "Test: "$test
+	echo "====================== ERROR ======================"
+	test_log="`pwd`/$test.out"
+	if [ -e "$dump_path/dump.log" ]; then
+		echo "Dump log   : "$dump_path"/dump.log"
+	fi
+	if [ -e "$dump_path/restore.log" ]; then
+		echo "Restore log: "$dump_path"/restore.log"
+	fi
+	if [ -e "$test_log" ]; then
+		echo "Output file: "$test_log
+	fi
+	exit 1
+}
+
 cd `dirname $0` || exit 1
 
 if [ $# -eq 0 ]; then
 	for t in $TEST_LIST; do
-		run_test $t "" || exit 1
+		run_test $t "" || case_error $t
 	done
 	for t in $NS_TEST_LIST; do
-		run_test $t "-n" || exit 1
+		run_test $t "-n" || case_error $t
 	done
 elif [ "$1" == "-l" ]; then
 	echo $TEST_LIST | sed -e "s#$ZP/##g" -e 's/ /\n/g'
 	echo $NS_TEST_LIST | sed -e "s#$ZP/##g" -e 's/ /\n/g'
 else
 	if echo "$NS_TEST_LIST" | fgrep -q "$1" ; then
-		run_test "$ZP/$1" "-n" && exit 0
-	else
-		run_test "$ZP/$1" && exit 0
-	fi
-	result=$?
-	echo "====================== ERROR ======================"
-	if [ $result == 1 ]; then
-		echo "Dump log: "$dump_path"/dump.log"
+		run_test "$ZP/$1" "-n" || case_error "$ZP/$1"
 	else
-		echo "Restore log: "$dump_path"/restore.log"
+		run_test "$ZP/$1" || case_error "$ZP/$1"
 	fi
 fi



More information about the CRIU mailing list