[PATCH 5/7] test: conftest: set -display none when non-interactive

Ahmad Fatoum
2026-04-13T07:46:06Z

When running QEMU with --graphic, but in a non graphical session,
running QEMU may fail because it fails to start e.g. the GTK window.

Allow headless tests for these configurations by adding -display none.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
conftest.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/conftest.py b/conftest.py
index 6bf92f3afed7..d02e5aff998f 100644
--- a/conftest.py
+++ b/conftest.py
@@ -215,6 +215,10 @@ def strategy(request, target, pytestconfig): # noqa: max-complexity=30
else:
pytest.exit("--graphics unsupported for target\n", 1)

+ if graphics is not None and \
+ pytestconfig.option.lg_initial_state != 'qemu_interactive':
+ graphics += ' -display none'
+
strategy.append_qemu_args(graphics)

for i, blk in enumerate(pytestconfig.option.qemu_block):
--
2.47.3