diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2019-03-03 12:27:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-03-04 14:27:06 +0000 |
commit | d3c7d1a0366c12e576bc015449928ac96c78ca18 (patch) | |
tree | d02e42317a69fdccd5555f21567f6de5eacd943c /meta/lib/oeqa/selftest | |
parent | 258123faa06027046445ba13a3f12b0a0e33dfd8 (diff) | |
download | poky-d3c7d1a0366c12e576bc015449928ac96c78ca18.tar.gz |
selftest: add tests for virgl GL acceleration
Note that the tests require that the host machine has a X display,
has mesa development files installed and is able to create OpenGL contexts.
(From OE-Core rev: 2868e8dfb9e62b49cd06f6c2d010405079d3a71c)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/runtime_test.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 906e460d4f..6c25bb901d 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py | |||
@@ -6,6 +6,7 @@ import os | |||
6 | import re | 6 | import re |
7 | import tempfile | 7 | import tempfile |
8 | import shutil | 8 | import shutil |
9 | import oe.lsb | ||
9 | 10 | ||
10 | class TestExport(OESelftestTestCase): | 11 | class TestExport(OESelftestTestCase): |
11 | 12 | ||
@@ -168,6 +169,71 @@ class TestImage(OESelftestTestCase): | |||
168 | # remove the oeqa-feed-sign temporal directory | 169 | # remove the oeqa-feed-sign temporal directory |
169 | shutil.rmtree(self.gpg_home, ignore_errors=True) | 170 | shutil.rmtree(self.gpg_home, ignore_errors=True) |
170 | 171 | ||
172 | @OETestID(1883) | ||
173 | def test_testimage_virgl_gtk(self): | ||
174 | """ | ||
175 | Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend | ||
176 | Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled | ||
177 | 2. Check that kmscube demo runs without crashing. | ||
178 | Product: oe-core | ||
179 | Author: Alexander Kanavin <alex.kanavin@gmail.com> | ||
180 | """ | ||
181 | if "DISPLAY" not in os.environ: | ||
182 | self.skipTest("virgl gtk test must be run inside a X session") | ||
183 | distro = oe.lsb.distro_identifier() | ||
184 | if distro and distro == 'debian-8': | ||
185 | self.skipTest('virgl isn\'t working with Debian 8') | ||
186 | |||
187 | qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native') | ||
188 | features = 'INHERIT += "testimage"\n' | ||
189 | if 'gtk+' not in qemu_packageconfig: | ||
190 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " gtk+"\n' | ||
191 | if 'virglrenderer' not in qemu_packageconfig: | ||
192 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n' | ||
193 | if 'glx' not in qemu_packageconfig: | ||
194 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n' | ||
195 | features += 'TEST_SUITES = "ping ssh virgl"\n' | ||
196 | features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n' | ||
197 | features += 'IMAGE_INSTALL_append = " kmscube"\n' | ||
198 | features += 'TEST_RUNQEMUPARAMS = "gtk-gl"\n' | ||
199 | self.write_config(features) | ||
200 | bitbake('core-image-minimal') | ||
201 | bitbake('-c testimage core-image-minimal') | ||
202 | |||
203 | @OETestID(1883) | ||
204 | def test_testimage_virgl_headless(self): | ||
205 | """ | ||
206 | Summary: Check host-assisted accelerate OpenGL functionality in qemu with egl-headless frontend | ||
207 | Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled | ||
208 | 2. Check that kmscube demo runs without crashing. | ||
209 | Product: oe-core | ||
210 | Author: Alexander Kanavin <alex.kanavin@gmail.com> | ||
211 | """ | ||
212 | import subprocess, os | ||
213 | try: | ||
214 | content = os.listdir("/dev/dri") | ||
215 | if len([i for i in content if i.startswith('render')]) == 0: | ||
216 | self.skipTest("No render nodes found in /dev/dri: %s" %(content)) | ||
217 | except FileNotFoundError: | ||
218 | self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.") | ||
219 | try: | ||
220 | dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True) | ||
221 | except subprocess.CalledProcessError as e: | ||
222 | self.skipTest("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.") | ||
223 | qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native') | ||
224 | features = 'INHERIT += "testimage"\n' | ||
225 | if 'virglrenderer' not in qemu_packageconfig: | ||
226 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n' | ||
227 | if 'glx' not in qemu_packageconfig: | ||
228 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n' | ||
229 | features += 'TEST_SUITES = "ping ssh virgl"\n' | ||
230 | features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n' | ||
231 | features += 'IMAGE_INSTALL_append = " kmscube"\n' | ||
232 | features += 'TEST_RUNQEMUPARAMS = "egl-headless"\n' | ||
233 | self.write_config(features) | ||
234 | bitbake('core-image-minimal') | ||
235 | bitbake('-c testimage core-image-minimal') | ||
236 | |||
171 | class Postinst(OESelftestTestCase): | 237 | class Postinst(OESelftestTestCase): |
172 | @OETestID(1540) | 238 | @OETestID(1540) |
173 | @OETestID(1545) | 239 | @OETestID(1545) |