summaryrefslogtreecommitdiffstats
path: root/tests/include.rc
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2012-12-18 18:44:54 +0530
committerVijay Bellur <vbellur@redhat.com>2013-01-10 02:08:49 -0800
commit7e6395bd8e1810ba8c4614afe15616378b5f7ef5 (patch)
treea7610f28f9a92769ae67821a039f3370b6e0b9fd /tests/include.rc
parent292e1b3f7bccd7cbbced62707a1d4f59cef90222 (diff)
tests: make EXPECT_WITHIN also fail on command failure
Change-Id: I051bbe2344f19e647826ee177932ae8b95747ebd BUG: 764966 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/4334 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests/include.rc')
-rw-r--r--tests/include.rc13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/include.rc b/tests/include.rc
index f5cab1f6..90bcb8ec 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -127,8 +127,17 @@ function _EXPECT_WITHIN()
local success=0
while [ `date +%s` -lt $endtime ]; do
- "$@" | tail -1 | egrep -q "^${e}\$"
- if [ $? -eq 0 ]; then
+ ("$@") | tail -1 | egrep -q "^${e}\$"
+
+ local pipestatus=(${PIPESTATUS[@]})
+
+ ## Check command success
+ if [ ${pipestatus[0]} -ne 0 ]; then
+ break;
+ fi
+
+ ## Check match success
+ if [ ${pipestatus[2]} -eq 0 ]; then
success=1;
break;
fi