oeqa/selftest: Introduce OEQA_TESTDISPLAY variable and use for sdl/gtk qemu test
PATCH 1/1 oeqa/selftest: Introduce OEQA_TESTDISPLAY variable and use for sdl/gtk qemu test
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.
--- meta/lib/oeqa/selftest/cases/runtime_test.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
meta/lib/oeqa/selftest/cases/runtime_test.py +13 -5
@@ -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):