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.
This commit is contained in:
parent
bbae995be8
commit
796668d7df
|
@ -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) +
|
print("Looking for programs to appear in the VM (tries: " + str(tries) +
|
||||||
"): " + ", ".join(programs))
|
"): " + ", ".join(programs))
|
||||||
|
ssh_works = False
|
||||||
for i in range(0, tries):
|
for i in range(0, tries):
|
||||||
# Sleep
|
# Sleep
|
||||||
if i > 0:
|
if i > 0:
|
||||||
|
@ -157,6 +158,7 @@ def is_running(args, programs, tries=180, sleep_before_retry=1):
|
||||||
all = ssh_run(args, "ps ax")
|
all = ssh_run(args, "ps ax")
|
||||||
if not all:
|
if not all:
|
||||||
continue
|
continue
|
||||||
|
ssh_works = True
|
||||||
|
|
||||||
# Missing programs
|
# Missing programs
|
||||||
missing = []
|
missing = []
|
||||||
|
@ -167,7 +169,11 @@ def is_running(args, programs, tries=180, sleep_before_retry=1):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Not found
|
# 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
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue