From c9d0d2c9fc16f2e989444bc4d7d8fab8060433ba Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Fri, 27 Jan 2017 06:34:06 +0000 Subject: improve cleanup() in run.sh - make sure all hosts are unset force_down flag - load all functions for inspector and installer first in order to avoid 'command not found' error - also, print VM if it has error state Change-Id: If56cba201e1a5f3669a97ffb3d28b3c55c7cdb58 Signed-off-by: Ryota MIBU --- tests/functions-common | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/functions-common') diff --git a/tests/functions-common b/tests/functions-common index db2565a3..08d489e5 100644 --- a/tests/functions-common +++ b/tests/functions-common @@ -70,3 +70,20 @@ function die_if_not_set { $xtrace } +# Wait until the condition is met. +# wait_until condition timeout interval +function wait_until { + local condition="$1" + local timeout=$2 + local interval=$3 + + while eval ${condition} + do + sleep ${interval} + timeout=$((${timeout} - ${interval})) + if [[ ${timeout} < 0 ]]; then + err $LINENO "timed out ($condition)..." + return 1 + fi + done +} -- cgit 1.2.3-korg