Skip to content

Commit

Permalink
qemudriver: add a qemu-default display option
Browse files Browse the repository at this point in the history
The barebox test suite adds an --interactive option to pytest, which
allows starting QEMU interactively with the Labgrid Environment YAML to
allow manual testing.

So far, it wasn't possible to use this with an interactive graphic output,
because Labgrid allowed only headless displays or none.

none is the default and will configure QEMU with -nographic, which
can not be overridden later on and -display also has no default value.

To support this use case, add a qemu-default option, which instructs
Labgrid to not touch -nographic and -display at all.

Signed-off-by: Ahmad Fatoum <[email protected]>
  • Loading branch information
a3f committed Jan 7, 2025
1 parent ac097c1 commit bd60c1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ more performant and the import times are shorter.
New Features in 24.1
~~~~~~~~~~~~~~~~~~~~
- All components can be installed into the same virtualenv again.
- The `QEMUDriver` now supports setting the ``display`` option to
``qemu-default``, which will neither set the QEMU ``-display`` option
or pass along ``-nographic``.

Bug fixes in 24.1
~~~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,7 @@ Arguments:
- none: Do not create a display device
- fb-headless: Create a headless framebuffer device
- egl-headless: Create a headless GPU-backed graphics card. Requires host support
- qemu-default: Don't override QEMU default settings

- nic (str): optional, configuration string to pass to QEMU to create a network interface

Expand Down
7 changes: 5 additions & 2 deletions labgrid/driver/qemudriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
none: Do not create a display device
fb-headless: Create a headless framebuffer device
egl-headless: Create a headless GPU-backed graphics card. Requires host support
qemu-default: Don't override QEMU default settings
nic (str): optional, configuration string to pass to QEMU to create a network interface
"""
qemu_bin = attr.ib(validator=attr.validators.instance_of(str))
Expand Down Expand Up @@ -85,7 +86,9 @@ class QEMUDriver(ConsoleExpectMixin, Driver, PowerProtocol, ConsoleProtocol):
default="none",
validator=attr.validators.optional(attr.validators.and_(
attr.validators.instance_of(str),
attr.validators.in_(["none", "fb-headless", "egl-headless"]),
attr.validators.in_(
["none", "fb-headless", "egl-headless", "qemu-default"]
),
))
)
nic = attr.ib(
Expand Down Expand Up @@ -211,7 +214,7 @@ def get_qemu_base_args(self):
cmd.append("virtio")
cmd.append("-display")
cmd.append("egl-headless")
else:
elif self.display != "qemu-default":
raise ExecutionError(f"Unknown display '{self.display}'")

if self.nic:
Expand Down

0 comments on commit bd60c1c

Please sign in to comment.