tests: track EW_RETRIES for debugging

It can often be useful while debugging to know how many times
EXPECT_WITHIN had to retry a command before it got the result we were
looking for.  This patch just adds a variable EW_RETRIES that can be
inspected to find this info for the last EXPECT_WITHIN.

Change-Id: I1bcb09bb7eb118c3d76c60317ef99e02df6b6ee6
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: https://review.gluster.org/16451
Tested-by: Jeff Darcy <jeff@pl.atyp.us>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
Jeff Darcy 2017-01-20 15:29:05 -05:00 committed by Vijay Bellur
parent 99c8c0b03a
commit 5512a5723a

View File

@ -330,6 +330,9 @@ function _EXPECT_WITHIN()
local endtime=$(( ${timeout}+`date +%s` ))
# We *want* this to be globally visible.
EW_RETRIES=0
while [ `date +%s` -lt $endtime ]; do
a=$("$@" | tail -1 ; exit ${PIPESTATUS[0]})
## Check command success
@ -342,6 +345,7 @@ function _EXPECT_WITHIN()
break;
fi
sleep 1;
EW_RETRIES=$((EW_RETRIES+1))
done
if [ "x$e" = "x" ] ; then