From 5512a5723ad22dd099a57c60483eb80e5b2a14c4 Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Fri, 20 Jan 2017 15:29:05 -0500 Subject: 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 Reviewed-on: https://review.gluster.org/16451 Tested-by: Jeff Darcy NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Smoke: Gluster Build System Reviewed-by: Raghavendra Talur Reviewed-by: Vijay Bellur --- tests/include.rc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/include.rc b/tests/include.rc index 22265755a02..9e6cea4b487 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -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 -- cgit