From patchwork Wed Dec 18 16:20:55 2024 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: 851724 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1015555wrq; Wed, 18 Dec 2024 08:25:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWRdUxmNuCn5PafPr4O35TG9GvLMSTKzIEWUe8AljUHaMwOSErici1/gsFOY0NCFF3iET0v/w==@linaro.org X-Google-Smtp-Source: AGHT+IHc2fkvJ3U5yrgBK9mNJHgZaWkP7aR2PiAZP4veaMD402gxX91r9oAe+27f+ale/vcd89UF X-Received: by 2002:a05:620a:4410:b0:7b6:dfbb:3227 with SMTP id af79cd13be357-7b8636e9494mr519076185a.10.1734539106223; Wed, 18 Dec 2024 08:25:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734539106; cv=none; d=google.com; s=arc-20240605; b=gyvvn1LnP+mzp5wRUmQqze6xagq+USikzGYtsn9mn/1WdgotWx90lk4wv5+Tsifxgv UBut5vGeAM6xOqXKTK1AI+24C3gx4COGIzXy1iDf/I9SbK1pPk10KZniaW747drOm701 zVsIirgbxTmt98DEY6nd3ovxT47Hf94pstrsWysM1+xmNPtI+ACzlLrID8xqA40epPSl TrTxJJNvYL4CrV0axUwSzQeJsDiC0muw2M4BgP7I8lsHlcXt9s2vZiPk3E9weSt6NtfU l0xyvy/8G4KMXvPsGjCztjXfOTcm8TR7diUob7by0g31nyiBnEBNYvbfqxgexu5BSHIc JisQ== 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=Xo7zkZdpfvYcJ6r/NMXHOepy4SIK5Z2dKxxcbjI2QMM=; fh=3B3x+qnzafPmOtds1UJSYk2V7VBmDf107HX3/Dfv0XA=; b=jxM2N8JkmTUdc02WGb7zBxO80qt6iuwGx3a9Bo4+B3pO0VMKk8YaX7w8GvsVZSfN3I ma3FAzixTvgcoqgIEveDSvNWlrSRmPOk6vJtZ7FYBJrAw+w4su0As8lhFH4eA0uPdQlR 85+cUPkqFRga0K3Is+Yjjjr4Izry8kqr8HZBvR0jdsldbOYe0gZ0XFfmaCinfQ6KnY92 24gbVMzVlylOWWWSOwamOu2hDlzaMjYxFdbiMPGTA9IMr5tTkKIm/fMjBkpKHCXOJaCp iuqU9/RqBq5rTzDNOKX++x4KylR21wvRc2+F4BFVGkwv8LOVg1ONCRXcgw1PwA/Lr4kM cfrQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iQ6gWRp3; 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-7b7047c4abdsi1239883085a.68.2024.12.18.08.25.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2024 08:25:06 -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=iQ6gWRp3; 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 1tNwod-0000OM-2n; Wed, 18 Dec 2024 11:22:27 -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 1tNwnt-0007nu-FM for qemu-devel@nongnu.org; Wed, 18 Dec 2024 11:21:41 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNwnW-0006r2-GB for qemu-devel@nongnu.org; Wed, 18 Dec 2024 11:21:41 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-aa6997f33e4so1020822066b.3 for ; Wed, 18 Dec 2024 08:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734538876; x=1735143676; 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=Xo7zkZdpfvYcJ6r/NMXHOepy4SIK5Z2dKxxcbjI2QMM=; b=iQ6gWRp3rd2UagrBJro8DXEe02cPOqchZu0Rh6GdiB/UOJZ8nSBhNZnIGLJNWMjsLG iISzw6mUE8sNdD1lvRexMeowJ20/pUuTnGVLxH3dCa4YQfk7aXH35wvVBh3bnjI00Ypr cj+wWtU4FF+Gl85IU7cp8F5Uxd+PzB5vuAvmKBRN16nG89dY3VPmZPwh0HDi/c2ClaZp XL0YzNBvGdq0RUZPTrZ99pnnFTKrwmM10P3fzUqrseYzPP9gR2W1l1I41Vq9yFgjbo4y L3jotgZwKEgXPGMjMkcYIky9QrV6h7ug1+DB4YnsHTSmgw9OaBSrXv0rUR6JqaCzxREr fdWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734538876; x=1735143676; 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=Xo7zkZdpfvYcJ6r/NMXHOepy4SIK5Z2dKxxcbjI2QMM=; b=qAgiOetEvaRoD355dkR//WWQgy6PUIgLWeCtRvU6R1KUZMTbWkUSvJPCO+xOdUi6L4 L6MAxWwbkOTJJa9t13kaC+u5LzhdxzwrgI4+WyUJ20ZOR3Bci8Vez6DQ+XiEBzlvbH1q JEmdQh5IxkFLSV3Jjk0aBFf76ITxm6J0eH57o/QF6OV1+RWYGKHXT0iFC1ZkyWDLTT1n gfcci7wsLnM+9laRtW4zZ3F91nBnOGa4Iq9bB/7T8StGRdNMN27n1sPxD4Khor9PJKbU RW/BZwfpjbidVHlmaYN0cWHtncrmbuTLiNjM7zTWXb+0vx1nOwMrS0OGeyxdbPRNsbpp NYNQ== X-Gm-Message-State: AOJu0YzaUz3I2KVfDaUWyrTX3uIDgpiar39JKUi5mefLgqyRLxrklsiD Fu3cGNaNXIDEQBFMWValQNueUUNB+Balm+jXPyR7iP0F9LUWsPyRrPchpK7WouA= X-Gm-Gg: ASbGncuyMCIu8r/YXU2vvyuP7bDobraxNke/2v59BkRdcU6FJf+OMR8I0i50NRUm8m/ fdASS5ibXCdfrMPsTvyAf48JQQ61YlmxQqJ2qhmK5AazWataBVOrAX0AIs831Tnpmfiy33yZDSb VwjLSl4+YN4tKnArteUv5iAwc35BWr4EzgeC4F0FnuMJdE+XbNFXUaNWhCqy5xqdmmvZNomh4xp 7fAaIxfFVpNKbz+AS1zVxkFHI6Qrx6oXEX9wX17xWkGuc2rtNKOjsY= X-Received: by 2002:a17:906:1c54:b0:aac:439:fc0 with SMTP id a640c23a62f3a-aac04391122mr92434666b.51.1734538876255; Wed, 18 Dec 2024 08:21:16 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab960065dcsm576698566b.2.2024.12.18.08.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 08:21:13 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F34E85FBC6; Wed, 18 Dec 2024 16:21:05 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Ed Maste , Eric Farman , Thomas Huth , Li-Wen Hsu , Daniel Henrique Barboza , Aurelien Jarno , Fabiano Rosas , Radoslaw Biernacki , Mark Cave-Ayland , =?utf-8?q?Marc-Andr=C3=A9?= =?utf-8?q?_Lureau?= , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Nicholas Piggin , Joel Stanley , Beraldo Leal , Markus Armbruster , Jiaxun Yang , Weiwei Li , Peter Maydell , Cleber Rosa , Leif Lindholm , Christian Borntraeger , John Snow , Marcel Apfelbaum , Palmer Dabbelt , Bin Meng , Daniel Henrique Barboza , Paolo Bonzini , Liu Zhiwei , Wainer dos Santos Moschetta , Laurent Vivier , Pavel Dovgalyuk , Richard Henderson , Marcin Juszkiewicz , Halil Pasic , qemu-arm@nongnu.org, Harsh Prateek Bora , qemu-ppc@nongnu.org, Bernhard Beschow , "Michael S. Tsirkin" , qemu-s390x@nongnu.org, Laurent Vivier , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v2 19/27] tests/functional: remove hacky sleep from the tests Date: Wed, 18 Dec 2024 16:20:55 +0000 Message-Id: <20241218162104.3493551-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241218162104.3493551-1-alex.bennee@linaro.org> References: <20241218162104.3493551-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62c.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 --- tests/functional/test_aarch64_virt.py | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/functional/test_aarch64_virt.py b/tests/functional/test_aarch64_virt.py index c967da41b4..453e84c39f 100755 --- a/tests/functional/test_aarch64_virt.py +++ b/tests/functional/test_aarch64_virt.py @@ -10,7 +10,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -import time import os import logging @@ -107,18 +106,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")