tests: make use of vm.shutdown(wait=True)

This commit is contained in:
Marek Marczykowski-Górecki 2018-10-21 05:11:24 +02:00
parent 2c1629da04
commit cf8b6219a9
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1070,15 +1070,12 @@ class SystemTestCase(QubesTestCase):
subprocess.check_call(command) subprocess.check_call(command)
def shutdown_and_wait(self, vm, timeout=60): def shutdown_and_wait(self, vm, timeout=60):
self.loop.run_until_complete(vm.shutdown()) try:
while timeout > 0: self.loop.run_until_complete(vm.shutdown(wait=True, timeout=timeout))
if not vm.is_running(): except qubes.exc.QubesException:
return name = vm.name
self.loop.run_until_complete(asyncio.sleep(1)) del vm
timeout -= 1 self.fail("Timeout while waiting for VM {} shutdown".format(name))
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): def prepare_hvm_system_linux(self, vm, init_script, extra_files=None):
if not os.path.exists('/usr/lib/grub/i386-pc'): if not os.path.exists('/usr/lib/grub/i386-pc'):