Skip to content

Make QEMU machine and cpu optional - #1484

Merged
Emantor merged 1 commit into
labgrid-project:masterfrom
sjg20:push3-qemu
Aug 26, 2026
Merged

Make QEMU machine and cpu optional#1484
Emantor merged 1 commit into
labgrid-project:masterfrom
sjg20:push3-qemu

Conversation

@sjg20

@sjg20 sjg20 commented Aug 22, 2024

Copy link
Copy Markdown
Contributor

This makes the QEMU driver's machine, cpu and extra_args parameters optional, since on x86 these are typically not specified. It allows a simpler configuration for x86 targets.

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • PR has been tested

Comment thread labgrid/driver/qemudriver.py Outdated
@codecov

codecov Bot commented Jan 20, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.2%. Comparing base (c7b407f) to head (2e81beb).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/driver/qemudriver.py 88.8% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1484   +/-   ##
======================================
  Coverage    61.1%   61.2%           
======================================
  Files         185     185           
  Lines       15230   15232    +2     
======================================
+ Hits         9319    9323    +4     
+ Misses       5911    5909    -2     
Flag Coverage Δ
3.10 61.1% <88.8%> (+<0.1%) ⬆️
3.11 61.1% <88.8%> (+<0.1%) ⬆️
3.12 61.1% <88.8%> (+<0.1%) ⬆️
3.13 61.1% <88.8%> (+<0.1%) ⬆️
3.14 61.1% <88.8%> (+<0.1%) ⬆️

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

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

@sjg20
sjg20 requested a review from Emantor February 21, 2025 17:08
sjg20 added a commit to sjg20/labgrid that referenced this pull request Apr 3, 2026
Cover the drivers, scripts, pytest and the Gitlab information.

Note: This PR exists just so others can replicate my lab. I have created
separate PRs for features and will dribble those in as they get reviewed:

labgrid-project#1482
labgrid-project#1483
labgrid-project#1484
labgrid-project#1571

Cover-letter:
U-Boot integration
END

Changes in v9:
- Rebase on upstream
- Add ~/.lgrc support for site-wide labgrid defaults
- Add automatic file logging via LG_LOG_DIR for both client and pytest
- Add timestamps and CI_JOB_ID to auto-log filenames
- Make log directories world-writable for multi-user sharing
- Enable automatic labgrid-client logging in lg-env
- Wait for USB resources instead of using a fixed sleep
- Extract _prepare_for_send() from _reset_for_send()
- Add get_send_driver_name() for USB resource discovery
- Reopen console when power-cycling for send
- Increase USB resource timeout and add power_off_delay
- Add support for the Badgerd SDWire mux
- Add QEMU disk-image and writer-arguments support for EFI
- Use snapshot mode for the QEMU EFI root disk
- Add check_lab.py for board reliability checking

Changes in v8:
- Fairly minor expansions to deal with new use cases

Changes in v6:
- Fix reference to crossbar in _ub-bisect-try and ub-smoke
- Add -x option to specify the extra board directory
- Add comments to the example lg-env
- Define USE_LABGRID to tell u-boot-hooks to use labgrid hooks
- Add a few more comments to ub-pyt
- Show the build path with ub-pyt -v
- Add --allow-unmatched to ub-smoke to avoid QEMU error
- Add a new section on compatibility
- Add a new section on script usage

Changes in v5:
- Rebase on latest grpc branch
- Fix pylint errors and warnings

Changes in v4:
- Support for Beagleplay, which needs files from two separate U-Boot
  builds
- Support for a 'recovery' button needed to boot the image
- Tidy up the internal-console support
- Fix pytest behaviour with an unpatched U-Boot (that doesn't have lab
  mode)

Changes in v3:
- Rebase on top of grpc branch
- Don't mess with terminal setting unless stdin is a terminal
- Don't show an error if there are no resources when auto-acquiring
- Support QEMU in UBootWriter

Some changes in v2:
- Rationalise the flags for the U-Boot scripts
- Support tracing with em100
- Support an internal terminal instead of microcom
- Add a -D flag for debugging
- Support send-only boards
- Add a way to build the U-Boot config
- Add a control for buildman's process-limit
- allow the build-dir to be specified in a variable
- add documentation about U-Boot-pytest integration
- add source_dir and config_file to UBootProviderDriver
- add an internal terminal
- expand the U-Boot scripts
- significantly improve the U-Boot-pytest integration

The approximate diffstat is:
 contrib/sync-places.py                |  23 +-
 contrib/u-boot/.gitignore             |   1 +
 contrib/u-boot/_ub-bisect-try         |  47 ++
 contrib/u-boot/conftest.py            |  21 +
 contrib/u-boot/get_args.sh            | 128 +++++
 contrib/u-boot/index.rst              | 232 +++++++++
 contrib/u-boot/lg-client              |  11 +
 contrib/u-boot/lg-env                 |  10 +
 contrib/u-boot/test_smoke.py          |   3 +
 contrib/u-boot/ub-bisect              |  44 ++
 contrib/u-boot/ub-cli                 |  39 ++
 contrib/u-boot/ub-int                 |  41 ++
 contrib/u-boot/ub-pyt                 |  69 +++
 contrib/u-boot/ub-smoke               |  48 ++
 doc/configuration.rst                 | 611 ++++++++++++++++++++++-
 doc/usage.rst                         | 288 +++++++++++
 labgrid/driver/__init__.py            |  10 +-
 labgrid/driver/common.py              |  11 +
 labgrid/driver/consoleexpectmixin.py  |   7 +
 labgrid/driver/powerdriver.py         |  29 ++
 labgrid/driver/qemudriver.py          |  84 ++--
 labgrid/driver/recoverydriver.py      |  25 +
 labgrid/driver/resetdriver.py         |   7 +
 labgrid/driver/servodriver.py         | 157 ++++++
 labgrid/driver/sfemulatordriver.py    | 102 ++++
 labgrid/driver/ubootdriver.py         |  27 +-
 labgrid/driver/ubootproviderdriver.py | 323 ++++++++++++
 labgrid/driver/ubootwriterdriver.py   | 160 ++++++
 labgrid/driver/usbhidrelay.py         |   7 +-
 labgrid/driver/usbloader.py           | 170 ++++++-
 labgrid/driver/usbstoragedriver.py    |  18 +-
 labgrid/factory.py                    |   4 +-
 labgrid/protocol/__init__.py          |   1 +
 labgrid/protocol/bootstrapprotocol.py |   8 +-
 labgrid/protocol/recoveryprotocol.py  |  14 +
 labgrid/protocol/resetprotocol.py     |  12 +
 labgrid/pytestplugin/fixtures.py      |  21 +-
 labgrid/pytestplugin/hooks.py         |   8 +
 labgrid/remote/client.py              | 351 ++++++++-----
 labgrid/remote/config.py              |   7 +-
 labgrid/remote/exporter.py            | 122 ++++-
 labgrid/resource/__init__.py          |   6 +
 labgrid/resource/remote.py            |  24 +
 labgrid/resource/servo.py             | 485 ++++++++++++++++++
 labgrid/resource/sfemulator.py        |  33 ++
 labgrid/resource/suggest.py           |   6 +
 labgrid/resource/udev.py              |  33 ++
 labgrid/strategy/ubootstrategy.py     | 151 +++++-
 labgrid/target.py                     | 120 ++++-
 labgrid/util/helper.py                | 220 ++++----
 labgrid/util/ssh.py                   |   3 +-
 labgrid/util/term.py                  | 184 +++++++
 labgrid/var_dict.py                   |   8 +
 man/labgrid-client.1                  |   6 +
 man/labgrid-client.rst                |   4 +
 man/labgrid-device-config.5           |   4 +
 56 files changed, 4267 insertions(+), 321 deletions(-)

[1] https://github.com/labgrid-project/labgrid/issues/created_by/sjg20

Signed-off-by: Simon Glass <sjg@chromium.org>
sjg20 added a commit to sjg20/labgrid that referenced this pull request May 3, 2026
Cover the drivers, scripts, pytest and the Gitlab information.

Note: This PR exists just so others can replicate my lab. I have created
separate PRs for features and will dribble those in as they get reviewed:

labgrid-project#1482
labgrid-project#1483
labgrid-project#1484
labgrid-project#1571

Cover-letter:
U-Boot integration
END

Changes in v9:
- Rebase on upstream
- Add ~/.lgrc support for site-wide labgrid defaults
- Add automatic file logging via LG_LOG_DIR for both client and pytest
- Add timestamps and CI_JOB_ID to auto-log filenames
- Make log directories world-writable for multi-user sharing
- Enable automatic labgrid-client logging in lg-env
- Wait for USB resources instead of using a fixed sleep
- Extract _prepare_for_send() from _reset_for_send()
- Add get_send_driver_name() for USB resource discovery
- Reopen console when power-cycling for send
- Increase USB resource timeout and add power_off_delay
- Add support for the Badgerd SDWire mux
- Add QEMU disk-image and writer-arguments support for EFI
- Use snapshot mode for the QEMU EFI root disk
- Add check_lab.py for board reliability checking

Changes in v8:
- Fairly minor expansions to deal with new use cases

Changes in v6:
- Fix reference to crossbar in _ub-bisect-try and ub-smoke
- Add -x option to specify the extra board directory
- Add comments to the example lg-env
- Define USE_LABGRID to tell u-boot-hooks to use labgrid hooks
- Add a few more comments to ub-pyt
- Show the build path with ub-pyt -v
- Add --allow-unmatched to ub-smoke to avoid QEMU error
- Add a new section on compatibility
- Add a new section on script usage

Changes in v5:
- Rebase on latest grpc branch
- Fix pylint errors and warnings

Changes in v4:
- Support for Beagleplay, which needs files from two separate U-Boot
  builds
- Support for a 'recovery' button needed to boot the image
- Tidy up the internal-console support
- Fix pytest behaviour with an unpatched U-Boot (that doesn't have lab
  mode)

Changes in v3:
- Rebase on top of grpc branch
- Don't mess with terminal setting unless stdin is a terminal
- Don't show an error if there are no resources when auto-acquiring
- Support QEMU in UBootWriter

Some changes in v2:
- Rationalise the flags for the U-Boot scripts
- Support tracing with em100
- Support an internal terminal instead of microcom
- Add a -D flag for debugging
- Support send-only boards
- Add a way to build the U-Boot config
- Add a control for buildman's process-limit
- allow the build-dir to be specified in a variable
- add documentation about U-Boot-pytest integration
- add source_dir and config_file to UBootProviderDriver
- add an internal terminal
- expand the U-Boot scripts
- significantly improve the U-Boot-pytest integration

The approximate diffstat is:
 contrib/sync-places.py                |  23 +-
 contrib/u-boot/.gitignore             |   1 +
 contrib/u-boot/_ub-bisect-try         |  47 ++
 contrib/u-boot/conftest.py            |  21 +
 contrib/u-boot/get_args.sh            | 128 +++++
 contrib/u-boot/index.rst              | 232 +++++++++
 contrib/u-boot/lg-client              |  11 +
 contrib/u-boot/lg-env                 |  10 +
 contrib/u-boot/test_smoke.py          |   3 +
 contrib/u-boot/ub-bisect              |  44 ++
 contrib/u-boot/ub-cli                 |  39 ++
 contrib/u-boot/ub-int                 |  41 ++
 contrib/u-boot/ub-pyt                 |  69 +++
 contrib/u-boot/ub-smoke               |  48 ++
 doc/configuration.rst                 | 611 ++++++++++++++++++++++-
 doc/usage.rst                         | 288 +++++++++++
 labgrid/driver/__init__.py            |  10 +-
 labgrid/driver/common.py              |  11 +
 labgrid/driver/consoleexpectmixin.py  |   7 +
 labgrid/driver/powerdriver.py         |  29 ++
 labgrid/driver/qemudriver.py          |  84 ++--
 labgrid/driver/recoverydriver.py      |  25 +
 labgrid/driver/resetdriver.py         |   7 +
 labgrid/driver/servodriver.py         | 157 ++++++
 labgrid/driver/sfemulatordriver.py    | 102 ++++
 labgrid/driver/ubootdriver.py         |  27 +-
 labgrid/driver/ubootproviderdriver.py | 323 ++++++++++++
 labgrid/driver/ubootwriterdriver.py   | 160 ++++++
 labgrid/driver/usbhidrelay.py         |   7 +-
 labgrid/driver/usbloader.py           | 170 ++++++-
 labgrid/driver/usbstoragedriver.py    |  18 +-
 labgrid/factory.py                    |   4 +-
 labgrid/protocol/__init__.py          |   1 +
 labgrid/protocol/bootstrapprotocol.py |   8 +-
 labgrid/protocol/recoveryprotocol.py  |  14 +
 labgrid/protocol/resetprotocol.py     |  12 +
 labgrid/pytestplugin/fixtures.py      |  21 +-
 labgrid/pytestplugin/hooks.py         |   8 +
 labgrid/remote/client.py              | 351 ++++++++-----
 labgrid/remote/config.py              |   7 +-
 labgrid/remote/exporter.py            | 122 ++++-
 labgrid/resource/__init__.py          |   6 +
 labgrid/resource/remote.py            |  24 +
 labgrid/resource/servo.py             | 485 ++++++++++++++++++
 labgrid/resource/sfemulator.py        |  33 ++
 labgrid/resource/suggest.py           |   6 +
 labgrid/resource/udev.py              |  33 ++
 labgrid/strategy/ubootstrategy.py     | 151 +++++-
 labgrid/target.py                     | 120 ++++-
 labgrid/util/helper.py                | 220 ++++----
 labgrid/util/ssh.py                   |   3 +-
 labgrid/util/term.py                  | 184 +++++++
 labgrid/var_dict.py                   |   8 +
 man/labgrid-client.1                  |   6 +
 man/labgrid-client.rst                |   4 +
 man/labgrid-device-config.5           |   4 +
 56 files changed, 4267 insertions(+), 321 deletions(-)

[1] https://github.com/labgrid-project/labgrid/issues/created_by/sjg20

Signed-off-by: Simon Glass <sjg@chromium.org>
@sjg20
sjg20 force-pushed the push3-qemu branch 2 times, most recently from cb2da68 to e8ee639 Compare July 28, 2026 14:58
@sjg20

sjg20 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

OK I have slimmed this down a bit so PTAL

@sjg20 sjg20 changed the title Minor QEMU tweaks for x86 and custom firmware Make QEMU machine, cpu and extra_args optional Jul 28, 2026
Emantor
Emantor previously approved these changes Jul 31, 2026
@Bastian-Krause Bastian-Krause changed the title Make QEMU machine, cpu and extra_args optional Make QEMU machine and cpu optional Aug 26, 2026

@Bastian-Krause Bastian-Krause left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Force-pushed:

  • drop extra_args handling as it is already optional
  • drop redundant doc example
  • improve docs

At least for x86 devices it is not necessary to provide these
arguments. Make them optional.

Add tests for the optional arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
[bst: drop extra_args handling as it is already optional, drop redundant
doc example, improve docs]
Signed-off-by: Bastian Krause <bst@pengutronix.de>
@Emantor
Emantor enabled auto-merge August 26, 2026 12:36
@Emantor
Emantor merged commit 8953d8f into labgrid-project:master Aug 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants