summaryrefslogtreecommitdiffstats
path: root/tests/include.rc
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2017-01-12 14:48:28 +0530
committerRaghavendra Talur <rtalur@redhat.com>2017-01-25 01:49:46 -0500
commit07b34dd5c2f2c6eed4669472dd5af1063f4f224b (patch)
treef10cbdfd9ac2db63268820873619c961e33c119f /tests/include.rc
parente2525785e026d209845b939b9d02048d3004920d (diff)
tests/include : EXPECT_WITHIN takes full time even if expression matches
Problem: For all the tests using get_pending_heal_count, EXPECT_WITHIN is taking full time given to it even if the heal count matches with expected value. Solution: RC - In most of the tests, to check heal count, wildcards are being used. In EXPECT_WITHIN, in if condition, when we use it in double quotes (" "), it gives string with wildcards which does not match with the output of get_pending_heal_count. For example, (0 =~ ^0$). So, "while" loop was running for full time and at the end, after coming out of loop, in next if condition it was matching with the expression without quotes. That is why it was passing. Remove double quotes in "if condition" in EXPECT_WITHIN and match as we are matching it in test_expect_footer. Change-Id: Ia161594774d05b9b888efb2f7ed1950590d8ac1b BUG: 1412549 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: https://review.gluster.org/16382 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'tests/include.rc')
-rw-r--r--tests/include.rc8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/include.rc b/tests/include.rc
index b83972a111b..4591859cc01 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -235,7 +235,7 @@ function test_expect_not_footer()
err="Got \"$a\" when not expecting it"
fi
- ! [[ "$a" =~ "$e" ]];
+ ! [[ "$a" =~ $e ]];
test_footer "$lineno" "$err";
}
@@ -291,6 +291,10 @@ function _TEST()
test_footer "$TESTLINE";
}
+#This function should be used carefully.
+#The expected regex, given to this function, should be
+#used within ^ and $ to match exactly with the output of
+#command.
function _EXPECT_WITHIN()
{
TESTLINE=$1
@@ -316,7 +320,7 @@ function _EXPECT_WITHIN()
fi
## Check match success
- if [[ "$a" =~ "$e" ]]; then
+ if [[ "$a" =~ $e ]]; then
break;
fi
sleep 1;