From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mail.openembedded.org (Postfix) with ESMTP id 205BD7CC46 for ; Thu, 28 Feb 2019 13:15:21 +0000 (UTC) Received: by mail-wm1-f51.google.com with SMTP id g20so8124906wmh.5 for ; Thu, 28 Feb 2019 05:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JhTF8M79NNdWaJf+3HDEpkyIrwkX9BnCKBdCINNuB9g=; b=oyyiP5VRK2dcmNBx8LnFgMEdpZ0ZOXYG1XoYL+97mdt8Jcd0xU4PeVSYRe4FurIYm+ kp7tciKICyFEKSlxa1pny36FhFTF+AZTYHe4VGBAya9LdnS/Scb4gnBZqzVYoZY0/NGn 2YN05V4MH5I9VSjRwwNQZ/iU7c47CJPcZtOOg1KOhyI+DmlAvoysU/TlfockN1ChZhQc 5XntnYLnWJQiWXXARRVune1E7Mfn7GRlbQkn8uqy43EQrHuZyXQ2Lz9vgqN9tnm2OzJ2 2r0HNqUokmwznK559QE8YVuy4DH2bZ+hHSc/WZGauNMDA8qmvH2V8WnZSic4wv8ckvCN PG0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JhTF8M79NNdWaJf+3HDEpkyIrwkX9BnCKBdCINNuB9g=; b=XlzPK83XsD2wvpUyDftEI+FDZZO5seZy8fOMcGFuH4PHiaKzA+C6XKZtpkzVWdBCyb nzRZcPPYxdAQ8/yipjcfJSeC/BdhfFOXhjZB3nHKZrgQWVphGHFyhiv1s0x5GlOwZA/w BYX+lJv3HahKONCKtwhjVqiQj2QGtwoBPxeoH7m7q38HgRIkpT7hCa2egzYmAFvftmjl 3kaevi9vqCArEJxpbvtDftzTppudxTKASyqUookpVoHy/xSOb2EpD1kqBWEtM+/JT3o1 IaGe1Ci9x5ccW2R11E5XpszgVIYaowgcwwHe8P2Iay0j9HSC9ReP+/aW6yTprMpqWrzg AiVQ== X-Gm-Message-State: APjAAAUea5iLRu+QBXucrIg2VcxKwSR8sdPbSyS4KG5TUt4PBBBSPHIG QucwQHRNeCR9JV5tPXbCxVNL+Bti X-Google-Smtp-Source: APXvYqwe5bh8+WUIYw1AmQjLPoTpqRTFdfVTDs3ZGcBQywAPOFp7lMdFqe05KSMjGabu0Oc84iNZTw== X-Received: by 2002:a1c:9c0e:: with SMTP id f14mr3017122wme.78.1551359721541; Thu, 28 Feb 2019 05:15:21 -0800 (PST) Received: from alexander-box.luxoft.com ([62.96.135.139]) by smtp.gmail.com with ESMTPSA id c17sm13644910wrs.17.2019.02.28.05.15.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:15:20 -0800 (PST) From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Date: Thu, 28 Feb 2019 14:15:08 +0100 Message-Id: <20190228131510.43557-6-alex.kanavin@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190228131510.43557-1-alex.kanavin@gmail.com> References: <20190228131510.43557-1-alex.kanavin@gmail.com> Subject: [PATCH 6/8] selftest: add tests for virgl GL acceleration X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 13:15:21 -0000 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 --- meta-selftest/lib/oeqa/runtime/cases/virgl.py | 28 ++++++++++ meta/lib/oeqa/selftest/cases/runtime_test.py | 52 +++++++++++++++++++ 2 files changed, 80 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..3cecdc8e42b 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -168,6 +168,58 @@ 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 + """ + if "DISPLAY" not in os.environ: + self.skipTest("virgl gtk test must be run inside a X session") + qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-native') + features = 'INHERIT += "testimage"\n' + if 'gtk+' not in qemu_packageconfig: + 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 + """ + 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