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>
This commit is contained in:
Kaushal M 2012-12-18 18:44:54 +05:30 committed by Vijay Bellur
parent 292e1b3f7b
commit 7e6395bd8e
2 changed files with 15 additions and 2 deletions

View File

@ -67,4 +67,8 @@ function check-with-stored-task-id-xml()
function get-task-status()
{
$CLI $COMMAND | grep -o $PATTERN
if [ ${PIPESTATUS[0]} -ne 0 ]; then
return 1
fi
return 0
}

View File

@ -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