From 796668d7df19d51d19b2984f4be681befe23e4d5 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 9 Jul 2018 22:26:14 +0200 Subject: [PATCH] More obvious test failure messages for QEMU test If the test case couldn't connect to the VM with SSH, it used to fail with a Python error of accessing the 'missing' variable without having it defined. With this commit, it prints out 'Could not connect to the VM via SSH' instead. --- test/test_qemu_running_processes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/test_qemu_running_processes.py b/test/test_qemu_running_processes.py index 89c57399..f26811f3 100644 --- a/test/test_qemu_running_processes.py +++ b/test/test_qemu_running_processes.py @@ -148,6 +148,7 @@ def is_running(args, programs, tries=180, sleep_before_retry=1): """ print("Looking for programs to appear in the VM (tries: " + str(tries) + "): " + ", ".join(programs)) + ssh_works = False for i in range(0, tries): # Sleep if i > 0: @@ -157,6 +158,7 @@ def is_running(args, programs, tries=180, sleep_before_retry=1): all = ssh_run(args, "ps ax") if not all: continue + ssh_works = True # Missing programs missing = [] @@ -167,7 +169,11 @@ def is_running(args, programs, tries=180, sleep_before_retry=1): return True # Not found - print("Programs not running: " + ", ".join(missing)) + print("ERROR: Timeout reached!") + if ssh_works: + print("Programs not running: " + ", ".join(missing)) + else: + print("Could not connect to the VM via SSH") return False