aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-10-13 02:40:29 +0200
committerFam Zheng <famz@redhat.com>2018-10-26 22:03:21 +0800
commitf5d3d21847c2bd5840404f77e5d2463917d5a4ba (patch)
tree399606b55aed39b7e53eda73bab25a95ae4d10f2 /tests
parent071cf5a4205a1fe7a33f61477e5f73f86cd2f9fe (diff)
tests/vm: Display remaining seconds to wait for a VM to start
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20181013004034.6968-5-f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/vm/basevm.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 9415e7c33a..81a1cb05dd 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -177,11 +177,14 @@ class BaseVM(object):
def wait_ssh(self, seconds=300):
starttime = datetime.datetime.now()
+ endtime = starttime + datetime.timedelta(seconds=seconds)
guest_up = False
- while (datetime.datetime.now() - starttime).total_seconds() < seconds:
+ while datetime.datetime.now() < endtime:
if self.ssh("exit 0") == 0:
guest_up = True
break
+ seconds = (endtime - datetime.datetime.now()).total_seconds()
+ logging.debug("%ds before timeout", seconds)
time.sleep(1)
if not guest_up:
raise Exception("Timeout while waiting for guest ssh")