test(vm): make the install driver report guest EOF and post-poweroff teardown truthfully
Some checks are pending
ci / test (push) Waiting to run

This commit is contained in:
Phoebus 2026-09-24 22:25:45 -07:00
parent 249166a0b0
commit 3005630064
2 changed files with 19 additions and 4 deletions

View file

@ -21,6 +21,11 @@ Found while running the acceptance on a fresh disposable installed system:
longer written to the system transaction history; only `requires_root()`
actions are recorded. Covered by a CLI regression test that makes the system
transaction directory read-only.
- **Install-driver reporting robustness (`installer/tests/vm/serial-driver.py`):**
the driver no longer raises a `TypeError` when the guest serial closes before
`INSTALL-RC` (it now handles `pexpect.EOF`/`TIMEOUT` explicitly), and teardown
is best-effort so the post-poweroff `Could not terminate the child` exception
cannot turn a successful install into a nonzero driver exit.
- **Installed-VM evidence (disposable qcow2):** a clean install with the fixed
installer completes (`===INSTALL-RC=0===`, `installation finished`,
`NO_SECRET_LEAK`). Detached boot: LUKS unlock and login; systemd PID1

View file

@ -92,6 +92,16 @@ def spawn(args, env, log):
return child
def close_quietly(child):
"""Best-effort teardown. After the guest powers off, pexpect can raise
`ExceptionPexpect: Could not terminate the child`; that must not turn a
successful run into a nonzero driver exit."""
try:
child.close(force=True)
except Exception: # noqa: BLE001 - cleanup must never mask the result
pass
def do_install(results, paths, disks):
env, args = base_args(str(paths.ovmf_vars))
for disk in disks:
@ -127,7 +137,7 @@ def do_install(results, paths, disks):
except pexpect.EOF:
results.fail("install", "unexpected EOF")
finally:
child.close(force=True)
close_quietly(child)
log.close()
@ -218,7 +228,7 @@ def do_rollback(results, paths, disks):
except pexpect.EOF:
results.fail("rollback-before", "unexpected EOF")
finally:
child.close(force=True)
close_quietly(child)
log.close()
before = _parse_marker(phase1, "ROLLBACK-KNOWN-GOOD")
@ -272,7 +282,7 @@ def do_rollback(results, paths, disks):
except pexpect.EOF:
results.fail("rollback-after", "unexpected EOF")
finally:
child.close(force=True)
close_quietly(child)
log.close()
@ -329,7 +339,7 @@ def do_boot(results, paths, disks):
except pexpect.EOF:
results.fail("boot", "unexpected EOF")
finally:
child.close(force=True)
close_quietly(child)
log.close()