Add QEMUDriver.interact() and qemu-run.py example#1892
Merged
Emantor merged 2 commits intoJun 10, 2026
Conversation
Since the QEMUDriver can't be used with labgrid-client (because it does not use labgrid's remote infrastructue), there is currently no good way of accessing its console interactively, e.g. for debugging. Add a QEMUDriver.interact() method that creates a PTY, let microcom open it and relay the QEMUDriver's input and output to that PTY. Signed-off-by: Bastian Krause <bst@pengutronix.de>
0bd7751 to
28d1626
Compare
The QEMUDriver can't be used with labgrid-client, because it does not use labgrid's remote infrastructure. Add an example helper to run QEMU, either by activating the QEMUDriver directly or by transitioning into a strategy state first, then start an interactive console. Signed-off-by: Bastian Krause <bst@pengutronix.de>
28d1626 to
11e0ffb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1892 +/- ##
========================================
- Coverage 46.0% 45.9% -0.1%
========================================
Files 180 180
Lines 14471 14496 +25
========================================
+ Hits 6662 6666 +4
- Misses 7809 7830 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Emantor
approved these changes
Jun 10, 2026
Contributor
|
I just gave it a try and wondering if there is a good way to terminate microcom when qemu exits? cmd = self.qemu.get_qemu_base_args()
with open("/dev/tty", "r+b", buffering=0) as tty:
tty.write(bytes("Run manually with: \n{} -serial mon:stdio\n".format(quote_cmd(cmd)), "UTF-8"))
if state == "qemu_dry_run":
pytest.exit('Dry run. Terminating.')
subprocess.run(cmd, stdin=tty, stdout=tty, stderr=tty) |
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.
Description
Since the QEMUDriver can't be used with labgrid-client (because it does not use labgrid's remote infrastructue), there is currently no good way of accessing its console interactively, e.g. for debugging.
Add a
QEMUDriver.interact()method that creates a PTY, let microcom open it and relay the QEMUDriver's input and output to that PTY.Add an example helper to run QEMU, either by activating the QEMUDriver directly or by transitioning into a strategy state first, then start an interactive console.
Checklist