test(vm): make the install driver report guest EOF and post-poweroff teardown truthfully
Some checks are pending
ci / test (push) Waiting to run
Some checks are pending
ci / test (push) Waiting to run
This commit is contained in:
parent
249166a0b0
commit
3005630064
2 changed files with 19 additions and 4 deletions
|
|
@ -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()`
|
longer written to the system transaction history; only `requires_root()`
|
||||||
actions are recorded. Covered by a CLI regression test that makes the system
|
actions are recorded. Covered by a CLI regression test that makes the system
|
||||||
transaction directory read-only.
|
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
|
- **Installed-VM evidence (disposable qcow2):** a clean install with the fixed
|
||||||
installer completes (`===INSTALL-RC=0===`, `installation finished`,
|
installer completes (`===INSTALL-RC=0===`, `installation finished`,
|
||||||
`NO_SECRET_LEAK`). Detached boot: LUKS unlock and login; systemd PID1
|
`NO_SECRET_LEAK`). Detached boot: LUKS unlock and login; systemd PID1
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,16 @@ def spawn(args, env, log):
|
||||||
return child
|
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):
|
def do_install(results, paths, disks):
|
||||||
env, args = base_args(str(paths.ovmf_vars))
|
env, args = base_args(str(paths.ovmf_vars))
|
||||||
for disk in disks:
|
for disk in disks:
|
||||||
|
|
@ -127,7 +137,7 @@ def do_install(results, paths, disks):
|
||||||
except pexpect.EOF:
|
except pexpect.EOF:
|
||||||
results.fail("install", "unexpected EOF")
|
results.fail("install", "unexpected EOF")
|
||||||
finally:
|
finally:
|
||||||
child.close(force=True)
|
close_quietly(child)
|
||||||
log.close()
|
log.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -218,7 +228,7 @@ def do_rollback(results, paths, disks):
|
||||||
except pexpect.EOF:
|
except pexpect.EOF:
|
||||||
results.fail("rollback-before", "unexpected EOF")
|
results.fail("rollback-before", "unexpected EOF")
|
||||||
finally:
|
finally:
|
||||||
child.close(force=True)
|
close_quietly(child)
|
||||||
log.close()
|
log.close()
|
||||||
|
|
||||||
before = _parse_marker(phase1, "ROLLBACK-KNOWN-GOOD")
|
before = _parse_marker(phase1, "ROLLBACK-KNOWN-GOOD")
|
||||||
|
|
@ -272,7 +282,7 @@ def do_rollback(results, paths, disks):
|
||||||
except pexpect.EOF:
|
except pexpect.EOF:
|
||||||
results.fail("rollback-after", "unexpected EOF")
|
results.fail("rollback-after", "unexpected EOF")
|
||||||
finally:
|
finally:
|
||||||
child.close(force=True)
|
close_quietly(child)
|
||||||
log.close()
|
log.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -329,7 +339,7 @@ def do_boot(results, paths, disks):
|
||||||
except pexpect.EOF:
|
except pexpect.EOF:
|
||||||
results.fail("boot", "unexpected EOF")
|
results.fail("boot", "unexpected EOF")
|
||||||
finally:
|
finally:
|
||||||
child.close(force=True)
|
close_quietly(child)
|
||||||
log.close()
|
log.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue