When testing make the time taken for some operations more obvious.
authorMartin Schwenke <martin@meltin.net>
Mon, 6 Jul 2009 06:39:08 +0000 (16:39 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 7 Jul 2009 23:43:45 +0000 (09:43 +1000)
If wait_until() does not timeout, print the time taken for the command
to succeed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
tests/scripts/ctdb_test_functions.bash

index b271ddea9517b1dc56b79a6bf746434c310211c3..c7aaf6a9c8af862c455d06bdb9f98dcdd41caef3 100644 (file)
@@ -268,14 +268,15 @@ wait_until ()
     local timeout="$1" ; shift # "$@" is the command...
 
     echo -n "<${timeout}|"
-    while [ $timeout -gt 0 ] ; do
+    local t=$timeout
+    while [ $t -gt 0 ] ; do
        if "$@" ; then
-           echo '|'
+           echo "|$(($timeout - $t))|"
            echo "OK"
            return 0
        fi
        echo -n .
-       timeout=$(($timeout - 1))
+       t=$(($t - 1))
        sleep 1
     done