Improve QEMU execution - #382
Open
henrybear327 wants to merge 3 commits into
Open
henrybear327 wants to merge 3 commits into
henrybear327 wants to merge 3 commits into
Conversation
qemu-runner.sh and test-matrix.sh each spelled the ssh option list for the test VM, and the copies had drifted: the runner kept the peer alive for 10 s x 6 and the matrix for 15 s x 4. tests/lib/qemu-ssh.sh now holds the one list. qemu_ssh_opts fills QEMU_SSH_OPTS at call time so a caller can still wrap its ssh in timeout(1), which cannot wrap a shell function. Both lanes keep the 60 s dead-peer budget.
jserv
reviewed
Sep 14, 2026
henrybear327
force-pushed
the
conf/qemu-runner
branch
2 times, most recently
from
September 16, 2026 09:39
a886dd0 to
b6de30c
Compare
Run as separate commands, start stopped its VM on exit and stop had no record of it. start --state-file now keeps the VM and records its port and key for a later shell and its pidfile for stop --state-file, which signals the pid only while its argv still names that pidfile, since the pid may have been reused. A pid that survives SIGKILL keeps its pidfile and state file so a later stop can retry. The trap 'qemu_stop' EXIT set when sourcing qemu-runner.sh replaced test-matrix.sh's cleanup trap, so only start and exec set it now; test-matrix.sh marks the VM active before qemu_start so its own trap covers the boot. A failed start now prints the tail of qemu's output and serial console before removing the run directory, so the caller can see why the VM did not come up. Add tests/test-qemu-runner.sh to make check.
henrybear327
force-pushed
the
conf/qemu-runner
branch
from
September 16, 2026 13:08
b6de30c to
3dafb76
Compare
ssh offers every identity its agent holds before a -i key the agent lacks. The fixture guest's Dropbear v2024.86 never counts a rejected public-key query, but dropbear 2026.90 caps them at MAX_PUBKEY_QUERIES (15), so a host agent holding that many keys would fail every qemu_exec and run_qemu call once the Alpine fixture moves past it. IdentitiesOnly=yes limits the offer to QEMU_SSH_KEY.
jserv
reviewed
Sep 16, 2026
| if ! (echo > /dev/tcp/127.0.0.1/"$QEMU_PORT") 2> /dev/null; then | ||
| echo "qemu-runner: VM did not boot within ${QEMU_BOOT_TIMEOUT}s" >&2 | ||
| qemu_stop | ||
| qemu_fail_start "VM did not boot within ${QEMU_BOOT_TIMEOUT}s" |
Contributor
There was a problem hiding this comment.
When qemu exits right away (hvf unavailable, a bad -cpu, a missing kernel), this loop still waits the full QEMU_BOOT_TIMEOUT (90s by default) and then reports "did not boot", while the real cause is already in qemu.log, which this change starts capturing. Keep qemu_pid=$! after the launch and fail early inside the wait loop, before its sleep 1: kill -0 "$qemu_pid" 2> /dev/null || { qemu_fail_start "qemu exited before the guest booted"; return 1; }.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve error reporting from qemu execution, in preparation for conformance test failed runs.
Summary by cubic
Improves
qemu-runner.shlifecycle handling and diagnostics so a VM can be started and stopped from different shells without risking cleanup of a recycled PID. It also centralizes the test VM's SSH options and adds no-VM regression coverage.start --state-file PATHrecords the port, key, and pidfile;stop --state-file PATHvalidates process identity before signaling and preserves state if SIGKILL fails./tmpsetup now report the serial console and QEMU output before cleanup.IdentitiesOnly=yeslimits offers to the VM key so agent-held keys can't trip the guest dropbear's 15-query cap.test-qemu-runner.shcovers start/stop with stand-ins in thechecklane.Migration
--state-file PATHto bothstartandstopfor cross-shell use; without it,stopcannot find the VM.Written for commit f920b8b. Summary will update on new commits.