From c690c1131288914d0081b817a5ae5ba51e051229 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 8 Jul 2014 21:57:09 +0530 Subject: tests: Print EXPECT style error messages rather than 'not ok' Change-Id: Ib23426c5ede0ab71387a6a112b313aa448b872cd BUG: 1092850 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/8263 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Vijay Bellur --- tests/include.rc | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'tests') 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"; } -- cgit