summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-07-08 21:57:09 +0530
committerVijay Bellur <vbellur@redhat.com>2014-07-09 11:45:09 -0700
commitc690c1131288914d0081b817a5ae5ba51e051229 (patch)
tree971c74e43b303ba2eb2e0cafb93ed2aedd1a09f1
parentb9f1d1a120b4469d51d2a96eecc7ce83516593ba (diff)
tests: Print EXPECT style error messages rather than 'not ok'
Change-Id: Ib23426c5ede0ab71387a6a112b313aa448b872cd BUG: 1092850 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8263 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--tests/include.rc20
1 files changed, 5 insertions, 15 deletions
diff --git a/tests/include.rc b/tests/include.rc
index ddafde4972c..c3c30b16af6 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -181,36 +181,26 @@ function _EXPECT_WITHIN()
test_header "$@"
e=$1;
+ a="";
shift;
local endtime=$(( ${timeout}+`date +%s` ))
- local success=0
while [ `date +%s` -lt $endtime ]; do
- ("$@") | tail -1 | egrep -q "^${e}\$"
-
- local pipestatus=(${PIPESTATUS[@]})
-
+ a=$("$@" | tail -1 ; exit ${PIPESTATUS[0]})
## Check command success
- if [ ${pipestatus[0]} -ne 0 ]; then
+ if [ $? -ne 0 ]; then
break;
fi
## Check match success
- if [ ${pipestatus[2]} -eq 0 ]; then
- success=1;
+ if [[ "$a" =~ "$e" ]]; then
break;
fi
sleep 1;
done
- if [ $success -eq 1 ]; then
- true;
- else
- false;
- fi
-
- test_footer;
+ test_expect_footer "$e" "$a";
}