summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2015-08-24 12:04:54 +0530
committerRaghavendra Talur <rtalur@redhat.com>2015-08-25 21:20:06 -0700
commit734e9ed2827c39336e1fab26e2db3ea987976ce1 (patch)
treea6f3c22fe5f7ab97e645e9b42f5a51c2a8dd8812
parent116e3dd3d7687a785b0d04a8afd11619d85ff4ec (diff)
tests: Fix corruption of files on NetBSD
This is one more attempt to eliminate corruption of files by our tests scripts on NetBSD. Changes done: 1. Have every local variable with a unique name. 2. Change date format to match with gluster's. 3. Pass the parameters to G_LOG without interpretation, hence the change from $* to $@. Change-Id: I833a93555da93179a1b39a9e4e7086216c335c3d BUG: 1251592 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/11993 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com>
-rw-r--r--tests/include.rc28
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/include.rc b/tests/include.rc
index 1d084c03357..754c8d62423 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -128,19 +128,21 @@ function dbg()
function G_LOG()
{
- local logdir=`$CLI --print-logdir`
- test -d $logdir
+ local g_log_logdir;
+ g_log_logdir=`$CLI --print-logdir`
+ test -d $g_log_logdir
if [ $? != 0 ]; then
return
fi
- local string="++++++++++ G_LOG:$0: TEST: $1 $2 ++++++++++"
- string="`date -u +["%F %T.%N"]`:$string"
- local i
- for i in `find $logdir/ -type f`;
+ local g_log_string;
+ g_log_string="++++++++++ G_LOG:$0: TEST: $1 $@ ++++++++++"
+ g_log_string="`date -u +["%F %T.%6N"]`:$g_log_string"
+ local g_log_filename
+ for g_log_filename in `find $g_log_logdir/ -type f -name \*.log`;
do
- echo $string>>$i
+ echo "$g_log_string" >> "$g_log_filename"
done
-} 2> /dev/null
+}
function test_header()
{
@@ -193,7 +195,7 @@ function _EXPECT()
shift;
local a=""
- G_LOG $TESTLINE "$*";
+ G_LOG $TESTLINE "$@";
test_header "$@";
e="$1";
@@ -227,7 +229,7 @@ function _EXPECT_NOT()
shift;
local a=""
- G_LOG $TESTLINE "$*";
+ G_LOG $TESTLINE "$@";
test_header "$@";
e="$1";
@@ -245,7 +247,7 @@ function _EXPECT_KEYWORD()
{
TESTLINE=$1;
shift;
- G_LOG $TESTLINE "$*";
+ G_LOG $TESTLINE "$@";
test_header "$@";
e="$1";
@@ -261,7 +263,7 @@ function _TEST()
shift;
local redirect=""
- G_LOG $TESTLINE "$*";
+ G_LOG $TESTLINE "$@";
test_header "$@";
if [ "$1" = "!" ]; then
@@ -281,7 +283,7 @@ function _EXPECT_WITHIN()
local timeout=$1
shift;
- G_LOG $TESTLINE "$*";
+ G_LOG $TESTLINE "$@";
test_header "$@"
e=$1;