Commit e493d386 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: improve printing of separator lines

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a4118a6e
...@@ -171,6 +171,20 @@ COMPILE_ONLY=0 ...@@ -171,6 +171,20 @@ COMPILE_ONLY=0
BATCH_TEST=0 BATCH_TEST=0
SPECIFIED_NAME_USED=0 SPECIFIED_NAME_USED=0
zdtm_sep()
{
local msg=$1
[ -n "$msg" ] && msg=" $msg "
awk -v m=${2:-=} -v "msg=$msg" '
BEGIN {
l=length(msg);
s=int((79-l)/2);
sep = sprintf("%"s"s", " ")
gsub(/ /, m, sep);
printf("%s%s%s\n",sep,msg,sep);
}' < /dev/null
}
check_criu() check_criu()
{ {
if [ ! -x $CRIU ]; then if [ ! -x $CRIU ]; then
...@@ -184,9 +198,7 @@ check_mainstream() ...@@ -184,9 +198,7 @@ check_mainstream()
local -a ver_arr local -a ver_arr
local ver_str=`uname -r` local ver_str=`uname -r`
cat >&2 <<EOF zdtm_sep "CRIU CHECK"
========================== CRIU CHECK =============================
EOF
$CRIU check && return 0 $CRIU check && return 0
MAINSTREAM_KERNEL=1 MAINSTREAM_KERNEL=1
...@@ -566,57 +578,43 @@ case_error() ...@@ -566,57 +578,43 @@ case_error()
( exec >&2 ( exec >&2
cat <<EOF zdtm_sep ERROR
============================= ERROR ===============================
EOF
echo "Test: $test, Namespace: $PIDNS" echo "Test: $test, Namespace: $PIDNS"
cat <<EOF
-------------------------------------------------------------------
EOF
if [ -n "$DUMP_PATH" ]; then if [ -n "$DUMP_PATH" ]; then
if [ -e "$DUMP_PATH/dump.log" ]; then if [ -e "$DUMP_PATH/dump.log" ]; then
echo "Dump log : $DUMP_PATH/dump.log" echo "Dump log : $DUMP_PATH/dump.log"
zdtm_sep "grep Error" "-"
cat $DUMP_PATH/dump.log* | grep Error cat $DUMP_PATH/dump.log* | grep Error
if [ $VERBOSE -gt 0 ]; then if [ $VERBOSE -gt 0 ]; then
cat <<EOF zdtm_sep "" "-"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EOF
tail -n 40 $DUMP_PATH/dump.log* tail -n 40 $DUMP_PATH/dump.log*
fi fi
cat <<EOF zdtm_sep "END" "-"
-------------------------------------------------------------------
EOF
fi fi
if [ -e "$DUMP_PATH/restore.log" ]; then if [ -e "$DUMP_PATH/restore.log" ]; then
echo "Restore log: $DUMP_PATH/restore.log" echo "Restore log: $DUMP_PATH/restore.log"
zdtm_sep "grep Error" "-"
cat $DUMP_PATH/restore.log* | grep Error cat $DUMP_PATH/restore.log* | grep Error
if [ $VERBOSE -gt 0 ]; then if [ $VERBOSE -gt 0 ]; then
cat <<EOF zdtm_sep "" "-"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EOF
tail -n 40 $DUMP_PATH/restore.log* tail -n 40 $DUMP_PATH/restore.log*
fi fi
cat <<EOF zdtm_sep "END" "-"
-------------------------------------------------------------------
EOF
fi fi
fi fi
if [ -e "$test_log" ]; then if [ -e "$test_log" ]; then
echo "Output file: $test_log" echo "Output file: $test_log"
zdtm_sep "" "-"
cat $test_log* cat $test_log*
cat <<EOF zdtm_sep "END" "-"
-------------------------------------------------------------------
EOF
fi fi
[ -n "$HEAD" ] && [ -n "$HEAD" ] &&
echo "The initial HEAD was $HEAD" echo "The initial HEAD was $HEAD"
cat <<EOF zdtm_sep "ERROR OVER"
=========================== ERROR OVER ============================
EOF
) )
if [ $BATCH_TEST -eq 0 ]; then if [ $BATCH_TEST -eq 0 ]; then
exit 1 exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment