From patchwork Fri Jan 10 13:17: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: 856227 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp220618wrc; Fri, 10 Jan 2025 05:19:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV7PjpuOAUxgcfll2cFm/At0icA21sQ1CZZrgDmkH18suoFjOr0YLJoS8JSAty+3aDdYHpOHA==@linaro.org X-Google-Smtp-Source: AGHT+IGNfcqRfAcTV3ia+FXKMqvxWV452KNSge61XNTwNQXpw04OsfUmzh/TZpxQDn8yu15xa25g X-Received: by 2002:a05:6102:c8e:b0:4b2:cc94:187c with SMTP id ada2fe7eead31-4b3d0d78f5bmr9783237137.2.1736515170777; Fri, 10 Jan 2025 05:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736515170; cv=none; d=google.com; s=arc-20240605; b=bvJni9kHy9uHONKvXhzCPgCmKnvTgUyEgmBCi2MPnSO2/tE4oeV8ubSmHQJIZKKLIQ lWOkMnPJwnz1QuHaRcPl0VILj+HeQYMSu6dSNGtn2T6nwGJoGAZbQhzDxOxWw4qS6K7I 3bGXGJ9jXi0F1hXnD+0fH9eo19UCeUUyPf2a5oOgxYiYqM85WdBqPVccNrr2ld54JPxG VD1NjPn410Hnw03N5cIVOHALCXl0iiGReSfzBoWLn0LxXEuSJO8VcbqulqZ9vhxA7qTe hli3nqGwhwWYtLPkpvE9S+/xRXgIRiE+20ZGv9Xzq46sF87mIiKTja5pKjhWWIrzwGqk E6Jw== 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=6LGPQrma4XTCDNDbbK6Y397fLHxFQ/LRSzYQ8GARXks=; fh=xHc4t8tCsVJvOXXZ7IcqrW0xlbnMCwJrL2/fMTBPMzM=; b=PjFR/8CAGBDxj8rkwAayXgu5C94j6bTkXPHZrQepdFz25ReibNQlsFNI54FkdwAkU6 WcHEOlEJ1HHef1ZKMZ9e8o9/UAvp90Z5KeBE1D3CkVgkw3vZk2YTVQwPol0olfVuBsJu PX8DW9vKcnOR+xzCgq+1yoA/EEBIJF4/XZObpM3p1G9xf7HEXsbYhNEoUQwF2UCa0PIm FgJH3ktW0wmwh9KvK+uUq/DQX56/3DOkw+KJ9BXl3F8vJwIU41+LX2mcTTrCJhDE+9IO REBcH+KMc8QylwxBCWSJh3Z59nsSe/RHylcp4h4x4L8xKjhj1QH/4ZewtA4k2Iw0lKjQ UzKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="akXd/yxB"; 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 a1e0cc1a2514c-8623b22092csi683181241.48.2025.01.10.05.19.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jan 2025 05:19:30 -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="akXd/yxB"; 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 1tWEuA-0004o5-1A; Fri, 10 Jan 2025 08:18: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 1tWEtt-0004gQ-Ka for qemu-devel@nongnu.org; Fri, 10 Jan 2025 08:18:09 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tWEtq-0004kd-Ng for qemu-devel@nongnu.org; Fri, 10 Jan 2025 08:18:08 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-436281c8a38so15156395e9.3 for ; Fri, 10 Jan 2025 05:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736515085; x=1737119885; 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=6LGPQrma4XTCDNDbbK6Y397fLHxFQ/LRSzYQ8GARXks=; b=akXd/yxBfGb3HZH/c6ImVBJ6KycRobR7hjXPkPni/i3wURv71PmSMnygQSI1zviTgv WNlvxbeoohBxqqSArL1U8DX6+uj0R4lfQ+nSSduwQkUIkKTumLzUEnoUrPfl21oqag+V QxIA8Fk8K4liNQHVDxSs6k+QeeOEz3G96tKZYsdAWejsLNqNgYakA85RO8Miu5RB1ubV TM1c0pxN7Ju5Y1YQJCSjljAXc3vUeVaRexYIe8gRcyU5mUV0yrpdt1ZlkZR6zTiXEkUZ Fw+B1NAse1YyKrB7SRe9TWLEyRHqa1fgRvvYgnLr0cV638IZw1F10sEPfgblSRGs0kRu SHkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736515085; x=1737119885; 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=6LGPQrma4XTCDNDbbK6Y397fLHxFQ/LRSzYQ8GARXks=; b=NmGMrPgW5/vLRUrVpbb+Zx50Xxb6bUH/nutfoDLt2dtMSiyAl3qZVZl1TJCkqSF18p imykYXUBHjNG21sKd91TJ4QHNkwX3by53Da+P8T4UBHY0BpGiV0u0U6tjiKC2eAJDJzE 0Z3+gxxG5vL+8o20bm/0s4Ay8CrMw5afaQYJ/ot95e3yo/NphOkIdPm47pxtQxUkPjDt k3BaW/kn6bqF3JBtTopOCDxSuHX80gcZYYeCapDWGj7qR2DKASC9lSCMtMX2XejFi32f u4zvlsfLuUv+KiK66EuA0iUnY5ZgXrpsIQ1qiU6WgPpimgq7OxMCkVvAGDVV0+VgUzZ6 RrAQ== X-Gm-Message-State: AOJu0YwwoZFT/sWrbsXK+UPideUHj/yDS7YrjGEeBsbtt0D0TEQKb2vd J+EMNc4x26KqFFVThwkHisZML6qMXA42EBXEJkM1F6GFhh6PnuGYUSMXq4Z5yec= X-Gm-Gg: ASbGnctjH4X72wk9zws44/ghwurRhUnB9RXUd9l5wvFBHTWYNofqLBUIoE10UnXHkm0 KI0tvIIaeueIP13ixe+vh+IlQW1PCXLvvKsPxPnOjCPNu0G/lDtsjoByW6qSZL4wrXJxEwPAbeg xnjepu1sCnF3Y8TUTNHMg6WyrGyyJKScXcOYF/w1pHJfGroRPpCCfY5XA4+3FwJjE55u7o9917t l72KkW1iv+YiEhsuDbPUC4CgBBj5aIFKjIiSXyj6N27U0hEALXNuiU= X-Received: by 2002:a05:600c:3516:b0:436:5165:f206 with SMTP id 5b1f17b1804b1-436e27075eemr107786145e9.31.1736515085292; Fri, 10 Jan 2025 05:18:05 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38428bsm4556045f8f.37.2025.01.10.05.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 05:18:02 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B46A2609F2; Fri, 10 Jan 2025 13:17:55 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , qemu-arm@nongnu.org (open list:Virt) Subject: [PULL 18/32] tests/functional: remove hacky sleep from the tests Date: Fri, 10 Jan 2025 13:17:40 +0000 Message-Id: <20250110131754.2769814-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110131754.2769814-1-alex.bennee@linaro.org> References: <20250110131754.2769814-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.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+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). Reviewed-by: Thomas Huth Signed-off-by: Alex Bennée Message-Id: <20250108121054.1126164-19-alex.bennee@linaro.org> 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")