From patchwork Wed Jan 8 12:10:40 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: 855695 Delivered-To: patch@linaro.org Received: by 2002:adf:8b05:0:b0:385:e875:8a9e with SMTP id n5csp687749wra; Wed, 8 Jan 2025 04:20:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUlM/ATkoiyWFIURIhvsdc0Z8sg3cm0F0ZYLBzvm0u2Lkgz2H99Y67TYuFIiEVhM/Ycrr8JXw==@linaro.org X-Google-Smtp-Source: AGHT+IFmI3t6GJR4BoQGVJI2y68ymKcdkI09XsQJ4w9RArbGwDcZ3Kxczsca/IMpvjyjZQKgA8En X-Received: by 2002:a05:620a:44c5:b0:7b1:4a48:56bb with SMTP id af79cd13be357-7bcd97d5cb9mr344576485a.56.1736338824763; Wed, 08 Jan 2025 04:20:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736338824; cv=none; d=google.com; s=arc-20240605; b=aVyDkz4DSnNr/pUL4gOEcqsocDxXMbhn0uXeZ+XBz37ME1LdotTqS8XXidarxCnmkB VqAmIEgmVyo1x2cll4VQr/VxBJD+P5lwhaQa+1pvvhQ5oPvdFugmo6fbOB+8zhAExk/P PW07EWRoWSVBnCp6g5YB0JMcDUMPN3c5GqVGHZ58bQZXP2SISAj3T4VZnLlV7+ek0iR3 6H1Z397tsA4MnSqqY2MVaGGtNpvzFFh1TreN7Uc7yYbDvOQ0f+yojIzzS+8GoqXRa2F6 RF16C7ieqGwfdQDF8t0DufoYj7v8hGABLrnHmVHlVcKm+p2Yl4gG3hCGkD3isFzC1Vad +EaQ== 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=9MTBQbpHCuuSIa6mICahNI723KTPOBvz07NNLKdbyUY=; fh=l95L5Maua5HG0vXtrda7YXM3hY8pWBBFNczXRFh+wJU=; b=JiHJa758rrZJ3DHbhlv5DSd/Mrq6Jf7ORqtkyOQDhK5/hQtyFvlMhUQm0YRXLEnKBI x2HjGbd9SabdqG7VcolpHA2CT3vJ4kHILzvB9G6ItwUfx8gkY7ML9OQ5GW0OHgbo2Eyh JxZcbyLLE0wVDOKBlpR9qQkql32kXzZSEFqc3woDRVqTFVR7pUcGj30nd/SEWydsQ6Yo bGC/MdPBM9F2LDpXFXRxoGJcmJHjCpZLlfLLmgJXqZ17NLrNJ9obl/oSXAVgWOxyjoCN p8UflUNIkx7XLpxmLJRdv8TRAJLjrx2rIQRgD9gvKHC76CEjceXEihkGvJjsmipxob/x Egmw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fTK+Sw4j; 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 af79cd13be357-7b9ac2ce346si4877809585a.165.2025.01.08.04.20.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Jan 2025 04:20:24 -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=fTK+Sw4j; 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 1tVV0e-0001DA-Uc; Wed, 08 Jan 2025 07:18:05 -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 1tVUuo-0000yG-7B for qemu-devel@nongnu.org; Wed, 08 Jan 2025 07:12:06 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVUuS-0007HS-HW for qemu-devel@nongnu.org; Wed, 08 Jan 2025 07:11:56 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5d3bbb0f09dso29184291a12.2 for ; Wed, 08 Jan 2025 04:11:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736338264; x=1736943064; 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=9MTBQbpHCuuSIa6mICahNI723KTPOBvz07NNLKdbyUY=; b=fTK+Sw4jhxPsCkToS4cYPAFpuBTTg81iVrj2NUPUxLqwrv/Va5MROx2vo+Va6WrXYM LQGkgm+qwNHcRpvMTHJUTWBKIX8Go8ySkj0iCSDIG1EoqYT5kwdnaqrSA4B7aNCBb2+W uUUyynSU37q0gQmrJkPk5ialZmK2GBNc/pW/sZ2cXYmKveIxtWPsGHG0k8YhRQ68EUyn vfxY7LCuHThWHZkkwAEKI9qcrcPwXMvSq3Wh6W5jU0GsX8HnojIEgCqDOwCcb1FtbOgU k+rYd3AD9L61L7IhnekDW0cxdjRymd4+V4qH/SpwayRYFPKz08qi156AZYLkdC+cmMsb zRcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736338264; x=1736943064; 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=9MTBQbpHCuuSIa6mICahNI723KTPOBvz07NNLKdbyUY=; b=VLMHxmP4/0mBjbGDAXgVcmnCJ+QIFdqV8ikOBEyxxF+QU+LCDkodyoxRjJhyCsqhs2 AoAmORNORSnsF7mSleaasxN+yxrqK0lbtaLsAN4sS/AMX4MHD0vmR4RMEPc6mB+gpx5m vgFPSqu4UlYpnUkPyeuwzpA3gCljJs+0CDYjQy2VPOtJgOfD1adjt2UxYI+KecWHVzfe 3W0RMIQbsIqGrDWAw0D9WJCM7oaTUF/KwsFSQK7PpnEhxaRJuTYk5lHFyApvcGnQYB2g oByddyNcc4DEqURpY8m2jsUAIC1DBqWBOoyPLFPVb04gUU11JVomlDtzikjGQKmm4d3y pj3A== X-Gm-Message-State: AOJu0Yy1BS3d99Sjtcpki0sMidsh0/1xeQbdXDbPPYn1sWqPrqdbfPmU A5ccI5pR5osrSL4gEUO0DEXCud8YlQ0ZNmJutSBTH3u2mBiu0UVxEVvelOJtXNA= X-Gm-Gg: ASbGncsly6AXECt6uPLiYi2N7PozjFNpuwHerH3ggkLol4X2tYgfojraixis0EL1X1h gh75nLnlszD2MYZuY/4WflQmpKQHe/pAxY7ZUotTYhXLQTAF86PranSoKbfL0tk8FEzaryIEr+n N5tZCxHGm/eoeJuUGhC4jIhte4d2dggDXH/u2AFLC9eK1eBoDSoIv8qXEXk6K3aDXIzOP1Y8MDu LulxguzYp/Ve1FTZBf3wJ63/qBcsvWxPHD/rm2rmL2Xo7U+B09GDBc= X-Received: by 2002:a05:6402:2711:b0:5d0:d1e0:8fb2 with SMTP id 4fb4d7f45d1cf-5d972e0870fmr1776186a12.11.1736338264218; Wed, 08 Jan 2025 04:11:04 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d80675a6ddsm25004494a12.3.2025.01.08.04.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 04:11:02 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 57E845F91D; Wed, 8 Jan 2025 12:10:56 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Halil Pasic , Aurelien Jarno , qemu-riscv@nongnu.org, Radoslaw Biernacki , Daniel Henrique Barboza , =?utf-8?q?Alex_Benn=C3=A9e?= , Marcel Apfelbaum , Richard Henderson , Beraldo Leal , Fabiano Rosas , Mark Cave-Ayland , Laurent Vivier , Nicholas Piggin , Marcin Juszkiewicz , Christian Borntraeger , Wainer dos Santos Moschetta , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Ed Maste , Jiaxun Yang , Bernhard Beschow , Bin Meng , qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Laurent Vivier , Joel Stanley , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , "Michael S. Tsirkin" , Pavel Dovgalyuk , Alistair Francis , Liu Zhiwei , Harsh Prateek Bora , Leif Lindholm , Cleber Rosa , Thomas Huth , Paolo Bonzini , qemu-s390x@nongnu.org, Eric Farman , Weiwei Li , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Daniel Henrique Barboza , Palmer Dabbelt , Peter Maydell , Li-Wen Hsu Subject: [PATCH v4 18/32] tests/functional: remove hacky sleep from the tests Date: Wed, 8 Jan 2025 12:10:40 +0000 Message-Id: <20250108121054.1126164-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250108121054.1126164-1-alex.bennee@linaro.org> References: <20250108121054.1126164-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 We have proper detection of prompts now so we don't need to guess with sleep() sprinkled through the test. The extra step of calling halt is just to flush the final bits of the log (although the last line is still missed). Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth --- v2 - avoid long lines by iterating through an array - drop time import v3 - fix up on re-base - drop stray import os that had sneaked in --- tests/functional/test_aarch64_virt.py | 32 +++++++++++++++------------ 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/functional/test_aarch64_virt.py b/tests/functional/test_aarch64_virt.py index 08576b0694..2d9995a95d 100755 --- a/tests/functional/test_aarch64_virt.py +++ b/tests/functional/test_aarch64_virt.py @@ -10,12 +10,12 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -import time import logging from subprocess import check_call, DEVNULL from qemu_test import QemuSystemTest, Asset -from qemu_test import exec_command, wait_for_console_pattern +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import wait_for_console_pattern from qemu_test import get_qemu_img @@ -107,18 +107,22 @@ def common_aarch64_virt(self, machine): 'virtio-blk-device,drive=scratch') self.vm.launch() - self.wait_for_console_pattern('Welcome to Buildroot') - time.sleep(0.1) - exec_command(self, 'root') - time.sleep(0.1) - exec_command(self, 'dd if=/dev/hwrng of=/dev/vda bs=512 count=4') - time.sleep(0.1) - exec_command(self, 'md5sum /dev/vda') - time.sleep(0.1) - exec_command(self, 'cat /proc/interrupts') - time.sleep(0.1) - exec_command(self, 'cat /proc/self/maps') - time.sleep(0.1) + + ps1='#' + self.wait_for_console_pattern('login:') + + commands = [ + ('root', ps1), + ('cat /proc/interrupts', ps1), + ('cat /proc/self/maps', ps1), + ('uname -a', ps1), + ('dd if=/dev/hwrng of=/dev/vda bs=512 count=4', ps1), + ('md5sum /dev/vda', ps1), + ('halt -n', 'reboot: System halted') + ] + + for cmd, pattern in commands: + exec_command_and_wait_for_pattern(self, cmd, pattern) def test_aarch64_virt_gicv3(self): self.common_aarch64_virt("virt,gic_version=3")