From patchwork Tue Mar 4 22:24:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 870124 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:178f:b0:38f:210b:807b with SMTP id e15csp492341wrg; Tue, 4 Mar 2025 14:25:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXpa3bya2IP89y1GX7BVtudXLfOsBeJqbXgnljDNUfe0U6grZuDJy+2/4ScDbOZZfOgylgnAA==@linaro.org X-Google-Smtp-Source: AGHT+IHXYyYvSODPH0LLFaEwIQm4iOBHWzRxDb6XW+MO1xc3qW+CoBRdoLWMLDtr0HFyhXzhZXrh X-Received: by 2002:ac8:5f14:0:b0:474:fbb4:8f7c with SMTP id d75a77b69052e-4750af6f3d6mr16590831cf.11.1741127129729; Tue, 04 Mar 2025 14:25:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741127129; cv=none; d=google.com; s=arc-20240605; b=LL/OOcOvQv04Dvjqxiv5re06BvDCnUwJ3UPf0knZBNhn3XXc9YGgiHgasoxnmAmpoO zuuZoVIjIGg5vKLBeNlYsGltAwbvICt7QwJTZ1PSrXu1gTsbHlAcDYk7YwtoL0ED0E91 vWN4CHmcG7TXS4hS1bJqfu4Q17Bap+HApFL6mmVcs3GYHUeC7kGEfz2hh9oPMERLkHtR 5enJ87d3vrTb5Y/GgUEBh6EdOlvS1+k/xHwn1ZNVYu/H/wxqBGqARAVyFJvRDyVXNVfB GaUbw/QgFKEOkIG4ao1paVO3FKVNWWsBV+ma7CIk1FzxFpU7M2aX4RAUcoxKtLF5Dk4n DPbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2jU9KyNmccT/smoB+ETVGsRZ3o/UDWF2xDiNaobfo+g=; fh=6Bzz00MUAZSz1sM9FDoE/jB6E9D8TQzH70NWpntkZX8=; b=NyXnWjKIiSiA4Tpb8sFyxcyBeOeNSMiYmgIkEou0YkiYzeoqk36sAvO/JcehhK7GUX xkHS7C2EXB7ikbzg8D1X66S6cTojF7OIKFfOxdqwBO4sK8C6gPWB3GxU6QE2HGLJbL2/ +1YlBgcosc2cO9hLMHdBYcS/+XkMk74giB2+FGE8fAXNqQx2dyIz2o9BBVOYYdVhwYCO R3hPGkjwq5LCPahtU6iiS2ze4cKzp/us0JRy5k3tTvM+pgtp008UbO3OPO7bg8vKePRY 3sR79O72nYfHzZyAUuxTVbX4Ar7t+H8RzkeGSoCKU+qWgq5Qr8yKcuguMVkpQYbIVrLK fVhA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Va5OHodH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-474e94e0b18si50693291cf.315.2025.03.04.14.25.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Mar 2025 14:25:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Va5OHodH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpahP-0005bN-MR; Tue, 04 Mar 2025 17:25:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tpagy-0005MX-RN for qemu-devel@nongnu.org; Tue, 04 Mar 2025 17:24:49 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tpagw-0006UB-Bn for qemu-devel@nongnu.org; Tue, 04 Mar 2025 17:24:48 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5e535e6739bso5031276a12.1 for ; Tue, 04 Mar 2025 14:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741127085; x=1741731885; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2jU9KyNmccT/smoB+ETVGsRZ3o/UDWF2xDiNaobfo+g=; b=Va5OHodHbo5xv5zn1yCwgSvUBmOL40ZfFawkMCUek7c928l5xjPdPLyI5sMMT0GkeE i3Jev10UeujaCYW+Gao04eZ1xvgEnQmCmYuvuiVEE5oNf/u8Qur/pfWEbtmyRxhVpSth n7OWl7ebOobUm8925yJQPskUjkFWVWkhvKctaTlTbPeQJtC4qqSD3nPn+9UonhtwK/4u 1YT2DBNJRMkxKacy2Yw4571lQCQub8nE7tLToC/dV8MDnAQBz8IKMA6VLXKAZAxppbkr pHWA6j+re/DTfL5R7BP3nRx+zfk7jZ65zmy6ffrRIpAUydPpiQ8RWCJwqM91KAXF1zpX cqAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741127085; x=1741731885; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2jU9KyNmccT/smoB+ETVGsRZ3o/UDWF2xDiNaobfo+g=; b=X6h7TVXjwq1sFryLd0ca2UzKhaZKsKQ2GEI2Gel699vJCU88DwrccIyNNCwwCYJExu c02BlpwnTT3JgTm6qOp19oWcWP/UInJl/RnWmquMGqlroDQ5RHRup5ymrhIXuLcDcgZ6 pnG/3n4aEq/aH4nzY1MXDz19zN4NtgI8FltyQUxzEwKN1z4c7Vhr4B4DoIPiZ6G05SYt eDQUi5lHRthxLtzudjiZmK24wUWGiG9rLasybqaANOyqZBB+OwRlX8pbdkXouZ+bOdki Uj7B3QVGpCEdOQQtvTfrc+gD69pdpjp9/spszAtLXA7yDlEtBUOaStpECDOBHdje/6lJ JjAQ== X-Gm-Message-State: AOJu0YzDMvf5TUTgN2g1GvpWyHxDAmZbxBMQUGpAClHUAusSuCELwkoy 3GM4tE/fOW9rb+kpyacpJNiTDQxxhXOR2BwKVMfmbfQrYPNMc0IhbX1mpDPBah8= X-Gm-Gg: ASbGncuCBvX83pVE1bgAiwaIai+EuMeDVGdoOxL+ud8EAI38JTqjqbu5CoRwtDLzQAz 4/Ybjf0Hkfg+k0+JYCKx8cvJP6a52eo+rxI/eKwWwENEXcpXgBEy1MmBEOzaZ8pdSTsOxht6bqQ q1FZuFXuJNftrKOC8vYSN4QA4BAQLOPUDKqLv5bLW2iAdraAh/OAV0uAaBhQNeXeMu57KG5gR37 YuS8mAhcbUvaCi8QQRf2YFAHYMu/5/MyIMxwYuk6V7lFXVCJZ4alU3dMpLmrvpfCgjyyOB5kkuC Q81tSp6Gu0Yp1+h0LZGivPKHu0c4nmfi/+YRVO/c31Toqf0= X-Received: by 2002:a05:6402:2546:b0:5d0:bcdd:ffa1 with SMTP id 4fb4d7f45d1cf-5e59f3632cbmr811042a12.2.1741127084592; Tue, 04 Mar 2025 14:24:44 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5e4c3b4aa13sm8651808a12.7.2025.03.04.14.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Mar 2025 14:24:41 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 937005FC1A; Tue, 4 Mar 2025 22:24:39 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Li-Wen Hsu , Peter Maydell , Laurent Vivier , qemu-arm@nongnu.org, Alexandre Iooss , Paolo Bonzini , Richard Henderson , Riku Voipio , Warner Losh , Brian Cain , Mahmoud Mandour , Kyle Evans , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Ed Maste , Pierrick Bouvier , =?utf-8?q?Marc-Andr=C3=A9_L?= =?utf-8?q?ureau?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth Subject: [PATCH v2 02/32] tests/functional: factor out common code in gpu test Date: Tue, 4 Mar 2025 22:24:09 +0000 Message-Id: <20250304222439.2035603-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250304222439.2035603-1-alex.bennee@linaro.org> References: <20250304222439.2035603-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52f.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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. Signed-off-by: Alex Bennée Message-Id: <20250226140343.3907080-3-alex.bennee@linaro.org> Reviewed-by: Thomas Huth --- v2 - don't be cute with the -display options - dropped r-b as I factored more - split into _launch_virt_gpu and _run_weston_test - detect PS1 success --- tests/functional/test_aarch64_virt_gpu.py | 38 +++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/tests/functional/test_aarch64_virt_gpu.py b/tests/functional/test_aarch64_virt_gpu.py index 616e6ed656..bd325577c0 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 QemuSystemTest, 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__': QemuSystemTest.main()