test-driver.py: defaulting keepVmState in Machine init

ecb73fd555 introduced a new keepVmState
CLI flag for test-driver.py. This CLI flags gets forwarded to the
Machine class through create_machine.

It created a regression for the boot tests where __main__ end up not
being evaluated. See
https://github.com/NixOS/nixpkgs/pull/97346#issuecomment-690951837 for
bug report.

Defaulting keepVmState to false when __main__ ends up not being
evaluated.
This commit is contained in:
Félix Baylac-Jacqué 2020-09-11 10:47:03 +02:00
parent a4754caab7
commit e571b315e2
No known key found for this signature in database
GPG Key ID: EFD315F31848DBA4

View File

@ -228,7 +228,7 @@ class Machine:
return path
self.state_dir = os.path.join(tmp_dir, f"vm-state-{self.name}")
if not args["keepVmState"]:
if not args.get("keepVmState", False):
self.cleanup_statedir()
os.makedirs(self.state_dir, mode=0o700, exist_ok=True)
self.shared_dir = create_dir("shared-xchg")