diff mbox series

[v2,4/4] support/testing: add test for vkmark package (PENDING!)

Message ID 20241205173643.2334343-5-alex.bennee@linaro.org
State New
Headers show
Series Enable venus vulkan encapsulation and add vkmark | expand

Commit Message

Alex Bennée Dec. 5, 2024, 5:36 p.m. UTC
To test vkmark we need a headless Weston compositor so we can run the
test without messing around with actual displays.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
Currently this won't work with the host QEMU. You will need QEMU 9.2.0
with a modern virglrenderer (as in Trixie) to expose the Vulkan GPU to
the guest.
---
 support/testing/tests/package/test_vkmark.py | 75 ++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 support/testing/tests/package/test_vkmark.py
diff mbox series

Patch

diff --git a/support/testing/tests/package/test_vkmark.py b/support/testing/tests/package/test_vkmark.py
new file mode 100644
index 0000000000..9eebdd989b
--- /dev/null
+++ b/support/testing/tests/package/test_vkmark.py
@@ -0,0 +1,75 @@ 
+import os
+
+import infra.basetest
+
+VULKANINFO_TIMEOUT = 120
+
+
+class TestVkMark(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_aarch64=y
+        BR2_cortex_a76=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+        BR2_ROOTFS_MERGED_USR=y
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+        BR2_PACKAGE_GLMARK2=y
+        BR2_PACKAGE_VKMARK=y
+        BR2_PACKAGE_MESA3D=y
+        BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL=y
+        BR2_PACKAGE_MESA3D_VULKAN_DRIVER_VIRTIO=y
+        BR2_PACKAGE_MESA3D_OPENGL_GLX=y
+        BR2_PACKAGE_MESA3D_OPENGL_ES=y
+        BR2_PACKAGE_WESTON=y
+        BR2_PACKAGE_WESTON_HEADLESS=y
+        BR2_PACKAGE_WESTON_XWAYLAND=y
+        BR2_PACKAGE_XORG7=y
+        BR2_PACKAGE_DBUS=y
+        BR2_PACKAGE_LIBMD=y
+        BR2_PACKAGE_LIBSCRYPT=y
+        BR2_PACKAGE_LIBXCRYPT=y
+        BR2_PACKAGE_OPENSSL=y
+        BR2_PACKAGE_LIBDRM_INTEL=y
+        BR2_PACKAGE_LIBDRM_RADEON=y
+        BR2_PACKAGE_LIBEPOXY=y
+        BR2_PACKAGE_YAJL=y
+        BR2_PACKAGE_UTIL_LINUX_BINARIES=y
+        BR2_PACKAGE_UTIL_LINUX_AGETTY=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_SIZE="250M"
+        BR2_ROOTFS_OVERLAY="{}"
+        """.format(
+          infra.filepath("tests/package/test_vkmark/rootfs-overlay"))
+
+    def login(self):
+        img = os.path.join(self.builddir, "images", "rootfs.ext2")
+        kern = os.path.join(self.builddir, "images", "bzImage")
+        # glxinfo overallocate memory and the minimum that seemed to work was 512MB
+        self.emulator.boot(arch="aarch64",
+                           kernel=kern,
+                           kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
+                           options=["-M", "virt", "-cpu", "cortex-a76", "-m", "512",
+                                    "-drive",
+                                    "file={},if=virtio,format=raw".format(img),
+                                    "-device virtio-gpu-gl-pci,hostmem=4G"])
+
+        # when buildroot's QEMU gets Venus support "-device virtio-gpu-gl-pci,hostmem=4G,blob=on,venus=on"])
+        self.emulator.login()
+
+    def test_run(self):
+        self.login()
+
+        # The test case verifies that the xserver with GLX is working
+        cmd = "weston -B headless --renderer gl --shell kiosk -- vkmark"
+        output, exit_code = self.emulator.run(cmd, VULKANINFO_TIMEOUT)
+
+        self.assertEqual(exit_code, 0)
+        found_venus = False
+        for line in output:
+            found_venus |= "Virtio-GPU Venus" in line
+
+        self.assertEqual(found_venus, True)