Skip to content

Conversation

@JSydll
Copy link

@JSydll JSydll commented Oct 6, 2025

Description

Two minor features are added to the QemuDriver:

Support machine-specific options (e.g. -machine virt,secure=on)

While raising an exception for unsupported machines/boards is reasonable, adding machine-specific options shall not break the parsing. Therefore, the check is adjusted to only account for the leading board name.

Support interactions with the QEMU instance via QMP before releasing CPU(s)

Especially for bad case testing, it can be useful to be able to interact with the prepared but not yet spun off instance - e.g. to corrupt the boot medium without the need to build a corrupted image only for that purpose.

For both features, straight forward unit tests are provided.
Lastly, the changeset includes minor documentation updates and the introduction of type hints for the qemudriver.py file.

Checklist

  • Documentation for the feature
  • Tests for the feature
  • PR has been tested

@JSydll JSydll requested a review from krevsbech as a code owner October 6, 2025 04:58
@JSydll JSydll force-pushed the qemudriver/support-extended-test-scenarios branch from 680d6cd to 6d45393 Compare October 6, 2025 04:58
Copy link
Member

@Emantor Emantor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding a pre-start hook, I think it is more clear to expose somthing like a prepare() function which sets up the qemu process, and than have on() only do the cont monitor command. For backwards compatibility, the class can check whether the self._child attribute exists and call prepare() in on() if that was not done yet.

@JSydll JSydll force-pushed the qemudriver/support-extended-test-scenarios branch from 6d45393 to a778800 Compare November 2, 2025 12:25
Emantor
Emantor previously approved these changes Nov 3, 2025
Copy link
Member

@Emantor Emantor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can take the other fixes in this PR as well.

@JSydll
Copy link
Author

JSydll commented Nov 3, 2025

Thanks for the review and sorry for force-pushing so often - it looked easier to me to fix the one linting issue I overlooked when implementing the proposal from Rouven.

@Emantor
Copy link
Member

Emantor commented Nov 4, 2025

It's all good and thanks for keeping up with the PR even if it takes some time on our side 👍

@JSydll
Copy link
Author

JSydll commented Nov 4, 2025

I shortly glimpsed into the failing pipeline and now I'm wondering whether some environment changes happened? The test_qemudriver is not able to locate qemu-system-arm...

JSydll and others added 5 commits November 4, 2025 17:05
Signed-off-by: Joschka Seydell <[email protected]>
In order to build the new tests for the qemu driver, the qemu-system-arm
binary needs to be available on the system.

Signed-off-by: Rouven Czerwinski <[email protected]>
@Emantor Emantor force-pushed the qemudriver/support-extended-test-scenarios branch from 1eb616e to 500d6e9 Compare November 4, 2025 16:05
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.4%. Comparing base (f63dfd7) to head (500d6e9).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/driver/qemudriver.py 93.9% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1753     +/-   ##
========================================
+ Coverage    45.3%   45.4%   +0.1%     
========================================
  Files         172     172             
  Lines       13517   13523      +6     
========================================
+ Hits         6130    6151     +21     
+ Misses       7387    7372     -15     
Flag Coverage Δ
3.10 45.4% <93.9%> (+0.1%) ⬆️
3.11 45.4% <93.9%> (+0.1%) ⬆️
3.12 45.4% <93.9%> (+0.1%) ⬆️
3.13 45.4% <93.9%> (+0.1%) ⬆️
3.14 45.4% <93.9%> (+0.1%) ⬆️
3.9 45.5% <93.9%> (+0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Bastian-Krause
Copy link
Member

Prior to this, we've mocked qemu. Why do we need to use the real binary now?

If we decide we need the real qemu, we should at least add a marker so the tests get skipped on systems without it. Something along the lines of:

pytestmark = pytest.mark.skipif(not which("sigrok-cli"),
reason="sigrok not available")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants