Skip to content

Commit

Permalink
tests: make use of vm.shutdown(wait=True)
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Oct 26, 2018
1 parent 2c1629d commit cf8b621
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions qubes/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,15 +1070,12 @@ def enter_keys_in_window(self, title, keys):
subprocess.check_call(command)

def shutdown_and_wait(self, vm, timeout=60):
self.loop.run_until_complete(vm.shutdown())
while timeout > 0:
if not vm.is_running():
return
self.loop.run_until_complete(asyncio.sleep(1))
timeout -= 1
name = vm.name
del vm
self.fail("Timeout while waiting for VM {} shutdown".format(name))
try:
self.loop.run_until_complete(vm.shutdown(wait=True, timeout=timeout))
except qubes.exc.QubesException:
name = vm.name
del vm
self.fail("Timeout while waiting for VM {} shutdown".format(name))

def prepare_hvm_system_linux(self, vm, init_script, extra_files=None):
if not os.path.exists('/usr/lib/grub/i386-pc'):
Expand Down

0 comments on commit cf8b621

Please sign in to comment.