From nobody Wed Apr 9 04:14:10 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736269211; cv=none; d=zohomail.com; s=zohoarc; b=BU1jA42vibUNcQfWX5x5BPO7SboDGbzaUxkZEsx03ippQiBQJUtvhYfrvMtnwdpek3zXrGJwhiyk9/T40680cq5XxMnlfGOL59Ln0FHlwZRorW8bClpcpotswWZhkbLjxNaP70RlGLmpRlpJMxRlBLaKzRA/dO9tXzUaNcWcikg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736269211; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9MTBQbpHCuuSIa6mICahNI723KTPOBvz07NNLKdbyUY=; b=F+XfShSEddqmhlgqnJH63YDb6Vb/dMevf8Y2vi/M+jwIBBI91RvLanHXVwuVJxYUcACs1bKs/0OVUkKEwyQvaEH3XvT7nNWs7zwHOg8bd9PvjEiZPkMstXSlGbW1AGGn4Nb3rnixiPGrWi3dFetQTtYh/ZCjiJzbEcnZrY7bS+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736269211043783.7695868882003; Tue, 7 Jan 2025 09:00:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVCuY-0002pa-Qr; Tue, 07 Jan 2025 11:58:34 -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 1tVCu7-0002EW-Qd for qemu-devel@nongnu.org; Tue, 07 Jan 2025 11:58:09 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVCtx-0006vP-U3 for qemu-devel@nongnu.org; Tue, 07 Jan 2025 11:58:05 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso113316805e9.1 for ; Tue, 07 Jan 2025 08:57:57 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4366127c4bbsm599441955e9.32.2025.01.07.08.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 08:57:55 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A3C495F8FE; Tue, 7 Jan 2025 16:52:09 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736269076; x=1736873876; 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=BRcmsSG1yPeM+NU4PoFh4WKYzVy48aHGmqSXUcG53VnlAWUij/eR7PPgsg9Gy2Q2w+ 67cDbKRhHcnRbrgqFyi7iecUEetru7Bu18MdmZw81qJK8R9s5mYJWSzA74pC6vNf8C6g Pj/+8LN0WuRCXry5WORPN7Viw5L4YKkI79DydNGBR6Y5rVEp9qX/79WjNHo8Hxa2/qkk EN/FnstxsmWbHpGUynpAeQzSGMUwxRpG3ALt0u13RbAC0owyTGxZyVj4avVhYQdWAtyO K90aJb2lV/DNYQcvFPICY/LPg3WnSFL5RYJJNEzo2ZyHRkd5uEGjLraN46WmrMNxvWLe 0w1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736269076; x=1736873876; 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=QLxrwH5zj0ojrfGxx0Bb8c+rmrw1kIbPDFHxdGWzzZF8RLTLB23H6pf9TyEHptVNjh t88NjttWeVUU73q5cxFHr3sJGGUjWR6V+ewvWBEwPmNgX/Yia/qCcSm4vZRY3Oirbvsw nX22rKg7BnebAi/4axD7Irw4kJSYaxp8baFMB7m26nY4EfwKUfWDMQNwvNJipyLBBQ+1 xhRgOvjZF2Z6do0cfmH2hoxWhAg2XuDMkFQGuI+nhL8VD3+beDRXD1ZliGMttX+qlpnW 0m27YnZ4KbUs5LQRePukqBzYO/3qW9Ktdr/QJX+4WeqhCHSfAUVjzYiAoS8VyvRX+7bb Q/aA== X-Gm-Message-State: AOJu0YwgF6NuBaLnfntufpmYi1lBF2ktZKA/EGsZOppLCf9M01vdNknr r+UTs9PhPxHCtYRDVXA5uQIk0k6SIvrZkwYVzBdpWQqqO0FPHgDcmgYOigjomW8= X-Gm-Gg: ASbGncutV2VbDbXUEN34qZu3JMvJLPjrpTZ7autY4NsB5RjNz/IwJJAc19A27G74Trw 6jw32e+LMc9eXy/k9zyTKKCnYYpwwjiMgr1poe+YRyh8X0rA5Cn1oaXGipTfJKAUvMMnRm8yil0 sIjqqYJmrZbvPuY5BF9H5bwFKoms8Lvtudx2xc94IsaaUA7yro4hJAD40Nk05qc2nEjkT+7e56B FptXETF9lPNHSl3GMJ4G45EmmSQBA19K50/CZYo+6gJs65UHaUBmgI= X-Google-Smtp-Source: AGHT+IHWP6Qy/H8JyZCF9iRPLeEVgXFWIAmhqoj00u6KNLxfGn1FjfA1GSNar8ppWuem5Gl6aflONQ== X-Received: by 2002:a05:6000:2ad:b0:386:4a0d:bb21 with SMTP id ffacd0b85a97d-38a221f12b0mr56744003f8f.22.1736269076274; Tue, 07 Jan 2025 08:57:56 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Beraldo Leal , Ed Maste , Halil Pasic , qemu-ppc@nongnu.org, John Snow , Radoslaw Biernacki , Nicholas Piggin , Markus Armbruster , Leif Lindholm , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Bin Meng , Daniel Henrique Barboza , Marcel Apfelbaum , qemu-riscv@nongnu.org, Christian Borntraeger , Wainer dos Santos Moschetta , qemu-s390x@nongnu.org, Alistair Francis , Liu Zhiwei , Fabiano Rosas , Weiwei Li , Harsh Prateek Bora , qemu-arm@nongnu.org, Li-Wen Hsu , Palmer Dabbelt , Daniel Henrique Barboza , Richard Henderson , Cleber Rosa , Marcin Juszkiewicz , Peter Maydell , Laurent Vivier , Aurelien Jarno , Eric Farman , Pavel Dovgalyuk , Jiaxun Yang , Thomas Huth , Laurent Vivier , Joel Stanley , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Bernhard Beschow , "Michael S. Tsirkin" Subject: [PATCH v3 18/29] tests/functional: remove hacky sleep from the tests Date: Tue, 7 Jan 2025 16:51:56 +0000 Message-Id: <20250107165208.743958-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250107165208.743958-1-alex.bennee@linaro.org> References: <20250107165208.743958-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.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=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736269212507116600 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=C3=A9e 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 =20 -import time import logging from subprocess import check_call, DEVNULL =20 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 =20 =20 @@ -107,18 +107,22 @@ def common_aarch64_virt(self, machine): 'virtio-blk-device,drive=3Dscratch') =20 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=3D/dev/hwrng of=3D/dev/vda bs=3D512 coun= t=3D4') - 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=3D'#' + self.wait_for_console_pattern('login:') + + commands =3D [ + ('root', ps1), + ('cat /proc/interrupts', ps1), + ('cat /proc/self/maps', ps1), + ('uname -a', ps1), + ('dd if=3D/dev/hwrng of=3D/dev/vda bs=3D512 count=3D4', ps1), + ('md5sum /dev/vda', ps1), + ('halt -n', 'reboot: System halted') + ] + + for cmd, pattern in commands: + exec_command_and_wait_for_pattern(self, cmd, pattern) =20 def test_aarch64_virt_gicv3(self): self.common_aarch64_virt("virt,gic_version=3D3") --=20 2.39.5