qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>, "Thomas Huth" <thuth@redhat.com>
Subject: [PULL 02/31] tests/functional: factor out common code in gpu test
Date: Sat,  8 Mar 2025 21:52:57 +0000	[thread overview]
Message-ID: <20250308215326.2907828-3-alex.bennee@linaro.org> (raw)
In-Reply-To: <20250308215326.2907828-1-alex.bennee@linaro.org>

In preparation for handling more tests split out the common machine
setup details from the test specific stuff and add a helper for
launching the weston test. Instead of searching for "vkmark score" we
set a custom PS1 and wait for a successful completion. This ensures we
capture the score in the console log which otherwise wouldn't log
anything.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20250304222439.2035603-3-alex.bennee@linaro.org>

diff --git a/tests/functional/test_aarch64_virt_gpu.py b/tests/functional/test_aarch64_virt_gpu.py
index 32af941cd5..b4679c0460 100755
--- a/tests/functional/test_aarch64_virt_gpu.py
+++ b/tests/functional/test_aarch64_virt_gpu.py
@@ -12,7 +12,7 @@
 from qemu.machine.machine import VMLaunchFailure
 
 from qemu_test import Asset
-from qemu_test import exec_command, exec_command_and_wait_for_pattern
+from qemu_test import exec_command_and_wait_for_pattern as ec_and_wait
 from qemu_test import skipIfMissingCommands
 
 from qemu_test.linuxkernel import LinuxKernelTest
@@ -31,12 +31,7 @@ class Aarch64VirtGPUMachine(LinuxKernelTest):
         'rootfs.ext4.zstd',
         '792da7573f5dc2913ddb7c638151d4a6b2d028a4cb2afb38add513c1924bdad4')
 
-    @skipIfMissingCommands('zstd')
-    def test_aarch64_virt_with_vulkan_gpu(self):
-        # This tests boots with a buildroot test image that contains
-        # vkmark and other GPU exercising tools. We run a headless
-        # weston that nevertheless still exercises the virtio-gpu
-        # backend.
+    def _launch_virt_gpu(self, gpu_device):
 
         self.set_machine('virt')
         self.require_accelerator("tcg")
@@ -54,10 +49,10 @@ def test_aarch64_virt_with_vulkan_gpu(self):
                          '-kernel', kernel_path,
                          '-append', kernel_command_line)
         self.vm.add_args("-smp", "2", "-m", "2048")
-        self.vm.add_args("-device",
-                         "virtio-gpu-gl-pci,hostmem=4G,blob=on,venus=on")
+        self.vm.add_args("-device", gpu_device)
         self.vm.add_args("-display", "egl-headless")
         self.vm.add_args("-display", "dbus,gl=on")
+
         self.vm.add_args("-device", "virtio-blk-device,drive=hd0")
         self.vm.add_args("-blockdev",
                          "driver=raw,file.driver=file,"
@@ -81,14 +76,23 @@ def test_aarch64_virt_with_vulkan_gpu(self):
                 raise excp
 
         self.wait_for_console_pattern('buildroot login:')
-        exec_command(self, 'root')
-        exec_command(self, 'export XDG_RUNTIME_DIR=/tmp')
-        exec_command_and_wait_for_pattern(self,
-                                          "weston -B headless "
-                                          "--renderer gl "
-                                          "--shell kiosk "
-                                          "-- vkmark -b:duration=1.0",
-                                          "vkmark Score")
+        ec_and_wait(self, 'root', '#')
+
+    def _run_virt_weston_test(self, cmd):
+
+        # make it easier to detect successful return to shell
+        PS1 = 'RES=[$?] # '
+        OK_CMD = 'RES=[0] # '
+
+        ec_and_wait(self, 'export XDG_RUNTIME_DIR=/tmp', '#')
+        ec_and_wait(self, f"export PS1='{PS1}'", OK_CMD)
+        full_cmd = f"weston -B headless --renderer gl --shell kiosk -- {cmd}"
+        ec_and_wait(self, full_cmd, OK_CMD)
+
+    @skipIfMissingCommands('zstd')
+    def test_aarch64_virt_with_vulkan_gpu(self):
+        self._launch_virt_gpu("virtio-gpu-gl-pci,hostmem=4G,blob=on,venus=on")
+        self._run_virt_weston_test("vkmark -b:duration=1.0")
 
 if __name__ == '__main__':
     LinuxKernelTest.main()
-- 
2.39.5



  parent reply	other threads:[~2025-03-08 21:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08 21:52 [PULL 00/31] testing, plugin and maintainer updates Alex Bennée
2025-03-08 21:52 ` [PULL 01/31] tests/functional: move aarch64 GPU test into own file Alex Bennée
2025-03-08 21:52 ` Alex Bennée [this message]
2025-03-08 21:52 ` [PULL 03/31] tests/functional: ensure we have a GPU device for tests Alex Bennée
2025-03-08 21:52 ` [PULL 04/31] tests/functional: bail early if vkmark hangs Alex Bennée
2025-03-08 21:53 ` [PULL 05/31] tests/functional: skip vulkan tests with nVidia Alex Bennée
2025-03-08 21:53 ` [PULL 06/31] tests/functional: expand tests to cover virgl Alex Bennée
2025-03-08 21:53 ` [PULL 07/31] tests/functional: update the aarch64_virg_gpu images Alex Bennée
2025-03-08 21:53 ` [PULL 08/31] plugins: add explicit dependency in functional tests Alex Bennée
2025-03-08 21:53 ` [PULL 09/31] tests/functional: Introduce the dso_suffix() helper Alex Bennée
2025-03-08 21:53 ` [PULL 10/31] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts Alex Bennée
2025-03-08 21:53 ` [PULL 11/31] libvirt-ci: bump to latest for vulkan-tools Alex Bennée
2025-03-08 21:53 ` [PULL 12/31] tests/vm: bump timeout for shutdown Alex Bennée
2025-03-08 21:53 ` [PULL 13/31] tests/tcg: mark test-vma as a linux-only test Alex Bennée
2025-03-08 21:53 ` [PULL 14/31] tests/tcg: add message to _Static_assert in test-avx Alex Bennée
2025-03-08 21:53 ` [PULL 15/31] tests/tcg: fix constraints in test-i386-adcox Alex Bennée
2025-03-08 21:53 ` [PULL 16/31] tests/tcg: enable -fwrapv for test-i386-bmi Alex Bennée
2025-03-08 21:53 ` [PULL 17/31] tests/tcg: Suppress compiler false-positive warning on sha1.c Alex Bennée
2025-03-08 21:53 ` [PULL 18/31] gitlab: add a new build_unit job to track build size Alex Bennée
2025-03-08 21:53 ` [PULL 19/31] tests/functional: add boot error detection for RME tests Alex Bennée
2025-03-08 21:53 ` [PULL 20/31] plugins/api: use qemu_target_page_mask() to get value Alex Bennée
2025-03-08 21:53 ` [PULL 21/31] plugins/loader: populate target_name with target_name() Alex Bennée
2025-03-08 21:53 ` [PULL 22/31] include/qemu: plugin-memory.h doesn't need cpu-defs.h Alex Bennée
2025-03-08 21:53 ` [PULL 23/31] plugins/api: clean-up the includes Alex Bennée
2025-03-08 21:53 ` [PULL 24/31] plugins/plugin.h: include queue.h Alex Bennée
2025-03-08 21:53 ` [PULL 25/31] plugins/loader: compile loader only once Alex Bennée
2025-03-08 21:53 ` [PULL 26/31] plugins/api: split out binary path/start/end/entry code Alex Bennée
2025-03-08 21:53 ` [PULL 27/31] plugins/api: split out the vaddr/hwaddr helpers Alex Bennée
2025-03-08 21:53 ` [PULL 28/31] plugins/api: split out time control helpers Alex Bennée
2025-03-08 21:53 ` [PULL 29/31] plugins/api: build only once Alex Bennée
2025-03-08 21:53 ` [PULL 30/31] plugins/core: make a single build unit Alex Bennée
2025-03-08 21:53 ` [PULL 31/31] MAINTAINERS: remove widely sanctioned entities Alex Bennée
2025-03-09  3:44 ` [PULL 00/31] testing, plugin and maintainer updates Stefan Hajnoczi
2025-03-09 21:02   ` Alex Bennée
2025-03-10  5:44     ` Stefan Hajnoczi

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=20250308215326.2907828-3-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).