summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2012-12-18 19:14:58 +0530
committerAnand Avati <avati@redhat.com>2012-12-18 18:29:22 -0800
commit020fc237765670432ae645ee104c4816d724c5ea (patch)
treefc8860a58c2dabe5b50b0b3db8ddb539381bd651 /tests
parent2dcde13e0d46c02a22ac3180c1e6d3e878c80f4a (diff)
Tests: Print the actual, expected values for EXPECT
Change-Id: I394d23c0ea15bd340041550660cc5def017b5f15 BUG: 764966 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/4327 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/include.rc20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/include.rc b/tests/include.rc
index 509e783..f5cab1f 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -34,11 +34,12 @@ function test_header()
function test_footer()
{
RET=$?
+ local err=$1
if [ $RET -eq 0 ]; then
echo "ok $t";
else
- echo "not ok $t";
+ echo "not ok $t $err";
if [ "$EXIT_EARLY" = "1" ]; then
exit $RET
fi
@@ -49,19 +50,32 @@ function test_footer()
t=`expr $t + 1`;
}
+function test_expect_footer()
+{
+ local e=$1
+ local a=$2
+ local err=""
+
+ if [ "x${e}" != "x${a}" ]; then
+ err="Got \"$a\" instead of \"$e\""
+ fi
+ [[ "x${e}" == "x${a}" ]];
+ test_footer "$err";
+}
function _EXPECT()
{
TESTLINE=$1;
shift;
+ local a=""
test_header "$@";
e="$1";
shift;
- "$@" | tail -1 | egrep -q "^${e}\$"
+ a=$("$@" | tail -1)
- test_footer;
+ test_expect_footer "$e" "$a";
}
function _EXPECT_KEYWORD()