]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/selftest: Introduce OEQA_TESTDISPLAY variable and use for sdl/gtk qemu test
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 11 Mar 2026 09:24:56 +0000 (09:24 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 12 Mar 2026 22:05:43 +0000 (22:05 +0000)
Currently we've been using DISPLAY from the parent environment indiscriminately.
Since we can change many of the tests to use internal VNC, we really need a mechanism
to only use a DISPLAY when the system really needs to and there is no other option.
Somehow we need to differentiate between that and a system with graphics available.

Introduce OEQA_TESTDISPLAY for this purpose, this being used only if there is no other
way to run the test.

There is only one test case I'm aware of that needs this, so this patch updates
that test case.

This variable is not meant as a replacement for all DISLAY usage, it is only
for cases where the test would not otherwise work.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/runtime_test.py

index d58ffa80f51f3fdb91c9eeaa965cdeacaf0d15de..22b104883864be6b93b6c29447c46dfd91597781 100644 (file)
@@ -11,6 +11,7 @@ import os
 import tempfile
 import oe.lsb
 from oeqa.core.decorator.data import skipIfNotQemu, skipIfNotMachine
+from unittest import mock
 
 class TestExport(OESelftestTestCase):
 
@@ -226,8 +227,13 @@ TEST_RUNQEMUPARAMS += " slirp"
         Product: oe-core
         Author: Alexander Kanavin <alex.kanavin@gmail.com>
         """
-        if "DISPLAY" not in os.environ:
+
+        # Use OEQA_TESTDISPLAY if set, fallback to DISPLAY from os.environ
+        display = get_bb_var('OEQA_TESTDISPLAY') or os.environ.get("DISPLAY", None)
+
+        if not display:
             self.skipTest("virgl gtk test must be run inside a X session")
+
         distro = oe.lsb.distro_identifier()
         if distro and distro == 'debian-8':
             self.skipTest('virgl isn\'t working with Debian 8')
@@ -252,12 +258,14 @@ TEST_RUNQEMUPARAMS += " slirp"
         features += 'IMAGE_INSTALL:append = " kmscube"\n'
         features_gtk = features + 'TEST_RUNQEMUPARAMS += " gtk gl"\n'
         self.write_config(features_gtk)
-        bitbake('core-image-minimal')
-        bitbake('-c testimage core-image-minimal')
+        with mock.patch.dict(os.environ, {"DISPLAY": display}):
+            bitbake('core-image-minimal')
+            bitbake('-c testimage core-image-minimal')
         features_sdl = features + 'TEST_RUNQEMUPARAMS += " sdl gl"\n'
         self.write_config(features_sdl)
-        bitbake('core-image-minimal')
-        bitbake('-c testimage core-image-minimal')
+        with mock.patch.dict(os.environ, {"DISPLAY": display}):
+            bitbake('core-image-minimal')
+            bitbake('-c testimage core-image-minimal')
 
     @skipIfNotMachine("qemux86-64", "test needs qemux86-64")
     def test_testimage_virgl_headless(self):