* [PATCH] fixup! test: add support for pytest --graphic
@ 2025-08-06 16:32 Ahmad Fatoum
2025-08-07 5:12 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2025-08-06 16:32 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
test: qemu: pass -nographic in the default case.
Otherwise, we end up with an error message if the default is to use a
graphic backend.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
conftest.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/conftest.py b/conftest.py
index 45e8835924b3..e8de5952efb4 100644
--- a/conftest.py
+++ b/conftest.py
@@ -116,9 +116,10 @@ def strategy(request, target, pytestconfig):
else:
pytest.exit("barebox currently supports only a single extra virtio console\n", 1)
- graphics = None
- if pytestconfig.option.qemu_graphics:
- if qemu_bin == "qemu-system-x86_64":
+ if qemu_bin is not None:
+ if not pytestconfig.option.qemu_graphics:
+ graphics = '-nographic'
+ elif qemu_bin == "qemu-system-x86_64":
graphics = '-device isa-vga'
elif 'pci' in features:
graphics = '-device VGA'
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] test: add support for pytest --graphic
@ 2025-07-08 19:36 Ahmad Fatoum
2025-08-06 6:19 ` [PATCH] fixup! " Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2025-07-08 19:36 UTC (permalink / raw)
To: barebox; +Cc: Dang Huynh, Ahmad Fatoum
This new option will take care to provide a suitable graphics device.
How it's displayed can be customized via --qemu -display $OUTPUT.
For this to work, we must instruct labgrid not to set -nographic or
-display itself, which is possible via setting qemu-default since
Labgrid v25.0.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
Documentation/boards/emulated.rst | 3 +++
conftest.py | 20 ++++++++++++++++++-
test/arm/a15@multi_v7_defconfig.yaml | 1 +
test/arm/a9@multi_v7_defconfig.yaml | 1 +
.../qemu-raspi0@multi_v5_v6_defconfig.yaml | 1 +
.../qemu-raspi1ap@multi_v5_v6_defconfig.yaml | 1 +
test/arm/qemu-raspi2b@multi_v7_defconfig.yaml | 1 +
test/arm/qemu-raspi3b@multi_v8_defconfig.yaml | 1 +
.../qemu-sabrelite@multi_v7_defconfig.yaml | 1 +
test/arm/virt@multi_v7_defconfig.yaml | 1 +
test/arm/virt@multi_v8_defconfig.yaml | 1 +
test/mips/be@qemu-malta_defconfig.yaml | 1 +
test/mips/qemu-malta64el_defconfig.yaml | 1 +
test/mips/qemu-maltael_defconfig.yaml | 1 +
test/openrisc/generic_defconfig.yaml | 1 +
test/riscv/qemu-virt64@rv64i_defconfig.yaml | 1 +
test/riscv/qemu@virt32_defconfig.yaml | 1 +
test/riscv/sifive@rv64i_defconfig.yaml | 1 +
test/x86/pc@efi_defconfig.yaml | 1 +
test/x86/q35@efi_defconfig.yaml | 1 +
test/x86/virtio@efi_defconfig.yaml | 1 +
21 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/Documentation/boards/emulated.rst b/Documentation/boards/emulated.rst
index 602def560120..dbc869546e2f 100644
--- a/Documentation/boards/emulated.rst
+++ b/Documentation/boards/emulated.rst
@@ -59,6 +59,9 @@ more easily::
# Run tests and pass a block device (here /dev/virtioblk0)
pytest --lg-env test/arm/virt@multi_v8_defconfig.yaml --blk=rootfs.ext4
+ # Run interactively with graphics output
+ pytest --lg-env test/mips/qemu-malta_defconfig.yaml --interactive --graphics
+
For testing, the QEMU fw_cfg and virtfs support is particularly useful::
# inject boot.sh file in working directory into barebox environment
diff --git a/conftest.py b/conftest.py
index 0cdae2126bfd..9131b843d4e4 100644
--- a/conftest.py
+++ b/conftest.py
@@ -51,6 +51,8 @@ def pytest_addoption(parser):
parser.addoption('--dump-dtb', action='store_const', const='qemu_dump_dtb',
dest='lg_initial_state',
help=('(for debugging) skip tests and just dump the Qemu device tree'))
+ parser.addoption('--graphic', '--graphics', action='store_true', dest='qemu_graphics',
+ help=('enable QEMU graphics output'))
parser.addoption('--rng', action='count', dest='qemu_rng',
help=('instantiate Virt I/O random number generator'))
parser.addoption('--console', action='count', dest='qemu_console', default=0,
@@ -77,9 +79,12 @@ def strategy(request, target, pytestconfig):
pytest.exit(e)
try:
- features = target.env.config.data["targets"]["main"]["features"]
+ main = target.env.config.data["targets"]["main"]
+ features = main["features"]
+ qemu_bin = main["drivers"]["QEMUDriver"]["qemu_bin"]
except KeyError:
features = []
+ qemu_bin = None
virtio = None
@@ -111,6 +116,19 @@ def strategy(request, target, pytestconfig):
else:
pytest.exit("barebox currently supports only a single extra virtio console\n", 1)
+ graphics = None
+ if pytestconfig.option.qemu_graphics:
+ if qemu_bin == "qemu-system-x86_64":
+ graphics = '-device isa-vga'
+ elif 'pci' in features:
+ graphics = '-device VGA'
+ elif virtio:
+ graphics = '-vga none -device ramfb'
+ else:
+ pytest.exit("--graphics unsupported for target\n", 1)
+
+ strategy.append_qemu_args(graphics or '-nographic')
+
for i, blk in enumerate(pytestconfig.option.qemu_block):
if virtio:
strategy.append_qemu_args(
diff --git a/test/arm/a15@multi_v7_defconfig.yaml b/test/arm/a15@multi_v7_defconfig.yaml
index c7c3e3b0af49..d62c8e5c414f 100644
--- a/test/arm/a15@multi_v7_defconfig.yaml
+++ b/test/arm/a15@multi_v7_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: cortex-a15
memory: 1024M
bios: barebox-vexpress-ca15.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/arm/a9@multi_v7_defconfig.yaml b/test/arm/a9@multi_v7_defconfig.yaml
index 21ce4202cf90..6b5528978831 100644
--- a/test/arm/a9@multi_v7_defconfig.yaml
+++ b/test/arm/a9@multi_v7_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: cortex-a9
memory: 1024M
bios: barebox-vexpress-ca9.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/arm/qemu-raspi0@multi_v5_v6_defconfig.yaml b/test/arm/qemu-raspi0@multi_v5_v6_defconfig.yaml
index 9cad68225e1e..f9480a44b5f5 100644
--- a/test/arm/qemu-raspi0@multi_v5_v6_defconfig.yaml
+++ b/test/arm/qemu-raspi0@multi_v5_v6_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: arm1176
memory: 512M
kernel: barebox-raspberry-pi.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/arm/qemu-raspi1ap@multi_v5_v6_defconfig.yaml b/test/arm/qemu-raspi1ap@multi_v5_v6_defconfig.yaml
index cbd0686ebd71..62bbd20b6d56 100644
--- a/test/arm/qemu-raspi1ap@multi_v5_v6_defconfig.yaml
+++ b/test/arm/qemu-raspi1ap@multi_v5_v6_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: arm1176
memory: 512M
kernel: barebox-raspberry-pi.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/arm/qemu-raspi2b@multi_v7_defconfig.yaml b/test/arm/qemu-raspi2b@multi_v7_defconfig.yaml
index 6dc91984ecca..d6841d8d65d9 100644
--- a/test/arm/qemu-raspi2b@multi_v7_defconfig.yaml
+++ b/test/arm/qemu-raspi2b@multi_v7_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: cortex-a7
memory: 1G
kernel: barebox-raspberry-pi.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/arm/qemu-raspi3b@multi_v8_defconfig.yaml b/test/arm/qemu-raspi3b@multi_v8_defconfig.yaml
index 4f591ba21596..fddd19757094 100644
--- a/test/arm/qemu-raspi3b@multi_v8_defconfig.yaml
+++ b/test/arm/qemu-raspi3b@multi_v8_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: cortex-a53
memory: 1G
kernel: barebox-raspberry-pi.img
+ display: qemu-default
extra_args: "\
-serial chardev:serial2 \
-chardev socket,id=serial2,host=localhost,port=2302,nodelay=on,server=on,wait=off"
diff --git a/test/arm/qemu-sabrelite@multi_v7_defconfig.yaml b/test/arm/qemu-sabrelite@multi_v7_defconfig.yaml
index 8dc137ee44dc..ee146018f29c 100644
--- a/test/arm/qemu-sabrelite@multi_v7_defconfig.yaml
+++ b/test/arm/qemu-sabrelite@multi_v7_defconfig.yaml
@@ -8,6 +8,7 @@ targets:
memory: 1024M
kernel: barebox-dt-2nd.img
dtb: imx6q-sabreliste.dtb
+ display: qemu-default
extra_args: '-nographic -serial null'
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
diff --git a/test/arm/virt@multi_v7_defconfig.yaml b/test/arm/virt@multi_v7_defconfig.yaml
index d22b67cb31a8..891581205898 100644
--- a/test/arm/virt@multi_v7_defconfig.yaml
+++ b/test/arm/virt@multi_v7_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: cortex-a7
memory: 1024M
kernel: barebox-dt-2nd.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/arm/virt@multi_v8_defconfig.yaml b/test/arm/virt@multi_v8_defconfig.yaml
index 0c73591e4513..46caf8820f00 100644
--- a/test/arm/virt@multi_v8_defconfig.yaml
+++ b/test/arm/virt@multi_v8_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: cortex-a57
memory: 1024M
kernel: barebox-dt-2nd.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/mips/be@qemu-malta_defconfig.yaml b/test/mips/be@qemu-malta_defconfig.yaml
index 2f6de8a43a8f..a3d34a660dfb 100644
--- a/test/mips/be@qemu-malta_defconfig.yaml
+++ b/test/mips/be@qemu-malta_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: M14Kc
memory: 256M
bios: barebox-qemu-malta.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/mips/qemu-malta64el_defconfig.yaml b/test/mips/qemu-malta64el_defconfig.yaml
index 61318f491aa8..5562f59dc7d5 100644
--- a/test/mips/qemu-malta64el_defconfig.yaml
+++ b/test/mips/qemu-malta64el_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: 5KEf
memory: 256M
bios: barebox-qemu-malta.img.swapped
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/mips/qemu-maltael_defconfig.yaml b/test/mips/qemu-maltael_defconfig.yaml
index 0571d1b4d495..6cfe99a01633 100644
--- a/test/mips/qemu-maltael_defconfig.yaml
+++ b/test/mips/qemu-maltael_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: M14Kc
memory: 256M
bios: barebox-qemu-malta.img.swapped
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/openrisc/generic_defconfig.yaml b/test/openrisc/generic_defconfig.yaml
index 3d2cd5f9550f..16310093bc0b 100644
--- a/test/openrisc/generic_defconfig.yaml
+++ b/test/openrisc/generic_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: or1200
memory: 256M
kernel: barebox
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/riscv/qemu-virt64@rv64i_defconfig.yaml b/test/riscv/qemu-virt64@rv64i_defconfig.yaml
index f6497de85e54..7f86d9ac7de0 100644
--- a/test/riscv/qemu-virt64@rv64i_defconfig.yaml
+++ b/test/riscv/qemu-virt64@rv64i_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: rv64
memory: 256M
kernel: barebox-dt-2nd.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/riscv/qemu@virt32_defconfig.yaml b/test/riscv/qemu@virt32_defconfig.yaml
index 58a4f918958b..7860e97c5260 100644
--- a/test/riscv/qemu@virt32_defconfig.yaml
+++ b/test/riscv/qemu@virt32_defconfig.yaml
@@ -8,6 +8,7 @@ targets:
memory: 256M
kernel: barebox-dt-2nd.img
bios: opensbi-riscv32-generic-fw_dynamic.bin
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/riscv/sifive@rv64i_defconfig.yaml b/test/riscv/sifive@rv64i_defconfig.yaml
index a35229bddb34..0b90507f9c3e 100644
--- a/test/riscv/sifive@rv64i_defconfig.yaml
+++ b/test/riscv/sifive@rv64i_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: sifive-u54
memory: 256M
kernel: barebox-hifive-unleashed.img
+ display: qemu-default
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
diff --git a/test/x86/pc@efi_defconfig.yaml b/test/x86/pc@efi_defconfig.yaml
index ae06fbf69744..632e72ea7bd9 100644
--- a/test/x86/pc@efi_defconfig.yaml
+++ b/test/x86/pc@efi_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: Nehalem
memory: 1024M
kernel: barebox.efi
+ display: qemu-default
extra_args: '-bios OVMF.fd'
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
diff --git a/test/x86/q35@efi_defconfig.yaml b/test/x86/q35@efi_defconfig.yaml
index 578a3654fe9b..be56a36151c6 100644
--- a/test/x86/q35@efi_defconfig.yaml
+++ b/test/x86/q35@efi_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: Nehalem
memory: 1024M
kernel: barebox.efi
+ display: qemu-default
extra_args: '-bios OVMF.fd -global ICH9-LPC.noreboot=false'
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
diff --git a/test/x86/virtio@efi_defconfig.yaml b/test/x86/virtio@efi_defconfig.yaml
index 9ff4ff5a4e5a..0f6b8d2b17de 100644
--- a/test/x86/virtio@efi_defconfig.yaml
+++ b/test/x86/virtio@efi_defconfig.yaml
@@ -7,6 +7,7 @@ targets:
cpu: Nehalem
memory: 1024M
kernel: barebox.efi
+ display: qemu-default
extra_args: '-bios OVMF.fd'
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] fixup! test: add support for pytest --graphic
2025-07-08 19:36 [PATCH 4/4] " Ahmad Fatoum
@ 2025-08-06 6:19 ` Sascha Hauer
2025-08-06 6:20 ` Sascha Hauer
2025-08-06 7:40 ` Ahmad Fatoum
0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2025-08-06 6:19 UTC (permalink / raw)
To: Barebox List
Supply qemu options only for qemu targets. Otherwise
labgrid-pytest --lg-env test/sandbox/sandbox_defconfig.yaml
fails with:
_pytest.outcomes.Exit: Qemu option supplied for non-Qemu targe
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
conftest.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conftest.py b/conftest.py
index e3f09bac31..782ebc0536 100644
--- a/conftest.py
+++ b/conftest.py
@@ -125,7 +125,7 @@ def strategy(request, target, pytestconfig):
else:
pytest.exit("--graphics unsupported for target\n", 1)
- strategy.append_qemu_args(graphics or '-nographic')
+ strategy.append_qemu_args(graphics)
for i, blk in enumerate(pytestconfig.option.qemu_block):
if virtio:
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fixup! test: add support for pytest --graphic
2025-08-06 6:19 ` [PATCH] fixup! " Sascha Hauer
@ 2025-08-06 6:20 ` Sascha Hauer
2025-08-06 7:40 ` Ahmad Fatoum
1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2025-08-06 6:20 UTC (permalink / raw)
To: Barebox List; +Cc: Ahmad Fatoum
On Wed, Aug 06, 2025 at 08:19:14AM +0200, Sascha Hauer wrote:
> Supply qemu options only for qemu targets. Otherwise
>
> labgrid-pytest --lg-env test/sandbox/sandbox_defconfig.yaml
>
> fails with:
>
> _pytest.outcomes.Exit: Qemu option supplied for non-Qemu targe
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> conftest.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/conftest.py b/conftest.py
> index e3f09bac31..782ebc0536 100644
> --- a/conftest.py
> +++ b/conftest.py
> @@ -125,7 +125,7 @@ def strategy(request, target, pytestconfig):
> else:
> pytest.exit("--graphics unsupported for target\n", 1)
>
> - strategy.append_qemu_args(graphics or '-nographic')
> + strategy.append_qemu_args(graphics)
>
> for i, blk in enumerate(pytestconfig.option.qemu_block):
> if virtio:
Ahmad, is this ok like this?
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fixup! test: add support for pytest --graphic
2025-08-06 6:19 ` [PATCH] fixup! " Sascha Hauer
2025-08-06 6:20 ` Sascha Hauer
@ 2025-08-06 7:40 ` Ahmad Fatoum
1 sibling, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2025-08-06 7:40 UTC (permalink / raw)
To: Sascha Hauer, Barebox List
On 06.08.25 08:19, Sascha Hauer wrote:
> Supply qemu options only for qemu targets. Otherwise
>
> labgrid-pytest --lg-env test/sandbox/sandbox_defconfig.yaml
>
> fails with:
>
> _pytest.outcomes.Exit: Qemu option supplied for non-Qemu targe
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Thanks for fixing,
Ahmad
> ---
> conftest.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/conftest.py b/conftest.py
> index e3f09bac31..782ebc0536 100644
> --- a/conftest.py
> +++ b/conftest.py
> @@ -125,7 +125,7 @@ def strategy(request, target, pytestconfig):
> else:
> pytest.exit("--graphics unsupported for target\n", 1)
>
> - strategy.append_qemu_args(graphics or '-nographic')
> + strategy.append_qemu_args(graphics)
>
> for i, blk in enumerate(pytestconfig.option.qemu_block):
> if virtio:
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-07 5:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-06 16:32 [PATCH] fixup! test: add support for pytest --graphic Ahmad Fatoum
2025-08-07 5:12 ` Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2025-07-08 19:36 [PATCH 4/4] " Ahmad Fatoum
2025-08-06 6:19 ` [PATCH] fixup! " Sascha Hauer
2025-08-06 6:20 ` Sascha Hauer
2025-08-06 7:40 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox