Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 19/20] selftest: add tests for virgl GL acceleration
Date: Wed, 30 Jan 2019 11:59:42 +0100	[thread overview]
Message-ID: <bd044cb2ccf44034331f35903d5da7d984647fc8.1548845917.git.alex.kanavin@gmail.com> (raw)
In-Reply-To: <cover.1548845917.git.alex.kanavin@gmail.com>

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.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
 meta-selftest/lib/oeqa/runtime/cases/virgl.py | 28 +++++++++++
 meta/lib/oeqa/selftest/cases/runtime_test.py  | 50 +++++++++++++++++++
 2 files changed, 78 insertions(+)
 create mode 100644 meta-selftest/lib/oeqa/runtime/cases/virgl.py

diff --git a/meta-selftest/lib/oeqa/runtime/cases/virgl.py b/meta-selftest/lib/oeqa/runtime/cases/virgl.py
new file mode 100644
index 00000000000..cc25e77d9c0
--- /dev/null
+++ b/meta-selftest/lib/oeqa/runtime/cases/virgl.py
@@ -0,0 +1,28 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+import subprocess
+import oe
+
+class VirglTest(OERuntimeTestCase):
+
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_kernel_driver(self):
+        status, output = self.target.run('dmesg|grep virgl')
+        self.assertEqual(status, 0, "Checking for virgl driver in dmesg returned non-zero: %d\n%s" % (status, output))
+        self.assertIn("virgl 3d acceleration enabled", output, "virgl acceleration seems to be disabled:\n%s" %(output))
+
+    @OETestDepends(['virgl.VirglTest.test_kernel_driver'])
+    def test_kmscube(self):
+        from fnmatch import fnmatch
+
+        try:
+            distro = oe.lsb.distro_identifier()
+        except Exception:
+            distro = None
+
+        if distro and fnmatch(distro, 'centos-7'):
+            self.skipTest('kmscube is not working when centos 7 is the host OS')
+
+        status, output = self.target.run('kmscube', timeout=30)
+        self.assertEqual(status, 0, "kmscube exited with non-zero status %d and output:\n%s" %(status, output))
+        self.assertIn('renderer: "virgl"', output, "kmscube does not seem to use virgl:\n%s" %(output))
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index 906e460d4f8..f43b1286ccf 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -168,6 +168,56 @@ class TestImage(OESelftestTestCase):
         # remove the oeqa-feed-sign temporal directory
         shutil.rmtree(self.gpg_home, ignore_errors=True)
 
+    @OETestID(1883)
+    def test_testimage_virgl_gtk(self):
+        """
+        Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend
+        Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled
+                  2. Check that kmscube demo runs without crashing.
+        Product: oe-core
+        Author: Alexander Kanavin <alex.kanavin@gmail.com>
+        """
+        if "DISPLAY" not in os.environ:
+            self.skipTest("virgl gtk test must be run inside a X session")
+        features = 'INHERIT += "testimage"\n'
+        features += 'PACKAGECONFIG_append_pn-qemu-native = " gtk+"\n'
+        features += 'TEST_SUITES = "ping ssh virgl"\n'
+        features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n'
+        features += 'IMAGE_INSTALL_append = " kmscube"\n'
+        features += 'TEST_RUNQEMUPARAMS = "gl"\n'
+        self.write_config(features)
+        bitbake('core-image-minimal')
+        bitbake('-c testimage core-image-minimal')
+
+    @OETestID(1883)
+    def test_testimage_virgl_headless(self):
+        """
+        Summary: Check host-assisted accelerate OpenGL functionality in qemu with egl-headless frontend
+        Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled
+                  2. Check that kmscube demo runs without crashing.
+        Product: oe-core
+        Author: Alexander Kanavin <alex.kanavin@gmail.com>
+        """
+        import subprocess, os
+        try:
+            content = os.listdir("/dev/dri")
+            if len([i for i in content if i.startswith('render')]) == 0:
+                self.skipTest("No render nodes found in /dev/dri: %s" %(content))
+        except FileNotFoundError:
+            self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.")
+        try:
+            dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True)
+        except subprocess.CalledProcessError as e:
+            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.")
+        features = 'INHERIT += "testimage"\n'
+        features += 'TEST_SUITES = "ping ssh virgl"\n'
+        features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n'
+        features += 'IMAGE_INSTALL_append = " kmscube"\n'
+        features += 'TEST_RUNQEMUPARAMS = "egl-headless"\n'
+        self.write_config(features)
+        bitbake('core-image-minimal')
+        bitbake('-c testimage core-image-minimal')
+
 class Postinst(OESelftestTestCase):
     @OETestID(1540)
     @OETestID(1545)
-- 
2.17.1



  parent reply	other threads:[~2019-01-30 11:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 10:59 [PATCH 00/20] Enable accelerated OpenGL in qemu Alexander Kanavin
2019-01-30 10:59 ` [PATCH 01/20] gtk+3: enable native/nativesdk variant Alexander Kanavin
2019-01-30 10:59 ` [PATCH 02/20] gtk+3: remove the gtk-icon-utils-native recipe Alexander Kanavin
2019-01-30 10:59 ` [PATCH 03/20] mesa: enable native and nativesdk variants Alexander Kanavin
2019-01-30 10:59 ` [PATCH 04/20] default-providers: set mesa as default provider for nativesdk-mesa Alexander Kanavin
2019-01-30 10:59 ` [PATCH 05/20] virglrenderer: add a recipe Alexander Kanavin
2019-01-30 10:59 ` [PATCH 06/20] qemu: enable virglrenderer and glx options for native/nativesdk builds Alexander Kanavin
2019-01-30 10:59 ` [PATCH 07/20] qemu: drop --with-gtkabi option, as it is no longer supported Alexander Kanavin
2019-01-30 10:59 ` [PATCH 08/20] local.conf.sample: adjust the qemu config to enable gtk+ instead of sdl Alexander Kanavin
2019-01-30 10:59 ` [PATCH 09/20] qemu: build target variant with gtk+, and nativesdk variant without sdl Alexander Kanavin
2019-01-30 10:59 ` [PATCH 10/20] qemu: remove support for building against host sdl Alexander Kanavin
2019-01-30 10:59 ` [PATCH 11/20] atk: disable gobject-introspection for nativesdk Alexander Kanavin
2019-01-30 10:59 ` [PATCH 12/20] qemu: add a gettext-native dependency to gtk option Alexander Kanavin
2019-01-30 10:59 ` [PATCH 13/20] libjpeg-turbo: fix nativesdk build in same way as native builds are Alexander Kanavin
2019-01-30 10:59 ` [PATCH 14/20] qemu: add a patch to avoid a missing definition error Alexander Kanavin
2019-01-30 10:59 ` [PATCH 15/20] qemu: add environment variable wrappers to make qemu look good with gtk frontend Alexander Kanavin
2019-01-30 10:59 ` [PATCH 16/20] qemu: add a backported patch to fix egl-headless support Alexander Kanavin
2019-01-30 10:59 ` [PATCH 17/20] runqemu: add options for enabling virgl GL acceleration Alexander Kanavin
2019-01-30 10:59 ` [PATCH 18/20] runqemu: do not check for GL libraries Alexander Kanavin
2019-01-30 10:59 ` Alexander Kanavin [this message]
2019-01-30 10:59 ` [PATCH 20/20] vte: allow building vte-native with gcc 4.8 Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd044cb2ccf44034331f35903d5da7d984647fc8.1548845917.git.alex.kanavin@gmail.com \
    --to=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox