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 <[email protected]> --- meta/lib/oeqa/selftest/cases/runtime_test.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 463dcc53967..4ea68fad7cc 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -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 <[email protected]> """ - 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):
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#232856): https://lists.openembedded.org/g/openembedded-core/message/232856 Mute This Topic: https://lists.openembedded.org/mt/118257298/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
