Repository navigation
microvm tests: stream OpenVMM transcripts to disk as they are read - #659
Open
Pedro Henrique Penna (ppenna) wants to merge 5 commits into
Open
Pedro Henrique Penna (ppenna) wants to merge 5 commits into
Pedro Henrique Penna (ppenna) wants to merge 5 commits into
Conversation
OpenvmmProcess kept the transcript in memory and wrote it only from wait or close, so a run terminated before cleanup left no transcript, or a truncated one, even though output had been read. Open the transcript before OpenVMM starts, append each consumed chunk and flush it, and close the file at wait or close. Bytes are written in the order received, with no prefixes and no duplication at cleanup. An error creating the transcript stops the run before OpenVMM starts. Output still queued at close is written too. The in-memory output and marker search are unchanged. Adds tests for growth while the process runs, a transcript that cannot be created, and output delivered after the last wait. Fixes #176 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
… release the transcript close drained the reader's queue before the interaction had stopped, so a final chunk queued during shutdown was lost from both output and transcript. A write failure during that drain also skipped closing the interaction and the transcript. Stop the interaction first, then drain, and release the transcript in a finally block. Adds regression tests for output queued during interaction close and for a transcript write failure. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
If InteractiveProcess.close raised, the drain was skipped and chunks still queued were missing from both output and the transcript. Drain in a finally around the interaction shutdown, so the transcript is complete whichever step fails. Adds a regression test with queued output and a failing interaction shutdown. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
_drain_available stopped at the first failed transcript write, so chunks still queued behind it never reached process.output. Keep collecting them in memory and re-raise the first error once the queue is empty. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review identified no blocking issues; runtime tests were not executed.
No open issues 🎉
What changed in this PR
Updates OpenvmmProcess to persist transcripts incrementally, preserving diagnostics if a run ends before normal cleanup.
Changes:
- Opens the transcript before launch and flushes each consumed chunk.
- Drains queued output during cleanup and releases resources on write failures.
- Adds regression tests for transcript growth and cleanup failures.
| File | Description |
|---|---|
| scripts/test_microvm_tests.py | Tests incremental capture, delayed output, and failure handling. |
| scripts/nvx_tools/openvmm_process.py | Streams transcript bytes and strengthens cleanup handling. |
Review effort: Balanced
The signature of the test that keeps every queued chunk when the transcript write fails reached 90 columns, past the 88-column limit, so ruff format --check failed the Lint, typing, and formatting job. Wrap it as ruff format does, like the file's other long signatures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Replaces #588 by Jay (@jay23606), whose commits are carried here unchanged (head
2634167ff). It is opened from amicrosoft/nvxbranch so that CI runs on a stable head: automated rebases of the original kept superseding its runs.Fixes #176.
Summary
OpenvmmProcesskept the transcript in memory and wrote it only fromwaitorclose. A run that was terminated before cleanup left no transcript, or a truncated one, even though its output had been read.waitandcloseonly close the file. Bytes are written in the order received, with no prefixes and no rewrite at cleanup, so nothing is duplicated.closeis written too.OpenvmmProcessonly.TcpConsolehas no transcript path, and the benchmark helpers inbenchmark.pyare not changed. Those are follow-ups.Test
wait), a transcript that cannot be created (fails before the change), and output delivered after the last wait.BOOT, thenLATEthree seconds later. The transcript containedBOOTwhile the child was still running, and the final transcript matched the output.test_microvm_tests: 193 tests. The dev baseline (190 tests) has the same nine failures and errors in host-loopback, private network ingress and SMP timer tests. They are unrelated to the transcript code and present on untoucheddev.🤖 Generated with Claude Code