[CRIU] test: adjust the output for tests
Yicheng Qin
yichengq at google.com
Fri Aug 9 11:06:51 EDT 2013
From: Yicheng Qin <yichengq at google.com>
Subject: [PATCH] test: adjust the output for tests
Adjust the format of information printed.
Print out more necessary debug information.
Display error message in STDERR and make it more readable.
Signed-off-by: Yicheng Qin <yichengq at google.com>
---
test/tcp/run.sh | 10 ++++++++--
test/zdtm.sh | 34 +++++++++++++++++++++++++++-------
2 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/test/tcp/run.sh b/test/tcp/run.sh
index 0dd0e70..873c7d1 100644
--- a/test/tcp/run.sh
+++ b/test/tcp/run.sh
@@ -34,12 +34,16 @@ echo "Make it run"
echo "${TEXT}" >&3
function fail {
- echo "$@"
+ echo "$@" >&2
kill -9 ${CLN_PID}
kill -9 ${SRV_PID}
+ echo ${CLN_LOG}: >&2
+ cat ${CLN_LOG} >&2
exit 1
}
+kill -s 0 ${CLN_PID} || fail "Client is dead"
+
echo "Suspend server"
${CRIU} dump -D ${DDIR} -o dump.log -t ${SRV_PID} --tcp-established -vvvv
|| fail "Fail to dump server"
sleep 1
@@ -51,5 +55,7 @@ echo "${TEXT}" >&3
echo "Collect results"
exec 3>&-
-wait ${CLN_PID}
+wait ${CLN_PID} || fail "Client exits abruptly"
kill -9 ${SRV_PID}
+
+echo PASS
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 9e72fa3..5b064f7 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -179,6 +179,10 @@ check_mainstream()
local -a ver_arr
local ver_str=`uname -r`
+ cat >&2 <<EOF
+========================== CRIU CHECK =============================
+EOF
+
$CRIU check && return 0
MAINSTREAM_KERNEL=1
@@ -262,6 +266,8 @@ export MAKEFLAGS=--no-print-directory
start_test()
{
+ echo Start test $2 at $(date)
+
local tdir=$1
local tname=$2
export ZDTM_ROOT
@@ -500,6 +506,7 @@ EOF
cat $test.out
cat $test.out | grep -q PASS || return 2
[ "$CLEANUP" -ne 0 ] && rm -rf `dirname $ddump`
+ echo "Test: $test, Result: PASS"
return 0
}
@@ -510,23 +517,36 @@ case_error()
ZDTM_FAILED=1
- echo "Test: $test"
- echo "====================== ERROR ======================"
+ echo "Test: $test, Result: FAIL"
+ echo "====================== ERROR ======================" >&2
+ echo "Test: $test, Namespace: ${PIDNS}" >&2
if [ -n "$DUMP_PATH" ]; then
[ -e "$DUMP_PATH/dump.log" ] && {
- echo "Dump log : $DUMP_PATH/dump.log"
- cat $DUMP_PATH/dump.log* | grep Error
+ echo "Dump log : $DUMP_PATH/dump.log" >&2
+ cat $DUMP_PATH/dump.log* | grep Error >&2
+ echo "* * * * * * * * * * * * * * *" >&2
+ tail -n 40 $DUMP_PATH/dump.log* >&2
+ echo "*****************************" >&2
}
[ -e "$DUMP_PATH/restore.log" ] && {
- echo "Restore log: $DUMP_PATH/restore.log"
- cat $DUMP_PATH/restore.log* | grep Error
+ echo "Restore log: $DUMP_PATH/restore.log" >&2
+ cat $DUMP_PATH/restore.log* | grep Error >&2
+ echo "* * * * * * * * * * * * * * *" >&2
+ tail -n 40 $DUMP_PATH/restore.log* >&2
+ echo "*****************************" >&2
}
fi
[ -e "$test_log" ] &&
- echo "Output file: $test_log"
+ echo "Output file: $test_log" >&2
+ cat $test_log* >&2
+ echo "*****************************" >&2
+
[ -n "$HEAD" ] &&
echo "The initial HEAD was $HEAD"
+
+ echo "==================== ERROR OVER ====================" >&2
+
exit 1
}
--
1.8.3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20130809/e5de053a/attachment.html>
More information about the CRIU
mailing list