vmbox: print the verdict when the guest powers off (set -e aborted first)

`_run_exec "$name" "$@"` sat on its own line under `set -euo pipefail`, so a
non-zero return aborted the script before the verdict was ever computed. ssh
returns 255 when its connection dies -- which is exactly what a SUCCESSFUL
guest poweroff causes. The single case this tool exists to report on was the
one case that silently printed nothing.

Caught by the acceptance demo, not by the unit tests: verdict_report was
correct in isolation the whole time and passed 8/8 there. Only running the
real CLI against a real poweroff exposed the wiring.

Verified after the fix, end to end:
  ==> Running in 'fixtest': sudo systemctl poweroff
  Connection to 127.0.0.1 closed by remote host.
   ok  VERDICT: clean poweroff -- guest powered itself off and reached
       'reboot: Power down'

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdyMBGCrGVGDWtJ9xe48f3
This commit is contained in:
Krzysztof Rudnicki 2026-08-22 21:10:40 +02:00
parent 36234e980a
commit efe77d4454

View File

@ -46,11 +46,17 @@ run_in_vm() {
[[ -f "$events" ]] && events_before=$(wc -l < "$events")
log "Running in '$name': $*"
_run_exec "$name" "$@"
local ssh_rc=$?
# `|| ssh_rc=$?` is load-bearing: under `set -e` a bare call would abort
# the script when ssh returns 255 -- which is precisely what a SUCCESSFUL
# guest poweroff causes. The verdict would then never be printed for the
# one case this tool exists to report on.
local ssh_rc=0
_run_exec "$name" "$@" || ssh_rc=$?
_run_settle "$name" "$serial"
_run_finish "$name" "$serial" "$events" "$events_before" "$ssh_rc"
_run_settle "$name" "$serial" || true
local frc=0
_run_finish "$name" "$serial" "$events" "$events_before" "$ssh_rc" || frc=$?
return "$frc"
}
# stdin is closed: several target installers prompt, and an inherited terminal