From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025234; cv=none; d=zohomail.com; s=zohoarc; b=XvXdHiSO9jsHEDIY5omMrZsFl4jpCFzyftqPC/AF9IW8q40X7xtbJjU2wgLm/2z7gsIK7nHdvES5wwyPu3wQ/ZfYGc8koikY9nb/JAz87glr6gG8axFgHkzS0aDVfYls9n+ZEAdnhdFvRdOcs0CyarPGO5JH5T8lQhZbjseeoBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025234; h=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=8unSkkTts6wc+vo3SqOWo69BPFQfmv4K7FBTZzl2cG0=; b=J/L3lxAPHbfbz5zPGvWty/uttAabpSkoMgVylbfCLwK/Hv6h6T0Ma7Almr9cYwmhGd093+X1PKxTMo306xbiOC6ntZ7mb/4zMtJIPhGEbeDUmwcjNW6yjiNLO7h4mEvoxB2q3rGJGjelB2XwhCO8YBYmSu7RVdGxUSwJERDkr0Y= 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 1725025234254689.1943274809365; Fri, 30 Aug 2024 06:40:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qH-0005aV-04; Fri, 30 Aug 2024 09:39:09 -0400 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 1sk1qA-0005Vs-Oh for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1q7-00058u-6H for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:01 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-ozGeD2sgMGKOhrMmvp9Zmw-1; Fri, 30 Aug 2024 09:38:54 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A08EE19560B0; Fri, 30 Aug 2024 13:38:53 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DA3AC300019C; Fri, 30 Aug 2024 13:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8unSkkTts6wc+vo3SqOWo69BPFQfmv4K7FBTZzl2cG0=; b=RJN+lOCIqWGflybodj/xxBvz8oTAU1Sxz60BwNynY8QK4hQ3DwSD5i1/F2SBjrULp0fQwS wGP1vXyjG9V1Ro+NKTjxOfaGAbrlb8GE5gwPdFYHmws7VXIvhH7CJxlh+kCQhWmAMjCkp4 CBgdJf+6rlN1dxBZ1SwqBATbmDcpHXk= X-MC-Unique: ozGeD2sgMGKOhrMmvp9Zmw-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 01/44] tests/avocado: machine aarch64: standardize location and RO access Date: Fri, 30 Aug 2024 15:37:55 +0200 Message-ID: <20240830133841.142644-2-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025234500116600 Content-Type: text/plain; charset="utf-8" From: Cleber Rosa The tests under machine_aarch64_virt.py and machine_aarch64_sbsaref.py should not be writing to the ISO files. By adding "media=3Dcdrom" the "ro" is automatically set. While at it, let's use a single code style and hash for the ISO url. Signed-off-by: Cleber Rosa Tested-by: Marcin Juszkiewicz Message-ID: <20240806173119.582857-5-crosa@redhat.com> Signed-off-by: Thomas Huth --- tests/avocado/machine_aarch64_sbsaref.py | 2 +- tests/avocado/machine_aarch64_virt.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/avocado/machine_aarch64_sbsaref.py b/tests/avocado/machi= ne_aarch64_sbsaref.py index e920bbf08c..756f316ac9 100644 --- a/tests/avocado/machine_aarch64_sbsaref.py +++ b/tests/avocado/machine_aarch64_sbsaref.py @@ -129,7 +129,7 @@ def boot_alpine_linux(self, cpu): "-cpu", cpu, "-drive", - f"file=3D{iso_path},format=3Draw", + f"file=3D{iso_path},media=3Dcdrom,format=3Draw", ) =20 self.vm.launch() diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/avocado/machine_= aarch64_virt.py index a90dc6ff4b..6831d2c0ed 100644 --- a/tests/avocado/machine_aarch64_virt.py +++ b/tests/avocado/machine_aarch64_virt.py @@ -37,13 +37,13 @@ def test_alpine_virt_tcg_gic_max(self): :avocado: tags=3Dmachine:virt :avocado: tags=3Daccel:tcg """ - iso_url =3D ('https://dl-cdn.alpinelinux.org/' - 'alpine/v3.17/releases/aarch64/' - 'alpine-standard-3.17.2-aarch64.iso') + iso_url =3D ( + "https://dl-cdn.alpinelinux.org/" + "alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.= iso" + ) =20 - # Alpine use sha256 so I recalculated this myself - iso_sha1 =3D '76284fcd7b41fe899b0c2375ceb8470803eea839' - iso_path =3D self.fetch_asset(iso_url, asset_hash=3Diso_sha1) + iso_hash =3D "5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e= 19c4bd9dc027" + iso_path =3D self.fetch_asset(iso_url, algorithm=3D"sha256", asset= _hash=3Diso_hash) =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + @@ -60,7 +60,7 @@ def test_alpine_virt_tcg_gic_max(self): self.vm.add_args("-smp", "2", "-m", "1024") self.vm.add_args('-bios', os.path.join(BUILD_DIR, 'pc-bios', 'edk2-aarch64-code.fd')) - self.vm.add_args("-drive", f"file=3D{iso_path},format=3Draw") + self.vm.add_args("-drive", f"file=3D{iso_path},media=3Dcdrom,forma= t=3Draw") self.vm.add_args('-device', 'virtio-rng-pci,rng=3Drng0') self.vm.add_args('-object', 'rng-random,id=3Drng0,filename=3D/dev/= urandom') =20 --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025196; cv=none; d=zohomail.com; s=zohoarc; b=kXIFyah9lFVG9Oa1Ugvz5u0CjjEy+G5OXDjtZr0FOqIk9n1peiXVOhx8QP1zgWttNWELWPNlAwWSDoPRfABtcAGmcoCvgSOL4ZIL6oafmVVXUj/8Nc5SU4iekQWxd3AvW4s58HfIPmrxzo2h3GzEg3GYt9H+uDeCRyH5ToVZQZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025196; h=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=t2Lv61V7e4ZwGeTVBaeIVh9jO6Nj6mHSFeOrznA7SVw=; b=f/dWJvM22XR3Atotue/P3B5eMavRFTdzLt5MwE9s0GrgaOu2MRexdE39snxOcV6ykuFtznKF6m8bZ7quSPwvbFXZB3m13gWTj5FENLlFQRvPeCrNsuYhXYAaGHTFHYtIFMX11xnN4+miciNw5HMmstqdTnEqpTL0RqO6/+jS75E= 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 1725025196147722.5296712630278; Fri, 30 Aug 2024 06:39:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qG-0005Zv-Rp; Fri, 30 Aug 2024 09:39:08 -0400 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 1sk1qC-0005XB-Sv for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qA-0005AV-SD for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:04 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-107-wSh26SsxPQKAGNdGh19kcA-1; Fri, 30 Aug 2024 09:38:58 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B52CC1954B04; Fri, 30 Aug 2024 13:38:57 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 69B50300019C; Fri, 30 Aug 2024 13:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t2Lv61V7e4ZwGeTVBaeIVh9jO6Nj6mHSFeOrznA7SVw=; b=KZpMaJBRRVBEUhJLq9w9QpYn/lFvubsru5QgyKBVgMttAFGmIUEtGLzKz760srZqKXDIZN 3ShBGMldb92bTHXWcd85LsfFpCRmrQnzyjZpvmsb2trhjFlUSaV6VueQ7CSrGpAqhfeJIV 9fjQ+w0QYTT3RxVfxi5QaWrpj2RrK90= X-MC-Unique: wSh26SsxPQKAGNdGh19kcA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 02/44] tests/avocado/boot_xen.py: fetch kernel during test setUp() Date: Fri, 30 Aug 2024 15:37:56 +0200 Message-ID: <20240830133841.142644-3-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025196952116600 Content-Type: text/plain; charset="utf-8" From: Cleber Rosa The kernel is a common blob used in all tests. By moving it to the setUp() method, the "fetch asset" plugin will recognize the kernel and attempt to fetch it and cache it before the tests are started. Signed-off-by: Cleber Rosa Reviewed-by: Akihiko Odaki Tested-by: Marcin Juszkiewicz Message-ID: <20240806173119.582857-7-crosa@redhat.com> Signed-off-by: Thomas Huth --- tests/avocado/boot_xen.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/avocado/boot_xen.py b/tests/avocado/boot_xen.py index f29bc58b9e..490a127a3e 100644 --- a/tests/avocado/boot_xen.py +++ b/tests/avocado/boot_xen.py @@ -30,23 +30,22 @@ class BootXen(LinuxKernelTest): timeout =3D 90 XEN_COMMON_COMMAND_LINE =3D 'dom0_mem=3D128M loglvl=3Dall guest_loglvl= =3Dall' =20 - def fetch_guest_kernel(self): + def setUp(self): + super(BootXen, self).setUp() + # Using my own built kernel - which works kernel_url =3D ('https://fileserver.linaro.org/' 's/JSsewXGZ6mqxPr5/download?path=3D%2F&files=3D' 'linux-5.9.9-arm64-ajb') kernel_sha1 =3D '4f92bc4b9f88d5ab792fa7a43a68555d344e1b83' - kernel_path =3D self.fetch_asset(kernel_url, - asset_hash=3Dkernel_sha1) - - return kernel_path + self.kernel_path =3D self.fetch_asset(kernel_url, + asset_hash=3Dkernel_sha1) =20 def launch_xen(self, xen_path): """ Launch Xen with a dom0 guest kernel """ self.log.info("launch with xen_path: %s", xen_path) - kernel_path =3D self.fetch_guest_kernel() =20 self.vm.set_console() =20 @@ -56,7 +55,7 @@ def launch_xen(self, xen_path): '-append', self.XEN_COMMON_COMMAND_LINE, '-device', 'guest-loader,addr=3D0x47000000,kernel=3D%s,boota= rgs=3Dconsole=3Dhvc0' - % (kernel_path)) + % (self.kernel_path)) =20 self.vm.launch() =20 --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025286; cv=none; d=zohomail.com; s=zohoarc; b=i6PPZlBdZy/CKIfvgqAiTJk4RggaQf8vqtjl3PM5876M8HRAPET9S3Oo2ECH7ez6vaUBXs6r2XC76YMpXR9CA6VzmIIClVNBuGkcwNGmZJrcyKzBbIFgoPL9P/3fyjhbK56lYg5JfEdehFKIOhiV1NpKH27klgsN8dtOpKTcvYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025286; 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=Zm/wpAYOBdO9cmfNsRTaCnT2y0YvpyQ0+R4Pd59Z1eE=; b=EA5v1wW6JlSkIgjUWw1xRipqrT19N0GpokpsDWe0e+Gb0Efi28HU8uuI5Vt/Wn7AbwIYcO0aklqxY1NX9UtNLoN7L3YNBstYwY3RK08W4LNbZTviQrHbCcMDWWUwO7WVwI/39GIXI9Zj7Slg8MQtZp8RffG1l9hwxqpOPzQtkmg= 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 1725025286291533.0188491349652; Fri, 30 Aug 2024 06:41:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qM-0005wO-M1; Fri, 30 Aug 2024 09:39:14 -0400 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 1sk1qK-0005oq-KV for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qF-0005Ci-TN for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:12 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-09xHsoiQOB2fTzZrl3te5w-1; Fri, 30 Aug 2024 09:39:03 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5E8DF1955BEF; Fri, 30 Aug 2024 13:39:02 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 47BF6300019C; Fri, 30 Aug 2024 13:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zm/wpAYOBdO9cmfNsRTaCnT2y0YvpyQ0+R4Pd59Z1eE=; b=QefGd73VN0WygWZaSqSM6cd//PEbSB2XcRr03CzNwJ7S07ArdX/mRzUltD/e2gsvKaMIhE Legv/4fcg3fCj3X11yfLVH16QZlyf+NvNFxZoPTtgoiVH2paiDBbFQ7Y/ZOfhtTLkm3n4X XWTkfsb487FFU9wgWRAII60pezwqmbw= X-MC-Unique: 09xHsoiQOB2fTzZrl3te5w-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 03/44] tests/avocado/machine_aarch64_sbsaref.py: allow for rw usage of image Date: Fri, 30 Aug 2024 15:37:57 +0200 Message-ID: <20240830133841.142644-4-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025286712116600 From: Cleber Rosa When the OpenBSD based tests are run in parallel, the previously single instance of the image would become corrupt. Let's give each test its own snapshot. Signed-off-by: Cleber Rosa Suggested-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Marcin Juszkiewicz Message-ID: <20240806173119.582857-9-crosa@redhat.com> Signed-off-by: Thomas Huth --- tests/avocado/machine_aarch64_sbsaref.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/avocado/machine_aarch64_sbsaref.py b/tests/avocado/machi= ne_aarch64_sbsaref.py index 756f316ac9..f8bf40c192 100644 --- a/tests/avocado/machine_aarch64_sbsaref.py +++ b/tests/avocado/machine_aarch64_sbsaref.py @@ -190,7 +190,7 @@ def boot_openbsd73(self, cpu): "-cpu", cpu, "-drive", - f"file=3D{img_path},format=3Draw", + f"file=3D{img_path},format=3Draw,snapshot=3Don", ) =20 self.vm.launch() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025462; cv=none; d=zohomail.com; s=zohoarc; b=DXr8rdfDdQiJNiu5p4aXUUdQbYJ0RpJq6HyqgNvlZfHh+91AEXNnrBSug14qGO9Tz6Y8bUJS1xitrJ7JZp8t21UkZ87vGxqnsayWyLizJY6/CLqXMmIfzaCtmsSILOGO96iJZCLQhMcgxigld29vplDw+ded85L8QgetkRpP/60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025462; 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=v7Z0KLmEGNJy3k9Kxz9p0nI4hIBCNF7VfRQuVKhp/do=; b=nYjLz4TraxzUCVxLQCXD2RXH1YRpOCwr6WH5PxnQb1K4OHI/PkJVhugVaxrIA40XVJOPsl/O7lbSb71npFyukh4VWJ6Gn/sYj8W1rB4338AQtrxQx78JKi038nvzNA3MCJUQUgNjeaaw89X9NIQvbZJarorYVTW+5cxA0ye0pz8= 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 1725025462569112.38473205351147; Fri, 30 Aug 2024 06:44:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qO-00063D-Eu; Fri, 30 Aug 2024 09:39:16 -0400 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 1sk1qM-0005xT-Vt for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qL-0005Cw-7N for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:14 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-29LGfD54PuCNpx6Z-ou-5g-1; Fri, 30 Aug 2024 09:39:09 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E38B51955BF9; Fri, 30 Aug 2024 13:39:07 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 19CB13001FE5; Fri, 30 Aug 2024 13:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v7Z0KLmEGNJy3k9Kxz9p0nI4hIBCNF7VfRQuVKhp/do=; b=Yiw9UC+j9Z8hMM+kr8Kn+LD4uO7urZPeiNPiWQ2jPXBdU9975m/Q4tG26i7jy3r7M773oC ZZXeJwhQq4hAbaFN3XaPdBhuxdwLzfTHgOMhUhiv5Re+SkctzgFjzxScxlu229hT8LefTK Ik3EkNiPXr1vtLAIhfunjWw9a9ypuwY= X-MC-Unique: 29LGfD54PuCNpx6Z-ou-5g-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 04/44] Bump avocado to 103.0 Date: Fri, 30 Aug 2024 15:37:58 +0200 Message-ID: <20240830133841.142644-5-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025463601116600 From: Cleber Rosa This bumps Avocado to latest the LTS release. An LTS release is one that can receive bugfixes and guarantees stability for a much longer period and has incremental minor releases made. Even though the 103.0 LTS release is pretty a rewrite of Avocado when compared to 88.1, the behavior of all existing tests under tests/avocado has been extensively tested no regression in behavior was found. To keep behavior of jobs as close as possible with previous version, this version bump keeps the execution serial (maximum of one task at a time being run). Reference: https://avocado-framework.readthedocs.io/en/103.0/releases/lts/1= 03_0.html Signed-off-by: Cleber Rosa Tested-by: Marcin Juszkiewicz Message-ID: <20240806173119.582857-2-crosa@redhat.com> Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- pythondeps.toml | 2 +- tests/Makefile.include | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pythondeps.toml b/pythondeps.toml index f6e590fdd8..175cf99241 100644 --- a/pythondeps.toml +++ b/pythondeps.toml @@ -30,5 +30,5 @@ sphinx_rtd_theme =3D { accepted =3D ">=3D0.5", installed = =3D "1.1.1" } # Note that qemu.git/python/ is always implicitly installed. # Prefer an LTS version when updating the accepted versions of # avocado-framework, for example right now the limit is 92.x. -avocado-framework =3D { accepted =3D "(>=3D88.1, <93.0)", installed =3D "8= 8.1", canary =3D "avocado" } +avocado-framework =3D { accepted =3D "(>=3D103.0, <104.0)", installed =3D = "103.0", canary =3D "avocado" } pycdlib =3D { accepted =3D ">=3D1.11.0" } diff --git a/tests/Makefile.include b/tests/Makefile.include index 6618bfed70..537804d101 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -141,7 +141,7 @@ check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-i= mages --show=3D$(AVOCADO_SHOW) run --job-results-dir=3D$(TESTS_RESUL= TS_DIR) \ $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \ --filter-by-tags-include-empty-key) \ - $(AVOCADO_CMDLINE_TAGS) \ + $(AVOCADO_CMDLINE_TAGS) --max-parallel-tasks=3D1 \ $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \ "AVOCADO", "tests/avocado") =20 --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025205; cv=none; d=zohomail.com; s=zohoarc; b=i7BL2mU/R4B2YEeARQ+Fp/RUSDIfOaQprhQtY0V64ywEgO8bBtc1EB/Wna3iazz1W/9V101nc/+buOGPeWDtkp5VfFd3ZvRW9DKT9HWE/cAJB2P2XHLak6gjHwuPHsQ/0hcXBT8NU+IF+YrJ0mZgA0R0YPNo1H4hlWYWpeJLwQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025205; 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=/dN9gCPu0QG++4eyrXhhQ+B9GdV6ADo3PdgbK33yghE=; b=VBM+qM6kaiNdIbaJLAEcQdRVuO27Rg+WqI4cqRWaRwxVBP7QroBN1cQX2rDKzjQOICmwqb0njmzanwxs5O1dnEkowZ/TuSTlrIbbaUNy1Dh4aIM00SfyzIvw8jJP+Ze1Plg7Tg4qxOiHoZ4k7+vwfxtDFxzpJA+7k8xrZ436BXc= 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 1725025205809432.46479554090934; Fri, 30 Aug 2024 06:40:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qW-0006Lw-1n; Fri, 30 Aug 2024 09:39:24 -0400 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 1sk1qU-0006LI-BQ for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qS-0005DH-TC for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:22 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-10-p0UJxzMuPVWsnl87_i1UEA-1; Fri, 30 Aug 2024 09:39:14 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8CE2B1955BF6; Fri, 30 Aug 2024 13:39:13 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 51AD3300019C; Fri, 30 Aug 2024 13:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/dN9gCPu0QG++4eyrXhhQ+B9GdV6ADo3PdgbK33yghE=; b=fBEINGQnbT8Tn1qJCmpNSJsxkOH4s5Oz7C5u+s0oQ8kUo0iUXZDuNHzUwCe7F8pGKMmpi9 jnq8eh5gUIhN6cu+LmEv8UqLfC0DG1TJfcuE896Ya1XttBFjLC/2YAThxX2kLeaqIOIOF6 x/5TYUpedPvPXkVS/ZR83YjvBeTPn6Y= X-MC-Unique: p0UJxzMuPVWsnl87_i1UEA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 05/44] tests/avocado/avocado_qemu: Fix the "from" statements in linuxtest.py Date: Fri, 30 Aug 2024 15:37:59 +0200 Message-ID: <20240830133841.142644-6-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025206444116600 Without this change, the new Avocado v103 fails to find the tests that are based on the LinuxTest class. Suggested-by: Cleber Rosa Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- tests/avocado/avocado_qemu/linuxtest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/avocado/avocado_qemu/linuxtest.py b/tests/avocado/avocad= o_qemu/linuxtest.py index e1dc838b1c..66fb9f1507 100644 --- a/tests/avocado/avocado_qemu/linuxtest.py +++ b/tests/avocado/avocado_qemu/linuxtest.py @@ -13,8 +13,8 @@ =20 from avocado.utils import cloudinit, datadrainer, process, vmimage =20 -from . import LinuxSSHMixIn -from . import QemuSystemTest +from avocado_qemu import LinuxSSHMixIn +from avocado_qemu import QemuSystemTest =20 if os.path.islink(os.path.dirname(os.path.dirname(__file__))): # The link to the avocado tests dir in the source code directory --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025437; cv=none; d=zohomail.com; s=zohoarc; b=CwcEcHbY57EHdYEXWf+gIPqI/BXutFoX7iJEwQWJKV7gHq4cqPUYRJhRNLM+m7HSKiYCn0JHXKCK5HDW+z28sigtp0vnDnei0eHIZYygxwkq9wiK2TfI0lUR0RnErm/mDwLKwo/0vI0kEjVxTLeDwJqaBgG+ZGi5eGRE+hfKlqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025437; 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=ypK+wG8zz5IxaaM1mfVnUg5rOTu5IlNWAieliQGOE4Y=; b=XuswuEcubiF3nJeKgQ8A79oQ9qUJ+RSIr4jiXGbD1mG/BuCQ7YZkP0aOJJnZlQtnFKQGT/tTmhNOFPjTRl0h3kPx2OJ9/ZoeizjIRYnUiqGTBSC2TINiJIyJ4CQ2KPBDJ2KLRozVtQwdwaTWjUT/34oVy4MrIB7CYFVfzihV4V8= 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 1725025437559907.3014771710892; Fri, 30 Aug 2024 06:43:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qf-0006ck-Qq; Fri, 30 Aug 2024 09:39:33 -0400 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 1sk1qd-0006Vy-IF for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qa-0005Dr-6P for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:30 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-_nhaSAY_NiaQOIRvNOZyNg-1; Fri, 30 Aug 2024 09:39:19 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 61D1819540F0; Fri, 30 Aug 2024 13:39:18 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0C3153001FC3; Fri, 30 Aug 2024 13:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ypK+wG8zz5IxaaM1mfVnUg5rOTu5IlNWAieliQGOE4Y=; b=VYycRVrtYObhwc6IQZdxcabprpONi6heSmCx1XcPAQ/75S5kOoxUAUr2Npc9fZwEmihN0I P9sVQd8SvMNNhF4bOI+ruOxqbXicRHqmSv+rP/2X1dYOuLq3I37vR9aIduQVDv2oq+tOVH +Qu+l+jJ0qVB8RNlLkJRtZH8DUdgjrQ= X-MC-Unique: _nhaSAY_NiaQOIRvNOZyNg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 06/44] tests/avocado/boot_linux_console: Remove the s390x subtest Date: Fri, 30 Aug 2024 15:38:00 +0200 Message-ID: <20240830133841.142644-7-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025439513116600 We've got a much more sophisticated, Fedora-based test for s390x ("test_s390x_fedora" in another file) already, so the test in boot_linux_console.py seems to be rather a waste of precious test cycles. Thus move the command line check and delete the s390x test in boot_linux_console.py. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- tests/avocado/boot_linux_console.py | 20 -------------------- tests/avocado/machine_s390_ccw_virtio.py | 2 ++ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux= _console.py index cffdd6b5a2..18c69d6acc 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -1304,26 +1304,6 @@ def test_aarch64_raspi3_atf(self): self.vm.launch() self.wait_for_console_pattern('version UEFI Firmware v1.15') =20 - def test_s390x_s390_ccw_virtio(self): - """ - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio - """ - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/29/Everything/s390x/os/i= mages' - '/kernel.img') - kernel_hash =3D 'e8e8439103ef8053418ef062644ffd46a7919313' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) - - self.vm.set_console() - kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3Dsclp0' - self.vm.add_args('-nodefaults', - '-kernel', kernel_path, - '-append', kernel_command_line) - self.vm.launch() - console_pattern =3D 'Kernel command line: %s' % kernel_command_line - self.wait_for_console_pattern(console_pattern) - def test_alpha_clipper(self): """ :avocado: tags=3Darch:alpha diff --git a/tests/avocado/machine_s390_ccw_virtio.py b/tests/avocado/machi= ne_s390_ccw_virtio.py index 26e938c9e9..7a214110fc 100644 --- a/tests/avocado/machine_s390_ccw_virtio.py +++ b/tests/avocado/machine_s390_ccw_virtio.py @@ -200,6 +200,8 @@ def test_s390x_fedora(self): '-device', 'virtio-rng-ccw,devno=3Dfe.1.9876', '-device', 'virtio-gpu-ccw,devno=3Dfe.2.5432') self.vm.launch() + self.wait_for_console_pattern('Kernel command line: %s' + % kernel_command_line) self.wait_for_console_pattern('Entering emergency mode') =20 # Some tests to see whether the CLI options have been considered: --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025195; cv=none; d=zohomail.com; s=zohoarc; b=A5EK3ha1LE0mYCESzx3jaXuV/l4yNek5YufOwuvFyxS2bB/39AEx8cSCzCAKQHim386LY5XwHjifyyXtfWfbC3QTmsFxVQtNw+51zPONkzmY0xadBbEIg12Lnh99VckA9DzYi4y9gy5azNBQGCaUxvuQEGRDReWasOJ53Yg0Osw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025195; 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=b/ecAoJl2loxheCCwXqB5zMAAnRuyJXrRKNIirReXxI=; b=lCev30iNu1YBZEeHrULbVkoo1w0oMVVLwTkckQoD8CwwleBmY3toV5gFagW1/unfMfW7uFD35TE1XfD6F7hNpzZzJ6Z+sY7SfG/CXEm+J3jEAAe+ROU4y0a+YmCIhjoMb3Z++iX1T555kV8n2eQTBpVlEAR+Bxb5+As7PxEK78Y= 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 1725025195228916.5446316171654; Fri, 30 Aug 2024 06:39:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qe-0006Wd-33; Fri, 30 Aug 2024 09:39:32 -0400 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 1sk1qd-0006Ve-B3 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qa-0005Dv-LS for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:30 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-9TFWmcyYP8GjHaCpTek9WQ-1; Fri, 30 Aug 2024 09:39:22 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B6D4219560AD; Fri, 30 Aug 2024 13:39:21 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D4C0F300019C; Fri, 30 Aug 2024 13:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b/ecAoJl2loxheCCwXqB5zMAAnRuyJXrRKNIirReXxI=; b=Wn/60wq83pczTtdeJzj55ZfDcxq4F+uSaOy1JsgRk2DytVFgUWGVlZwg4x+YmXBCkqgSsu ulZtW6BFGpqGdys91WrLjl15a+5SwRTR9pkOISQngNk91acjhP8+WPF+XLxW8OnlayiYCV yrvN0XV+6T48LerbTnb7jYOEBJ04nzY= X-MC-Unique: 9TFWmcyYP8GjHaCpTek9WQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 07/44] python: Install pycotap in our venv if necessary Date: Fri, 30 Aug 2024 15:38:01 +0200 Message-ID: <20240830133841.142644-8-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025196737116600 The upcoming functional tests will require pycotap for providing TAP output from the python-based tests. Since we want to be able to run some of the tests offline by default, too, let's install it along with meson in our venv if necessary (it's size is only 5 kB, so adding the wheel here should not really be a problem). The wheel file has been obtained with: pip download --only-binary :all: --dest . --no-cache pycotap Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- python/wheels/pycotap-1.3.1-py3-none-any.whl | Bin 0 -> 5119 bytes pythondeps.toml | 1 + 2 files changed, 1 insertion(+) create mode 100644 python/wheels/pycotap-1.3.1-py3-none-any.whl diff --git a/python/wheels/pycotap-1.3.1-py3-none-any.whl b/python/wheels/p= ycotap-1.3.1-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..9c2c7d259365c8a0487228c6878= e2c0b10ba6bdd GIT binary patch literal 5119 zcmeI0c{r49-^VX&3}X-3cO#7@+t|t4j6saOFm|%Vlq5p-b*v*b+!#WUElXPLTgIN! zWLF9yOO}-P=3Dzd?_J-zqc^Y8P=3D^F5C1I?g|?>vNoc{Jy{6`8`b$6qIZL0MG#GGI+~H zES3$R0sv1|0AK|Gz(3g84}8-dSoQbO2%udjK9nR1 zX@Mw7zRZ{mFv|`)4NPytMe=3DeP5h(K}-@36c__dlrZxYgrbFtHmU$`UJ-juerPK0GR zshPauoDlZTdy!Dv>PW-C`_4w>c^0|S#!PJQr&Rx&%f}eZTPHMc1X8cU%aYZ2Q)PK2 zm@9*23{tU5IZhDSn50gKRt1xkbO~0B`EYJDWa1^0xIIV#bxv{|)IIpNc11RFU$I6~(T)|;Gf1>iao+q>y8Qu&AR zX&ZGcxw#t-3T;Z$&qQX^FO{VmvdcLPNNXO?UxY^wdnFsSo`}Ojht)qBW)R#y&_6pLsGnx#HyZ>EF1+wb6y9RGk}| zm|OSaNVkTPnmS*=3D!%K8^w1vs;6Ns#%7*MoHUtf9N>mJwo_){ZBm9}~XK?Na2=3DL8ds ziyM~BIXK2LGrDWYR?Js<&cYIA4VTCR^oo`(vRq1Uid<2D0I!6n9V5Vs#*|i-snEN6nLM3LEgwhU2dxNUtb%K^JAaFZe0iU1Gur}{wa*q5c6a@yHteQ+%(2J>nTbYw0soAc zGzp7E(+$gN)nkBfmNxcqBpa`}?Nj(bK71 zeA%e>r%@xv#hCfu#H-)c?JC5kq@H~t-wu09ER5T4Nqp@_VX0&s$fo}4!Yz?aeMh`D z<^;?zR(m{Wz~?cHVVN%HF*on@H1D*XMlUXr;-1eNgKNHS+_+Io!?~G%d5|vy>`kiZmn1pNZ3=3D@w%o|a%K`xB<_aHhsaF%ICb4Jqcy>+>z7lj6t$07eM_{C{8 zS*_R&5^>ee_h78y;Qml@k&aVFH|!v+ryrm9M170dm!!J8zxQ0p^xf|Bh|j(UU%He1 zN!?dLj5|ASyKJF>m|A=3DjBE4_72;3^vM*Tinso5R2>y}i4K(8f}HN@8Y9kdddc;)Bi z?j$k7X0B9M7x6Lio2u_f6Ds8$;0?a&!}!_b0Z3lMM^wNwfFURR zdWk;8O)`#y$R8P>MA@%A06to-;ocOykBG*IKwHv3$FkR%hI#Zs_U- z<_~SfK?b{6N~=3D1}FU+Du`BCNbHo1SynT+a}GhJVcX}tikUG5q%D_qBlaM=3D+DzABn$ zjyGXbWxADZydWKL50Mw5*qJQ&dTx*9c~`{snkGopR7n++t&n>S}&WMm5 zhmrO}OADL8%)vBEP?KqCo7MTH6Xj0eT~>`h>}v{h2(P#%@AW!ZTH1;7;kdG0(*jQo zD62ScMz)JY7t}L{w2^q&=3DAIyt^-c2; zvw}&4#JSNk?B%-GY{iWQbPel7MQ@-BEZSoe1)`>wbDstGDobMTm2|AN)-Le>Rm3bN zc*}oN#GZi|sHd-+-+znvzeW6?Tg1coH;Yk$Na?U2T+hv;`@J zTZuk2|AD{|4(XVBo1H2_+jMO5kB{{eF6Wx5HpbFKUl*+;LEhJ_ZpH2k?p0%RtI-tP zTb=3Dc~X=3D-X}gf&@-qIBDD(So)C;Opkk%BRZ6xYvtH2-hzwJ}H0ZIxog}6XZ;B(QrH& zDTOWiUe&7UhTF{3|FTQLl?^a$z*zi?aB=3D?63OM$Yc(C*u{EWjs?QojtOmYt zS@F$HW~Dk4gX8PvDf&*Uk)S(g85o6G-_PVNfA~Z<^pwp*HBhn0`kQx%*xu)_?Xk^4 z&rlXG28b71^-Y;R&V;DBK1LDq$m>3qarlHli^{WftFEl{e26;G&AoONT86IPE@pg4^_N*mcYB7tp4T^K6pEDFtjqc2sps?vNDcR9O!DQtk!Z29<`jlH}Kz zo9&2zue)Xg(s{i!ch?UZfpG^ z$*(=3D{veXW|;7#=3DJB@B(-_VmD-$vnyDKyF>Z@6Kf;2G6)Bnk85=3DjIr97&%j)G&VM=3D4fY2LqdAAKc5YBLk8(S22@nC?-k8WsJ5#1!XIf~vI5PLCs`abP|JJ7 z)T=3DBQQsP{Q(i*H(@-kbCZYS5czc$@gDGn_Sriq%%%v^QZ5Dp4`4$!Y!ppg)v{1wMT z*Ke*KY<15HLfB%A<@PVBNIz6ZzBksB=3DLsH6aOaxB4zSqwT0)P{YQovO#%g&7XHl>M6%@;^o(BNn`@{Pi2U{8H=3D^4=3Dt8X}3qUuK^ znar5nOn?ay0fnFHm98-}g!i73ikCiCc5X;!NUnZJZg>IIHz+;4eQF#Gfx?NsMm1&- ziId2;ptD8|W{^_(apLnq#0zBqy@fgQpN@Fnr{e`JAp_8#ksSa;f3q!&pTC2*>lIgT zDa=3D)jWU0}B^x0E0zrr-`+Nrpc0f0X_0Py_=3DW~QfOVy63WsL8iT3kaXp7>uNq(cqhYPaMMk;8^*&b*M+^C$`)@pVbSOFZ9_6lWl_C-OZK^;fpzvL%)1ya9h=3D~5 z_mCtLnrQEvj%hK;#R_gS4g$VjVv4tW^Ok}W4ia4g(n~xTw@6;HAHu9vo03mezljm* zGf;hI_f>z#@&)=3Dv9zsIHKGE#3gbBb!6>@pMwh09$sLhZa%5fsbYn!-=3D1.1.0", installed =3D "1.2.3", canary =3D "m= eson" } +pycotap =3D { accepted =3D ">=3D1.1.0", installed =3D "1.3.1" } =20 [docs] # Please keep the installed versions in sync with docs/requirements.txt --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025447; cv=none; d=zohomail.com; s=zohoarc; b=OrY9V5IXzrG03fPhbdmaLXufPi0Cjli43fB2O4lYyntX2aGpSvPnHz28QyPsp67B0YsPkcosj2vjLfN0tFJxbXGW1s5APDjSGV8GXBIeMam/2ysU9giejDzrsWsUsXPixiOG9Y+ERqeYFr6vAoXD8CSWXKMryPyULAAAGHDFziQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025447; 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=S6WRUC+KrIKL3/ALVRrZgrLXavPJ1dV5eevyeUYidfo=; b=YHK4Wzv5RsAM5SmmeDu20FdJ+Pl6xLxeTbSaDRYaNDU0cMKhiNr9EdC8+Vt/tcQzrtWd6WLTql8GtKshKVr+S3fdpm3n7KPCyI08v0bNtkstHL/HnDVXktWJ/+tn60addkdbzXFIHM3Dzqn3sTfPcOmLZIw1tX+zYBWOMxHOFM4= 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 1725025446537752.9748718048085; Fri, 30 Aug 2024 06:44:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qi-0006jJ-N8; Fri, 30 Aug 2024 09:39:36 -0400 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 1sk1qg-0006eP-9M for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qd-0005EE-Mg for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:33 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-Q3-vnTFhPxaza-CxMzOCOQ-1; Fri, 30 Aug 2024 09:39:26 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 819031955BEF; Fri, 30 Aug 2024 13:39:25 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 71A20300019C; Fri, 30 Aug 2024 13:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S6WRUC+KrIKL3/ALVRrZgrLXavPJ1dV5eevyeUYidfo=; b=O5cDg7XmmIVJnSTPjY1/AqvUpxL09Q/7DfAtGXhWbC0cvcuMTns+S15NetQTDx3DFymtXK 6tz8wog5TnHF1fRXtZpQo4hicdbsbahRin4dHo8+P/ejE2bFa/EPPhi0Sft2XlXQimzbuA sHcxHNuqmRoNjBaJ2yXuWPlgUDe3vww= X-MC-Unique: Q3-vnTFhPxaza-CxMzOCOQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 08/44] tests/functional: Add base classes for the upcoming pytest-based tests Date: Fri, 30 Aug 2024 15:38:02 +0200 Message-ID: <20240830133841.142644-9-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025447623116600 The files are mostly a copy of the tests/avocado/avocado_qemu/__init__.py file with some adjustments to get rid of the Avocado dependencies (i.e. we also have to drop the LinuxSSHMixIn and LinuxTest for now). The emulator binary and build directory are now passed via environment variables that will be set via meson.build later. Signed-off-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 5 + tests/functional/qemu_test/__init__.py | 13 ++ tests/functional/qemu_test/cmd.py | 178 +++++++++++++++++++++++++ tests/functional/qemu_test/config.py | 36 +++++ tests/functional/qemu_test/testcase.py | 153 +++++++++++++++++++++ 5 files changed, 385 insertions(+) create mode 100644 tests/functional/qemu_test/__init__.py create mode 100644 tests/functional/qemu_test/cmd.py create mode 100644 tests/functional/qemu_test/config.py create mode 100644 tests/functional/qemu_test/testcase.py diff --git a/MAINTAINERS b/MAINTAINERS index 3584d6a6c6..80cc84dd99 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4146,6 +4146,11 @@ F: .gitlab-ci.d/cirrus/freebsd* F: tests/vm/freebsd W: https://cirrus-ci.com/github/qemu/qemu =20 +Functional testing framework +M: Thomas Huth +R: Philippe Mathieu-Daud=C3=A9 +F: tests/functional/qemu_test/ + Windows Hosted Continuous Integration M: Yonggang Luo S: Maintained diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu= _test/__init__.py new file mode 100644 index 0000000000..2f1e0bc70d --- /dev/null +++ b/tests/functional/qemu_test/__init__.py @@ -0,0 +1,13 @@ +# Test class and utilities for functional tests +# +# Copyright 2024 Red Hat, Inc. +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + + +from .config import BUILD_DIR +from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \ + interrupt_interactive_console_until_pattern, wait_for_console_pattern,= \ + exec_command, exec_command_and_wait_for_pattern +from .testcase import QemuSystemTest, QemuBaseTest diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test= /cmd.py new file mode 100644 index 0000000000..8580ee8faf --- /dev/null +++ b/tests/functional/qemu_test/cmd.py @@ -0,0 +1,178 @@ +# Test class and utilities for functional tests +# +# Copyright 2018, 2024 Red Hat, Inc. +# +# Original Author (Avocado-based tests): +# Cleber Rosa +# +# Adaption for standalone version: +# Thomas Huth +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import logging +import os +import os.path +import subprocess + + +def has_cmd(name, args=3DNone): + """ + This function is for use in a @skipUnless decorator, e.g.: + + @skipUnless(*has_cmd('sudo -n', ('sudo', '-n', 'true'))) + def test_something_that_needs_sudo(self): + ... + """ + + if args is None: + args =3D ('which', name) + + try: + _, stderr, exitcode =3D run_cmd(args) + except Exception as e: + exitcode =3D -1 + stderr =3D str(e) + + if exitcode !=3D 0: + cmd_line =3D ' '.join(args) + err =3D f'{name} required, but "{cmd_line}" failed: {stderr.strip(= )}' + return (False, err) + else: + return (True, '') + +def has_cmds(*cmds): + """ + This function is for use in a @skipUnless decorator and + allows checking for the availability of multiple commands, e.g.: + + @skipUnless(*has_cmds(('cmd1', ('cmd1', '--some-parameter')), + 'cmd2', 'cmd3')) + def test_something_that_needs_cmd1_and_cmd2(self): + ... + """ + + for cmd in cmds: + if isinstance(cmd, str): + cmd =3D (cmd,) + + ok, errstr =3D has_cmd(*cmd) + if not ok: + return (False, errstr) + + return (True, '') + +def run_cmd(args): + subp =3D subprocess.Popen(args, + stdout=3Dsubprocess.PIPE, + stderr=3Dsubprocess.PIPE, + universal_newlines=3DTrue) + stdout, stderr =3D subp.communicate() + ret =3D subp.returncode + + return (stdout, stderr, ret) + +def is_readable_executable_file(path): + return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) + +def _console_interaction(test, success_message, failure_message, + send_string, keep_sending=3DFalse, vm=3DNone): + assert not keep_sending or send_string + if vm is None: + vm =3D test.vm + console =3D vm.console_file + console_logger =3D logging.getLogger('console') + while True: + if send_string: + vm.console_socket.sendall(send_string.encode()) + if not keep_sending: + send_string =3D None # send only once + + # Only consume console output if waiting for something + if success_message is None and failure_message is None: + if send_string is None: + break + continue + + try: + msg =3D console.readline().decode().strip() + except UnicodeDecodeError: + msg =3D None + if not msg: + continue + console_logger.debug(msg) + if success_message is None or success_message in msg: + break + if failure_message and failure_message in msg: + console.close() + fail =3D 'Failure message found in console: "%s". Expected: "%= s"' % \ + (failure_message, success_message) + test.fail(fail) + +def interrupt_interactive_console_until_pattern(test, success_message, + failure_message=3DNone, + interrupt_string=3D'\r'): + """ + Keep sending a string to interrupt a console prompt, while logging the + console output. Typical use case is to break a boot loader prompt, suc= h: + + Press a key within 5 seconds to interrupt boot process. + 5 + 4 + 3 + 2 + 1 + Booting default image... + + :param test: a test containing a VM that will have its console + read and probed for a success or failure message + :type test: :class:`qemu_test.QemuSystemTest` + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + :param interrupt_string: a string to send to the console before trying + to read a new line + """ + _console_interaction(test, success_message, failure_message, + interrupt_string, True) + +def wait_for_console_pattern(test, success_message, failure_message=3DNone, + vm=3DNone): + """ + Waits for messages to appear on the console, while logging the content + + :param test: a test containing a VM that will have its console + read and probed for a success or failure message + :type test: :class:`qemu_test.QemuSystemTest` + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + _console_interaction(test, success_message, failure_message, None, vm= =3Dvm) + +def exec_command(test, command): + """ + Send a command to a console (appending CRLF characters), while logging + the content. + + :param test: a test containing a VM. + :type test: :class:`qemu_test.QemuSystemTest` + :param command: the command to send + :type command: str + """ + _console_interaction(test, None, None, command + '\r') + +def exec_command_and_wait_for_pattern(test, command, + success_message, failure_message=3DN= one): + """ + Send a command to a console (appending CRLF characters), then wait + for success_message to appear on the console, while logging the. + content. Mark the test as failed if failure_message is found instead. + + :param test: a test containing a VM that will have its console + read and probed for a success or failure message + :type test: :class:`qemu_test.QemuSystemTest` + :param command: the command to send + :param success_message: if this message appears, test succeeds + :param failure_message: if this message appears, test fails + """ + _console_interaction(test, success_message, failure_message, command += '\r') diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_t= est/config.py new file mode 100644 index 0000000000..edd75b7fd0 --- /dev/null +++ b/tests/functional/qemu_test/config.py @@ -0,0 +1,36 @@ +# Test class and utilities for functional tests +# +# Copyright 2018, 2024 Red Hat, Inc. +# +# Original Author (Avocado-based tests): +# Cleber Rosa +# +# Adaption for standalone version: +# Thomas Huth +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import os +from pathlib import Path + + +def _source_dir(): + # Determine top-level directory of the QEMU sources + return Path(__file__).parent.parent.parent.parent + +def _build_dir(): + root =3D os.getenv('QEMU_BUILD_ROOT') + if root is not None: + return Path(root) + # Makefile.mtest only exists in build dir, so if it is available, use = CWD + if os.path.exists('Makefile.mtest'): + return Path(os.getcwd()) + + root =3D os.path.join(_source_dir(), 'build') + if os.path.exists(root): + return Path(root) + + raise Exception("Cannot identify build dir, set QEMU_BUILD_ROOT") + +BUILD_DIR =3D _build_dir() diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py new file mode 100644 index 0000000000..6905675778 --- /dev/null +++ b/tests/functional/qemu_test/testcase.py @@ -0,0 +1,153 @@ +# Test class and utilities for functional tests +# +# Copyright 2018, 2024 Red Hat, Inc. +# +# Original Author (Avocado-based tests): +# Cleber Rosa +# +# Adaption for standalone version: +# Thomas Huth +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import logging +import os +import pycotap +import sys +import unittest +import uuid + +from qemu.machine import QEMUMachine +from qemu.utils import kvm_available, tcg_available + +from .cmd import run_cmd +from .config import BUILD_DIR + + +class QemuBaseTest(unittest.TestCase): + + qemu_bin =3D os.getenv('QEMU_TEST_QEMU_BINARY') + arch =3D None + + workdir =3D None + log =3D logging.getLogger('qemu-test') + + def setUp(self, bin_prefix): + self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be= set') + self.arch =3D self.qemu_bin.split('-')[-1] + + self.workdir =3D os.path.join(BUILD_DIR, 'tests/functional', self.= arch, + self.id()) + os.makedirs(self.workdir, exist_ok=3DTrue) + + def main(): + path =3D os.path.basename(sys.argv[0])[:-3] + tr =3D pycotap.TAPTestRunner(message_log =3D pycotap.LogMode.LogTo= Error, + test_output_log =3D pycotap.LogMode.Log= ToError) + unittest.main(module =3D None, testRunner =3D tr, argv=3D["__dummy= __", path]) + + +class QemuSystemTest(QemuBaseTest): + """Facilitates system emulation tests.""" + + cpu =3D None + machine =3D None + _machinehelp =3D None + + def setUp(self): + self._vms =3D {} + + super().setUp('qemu-system-') + + def set_machine(self, machinename): + # TODO: We should use QMP to get the list of available machines + if not self._machinehelp: + self._machinehelp =3D run_cmd([self.qemu_bin, '-M', 'help'])[0= ]; + if self._machinehelp.find(machinename) < 0: + self.skipTest('no support for machine ' + machinename) + self.machine =3D machinename + + def require_accelerator(self, accelerator): + """ + Requires an accelerator to be available for the test to continue + + It takes into account the currently set qemu binary. + + If the check fails, the test is canceled. If the check itself + for the given accelerator is not available, the test is also + canceled. + + :param accelerator: name of the accelerator, such as "kvm" or "tcg" + :type accelerator: str + """ + checker =3D {'tcg': tcg_available, + 'kvm': kvm_available}.get(accelerator) + if checker is None: + self.skipTest("Don't know how to check for the presence " + "of accelerator %s" % accelerator) + if not checker(qemu_bin=3Dself.qemu_bin): + self.skipTest("%s accelerator does not seem to be " + "available" % accelerator) + + def require_netdev(self, netdevname): + netdevhelp =3D run_cmd([self.qemu_bin, + '-M', 'none', '-netdev', 'help'])[0]; + if netdevhelp.find('\n' + netdevname + '\n') < 0: + self.skipTest('no support for " + netdevname + " networking') + + def require_device(self, devicename): + devhelp =3D run_cmd([self.qemu_bin, + '-M', 'none', '-device', 'help'])[0]; + if devhelp.find(devicename) < 0: + self.skipTest('no support for device ' + devicename) + + def _new_vm(self, name, *args): + vm =3D QEMUMachine(self.qemu_bin, base_temp_dir=3Dself.workdir) + self.log.debug('QEMUMachine "%s" created', name) + self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir) + self.log.debug('QEMUMachine "%s" log_dir: %s', name, vm.log_dir) + if args: + vm.add_args(*args) + return vm + + @property + def vm(self): + return self.get_vm(name=3D'default') + + def get_vm(self, *args, name=3DNone): + if not name: + name =3D str(uuid.uuid4()) + if self._vms.get(name) is None: + self._vms[name] =3D self._new_vm(name, *args) + if self.cpu is not None: + self._vms[name].add_args('-cpu', self.cpu) + if self.machine is not None: + self._vms[name].set_machine(self.machine) + return self._vms[name] + + def set_vm_arg(self, arg, value): + """ + Set an argument to list of extra arguments to be given to the QEMU + binary. If the argument already exists then its value is replaced. + + :param arg: the QEMU argument, such as "-cpu" in "-cpu host" + :type arg: str + :param value: the argument value, such as "host" in "-cpu host" + :type value: str + """ + if not arg or not value: + return + if arg not in self.vm.args: + self.vm.args.extend([arg, value]) + else: + idx =3D self.vm.args.index(arg) + 1 + if idx < len(self.vm.args): + self.vm.args[idx] =3D value + else: + self.vm.args.append(value) + + def tearDown(self): + for vm in self._vms.values(): + vm.shutdown() + super().tearDown() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025396; cv=none; d=zohomail.com; s=zohoarc; b=EuvTyl5ydsMjxLWDpyDwM8qSW9v9IY4QCy1uPffimmx/1Hk44xkobj4WfPtX6xfGTge5n8cMgB1THWLZsvkksZY/BANs/RIsWkaFg947hfT3f3dligb8MuBv5Zq8e8ExEy8dgmFKUeUiO0iTOoopmVTYr08HIvyYlfowoKVkcHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025396; 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=fQSInVSD+wTiboOexxLtN6S7PAvTtzt1nd8Jy3LhkRs=; b=BFINW+IpUF7XxVVdjqrDQDAGY7/yYkMtS4NXCMsVtXQWdyrLjCmeGqnKIexVdvMOVlz1bXyf7r0JJF2acrKgvZlrEzrhMuDvj/LFiFyjQtaPJXupH+SG8Fm7o6cfpc1wxtIOOgRT4ZjbSxuXtX1ctKiphln0st1kx9tqqc5AzvE= 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 1725025396184800.9431998367302; Fri, 30 Aug 2024 06:43:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qj-0006pr-EB; Fri, 30 Aug 2024 09:39:37 -0400 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 1sk1qh-0006i2-9z for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qf-0005Ea-MN for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:35 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-389-aiODZBxsOziW5mOMnLKmeQ-1; Fri, 30 Aug 2024 09:39:31 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6E0AD1955D4C; Fri, 30 Aug 2024 13:39:30 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0C016300019C; Fri, 30 Aug 2024 13:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fQSInVSD+wTiboOexxLtN6S7PAvTtzt1nd8Jy3LhkRs=; b=bHIUOc3A/BtKg0QGku5C3cJLAZqNsHsAl88NI0a0czwy6g1P0tDrCipKATmgEWO6qJYR0j LEyKvamQl2XW8KQqwvrD/6C8Rzg65GmBYBBzNoR/4CC4I98GTlkVSMwoCXPei1poYVd0/9 eGN0r75h4t3czUutddjrTv131OxDyzU= X-MC-Unique: aiODZBxsOziW5mOMnLKmeQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 09/44] tests/functional: Set up logging Date: Fri, 30 Aug 2024 15:38:03 +0200 Message-ID: <20240830133841.142644-10-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025397218116600 Create log files for each test separately, one file that contains the basic logging and one that contains the console output. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- tests/functional/qemu_test/testcase.py | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index 6905675778..b2dd863c6e 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -31,7 +31,8 @@ class QemuBaseTest(unittest.TestCase): arch =3D None =20 workdir =3D None - log =3D logging.getLogger('qemu-test') + log =3D None + logdir =3D None =20 def setUp(self, bin_prefix): self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be= set') @@ -41,6 +42,20 @@ def setUp(self, bin_prefix): self.id()) os.makedirs(self.workdir, exist_ok=3DTrue) =20 + self.logdir =3D self.workdir + self.log =3D logging.getLogger('qemu-test') + self.log.setLevel(logging.DEBUG) + self._log_fh =3D logging.FileHandler(os.path.join(self.logdir, + 'base.log'), mode= =3D'w') + self._log_fh.setLevel(logging.DEBUG) + fileFormatter =3D logging.Formatter( + '%(asctime)s - %(levelname)s: %(message)s') + self._log_fh.setFormatter(fileFormatter) + self.log.addHandler(self._log_fh) + + def tearDown(self): + self.log.removeHandler(self._log_fh) + def main(): path =3D os.path.basename(sys.argv[0])[:-3] tr =3D pycotap.TAPTestRunner(message_log =3D pycotap.LogMode.LogTo= Error, @@ -60,6 +75,15 @@ def setUp(self): =20 super().setUp('qemu-system-') =20 + console_log =3D logging.getLogger('console') + console_log.setLevel(logging.DEBUG) + self._console_log_fh =3D logging.FileHandler(os.path.join(self.wor= kdir, + 'console.log'), mode=3D= 'w') + self._console_log_fh.setLevel(logging.DEBUG) + fileFormatter =3D logging.Formatter('%(asctime)s: %(message)s') + self._console_log_fh.setFormatter(fileFormatter) + console_log.addHandler(self._console_log_fh) + def set_machine(self, machinename): # TODO: We should use QMP to get the list of available machines if not self._machinehelp: @@ -150,4 +174,5 @@ def set_vm_arg(self, arg, value): def tearDown(self): for vm in self._vms.values(): vm.shutdown() + logging.getLogger('console').removeHandler(self._console_log_fh) super().tearDown() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025260; cv=none; d=zohomail.com; s=zohoarc; b=FpQ/teiUdFh9nGYUTL5PYaabeF+tLIYmIVasWhw/DKhYttscWbaFPTFORtnn7ZY2oMolJy6LhOidFx17OfP0CNRSbWwDzzd2qZyTgW7OnCWmdvTwK3YW5v/2JCqiNK7cQg3BZBN1bOyTfq5e5d/EIjfOZ1qjTQRxcDcTELprin8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025260; 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=PkVIFbqGNBKi87+Qhd5tJiEOm7IYbePTteBbp7+Sfoo=; b=aPjQjhXY2/ObNGmQP0QhpK8eLbOuswNE1EPfCL4GAuNkrb04oEjBLizdpx2pYOI/0KxQ2LUuUuS3jmquzAc0ZThbzvG2tviWILTnz0IAgtjnwY2knEZWPDhyoymzdnu4t71dlZgz2X4X/yLGSvUnEpQRFj11mjviojriemanRdM= 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 1725025260001580.4414639945167; Fri, 30 Aug 2024 06:41:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qr-0007FB-IB; Fri, 30 Aug 2024 09:39:45 -0400 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 1sk1qp-0007D2-Nc for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qn-0005FE-26 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:43 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-640-YnuNltLTNku9bTDY5P1oLQ-1; Fri, 30 Aug 2024 09:39:36 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 35E211955D48; Fri, 30 Aug 2024 13:39:35 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E5089300019C; Fri, 30 Aug 2024 13:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PkVIFbqGNBKi87+Qhd5tJiEOm7IYbePTteBbp7+Sfoo=; b=YYiE4cK9FE3TLGMaZ6mpfNA/b8GpOx+aIBon+P2JaU5mlC6gg11YhJr4QWg2ZQZB6BLn3B 5UWvwyhroCsaYOvamLAQgBkGrWUwXMh7LF6FTTNFCAhahf3N/BSxF1ErGf96Vy41rP3tfV T+63d91U1jaWKAaj3HCmxla0edST1S8= X-MC-Unique: YnuNltLTNku9bTDY5P1oLQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 10/44] tests/Makefile.include: Increase the level of indentation in the help text Date: Fri, 30 Aug 2024 15:38:04 +0200 Message-ID: <20240830133841.142644-11-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025260628116600 The next patch is going to add some entries that need more space between the command and the help text, so let's increase the indentation here first. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Thomas Huth --- tests/Makefile.include | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 537804d101..fbb1a4b211 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -3,28 +3,28 @@ .PHONY: check-help check-help: @echo "Regression testing targets:" - @echo " $(MAKE) check Run block, qapi-schema, unit, soft= float, qtest and decodetree tests" - @echo " $(MAKE) bench Run speed tests" + @echo " $(MAKE) check Run block, qapi-schema, unit, so= ftfloat, qtest and decodetree tests" + @echo " $(MAKE) bench Run speed tests" @echo @echo "Individual test suites:" - @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" - @echo " $(MAKE) check-qtest Run qtest tests" - @echo " $(MAKE) check-unit Run qobject tests" - @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" - @echo " $(MAKE) check-block Run block tests" + @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" + @echo " $(MAKE) check-qtest Run qtest tests" + @echo " $(MAKE) check-unit Run qobject tests" + @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" + @echo " $(MAKE) check-block Run block tests" ifneq ($(filter $(all-check-targets), check-softfloat),) - @echo " $(MAKE) check-tcg Run TCG tests" - @echo " $(MAKE) check-softfloat Run FPU emulation tests" + @echo " $(MAKE) check-tcg Run TCG tests" + @echo " $(MAKE) check-softfloat Run FPU emulation tests" endif - @echo " $(MAKE) check-avocado Run avocado (integration) tests fo= r currently configured targets" + @echo " $(MAKE) check-avocado Run avocado (integration) tests = for currently configured targets" @echo - @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test r= eport" - @echo " $(MAKE) check-venv Creates a Python venv for tests" - @echo " $(MAKE) check-clean Clean the tests and related data" + @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test= report" + @echo " $(MAKE) check-venv Creates a Python venv for tests" + @echo " $(MAKE) check-clean Clean the tests and related data" @echo @echo "The following are useful for CI builds" - @echo " $(MAKE) check-build Build most test binaries" - @echo " $(MAKE) get-vm-images Downloads all images used by avoca= do tests, according to configured targets (~350 MB each, 1.5 GB max)" + @echo " $(MAKE) check-build Build most test binaries" + @echo " $(MAKE) get-vm-images Downloads all images used by avo= cado tests, according to configured targets (~350 MB each, 1.5 GB max)" @echo @echo @echo "The variable SPEED can be set to control the gtester speed setting= ." --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025467; cv=none; d=zohomail.com; s=zohoarc; b=hqAbd5D4gx0SrhUQ9LI+IbSTwzw+OIZd6xylWVTZOCqki2h4XOsGQDJ2YrYvlRujBANXV15z1AbzTP9P4SeL6MzP7d39RWPOwWzbAMlRGdfWjfvepmwQKalrk3L9mQFxFFut+yYS/eA4Z9RhM3V/7f1+xMln8inN5QOS7E9YVNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025467; 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=oyJ1Na6ZOFRqsA2Tx/ekQJYvHzOg6wjyd7n+vYrvIAA=; b=PU5AfvpTxC/kk9Idu0t7aqRexPCakyvmcS2He6rc6i5bnE3dsyjbokGSVsBd8ZNut8MCDFmvJfXJaJgOTLw+hguOJnE+JgODaE4yynN4Cybpb+PeZKk6NvjMG3/pCnjVxXjOHJvgaComE9+NAqyQ8w3iIUvnR+gIXtplHUcafrI= 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 1725025467447236.44562120479907; Fri, 30 Aug 2024 06:44:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1qu-0007P2-G0; Fri, 30 Aug 2024 09:39:48 -0400 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 1sk1qs-0007Jv-Rw for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qr-0005Fa-3G for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:46 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-320-GoinHH0cMq-jL2ldMVUT2Q-1; Fri, 30 Aug 2024 09:39:41 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 69D091955D53; Fri, 30 Aug 2024 13:39:40 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CE9CA300019C; Fri, 30 Aug 2024 13:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oyJ1Na6ZOFRqsA2Tx/ekQJYvHzOg6wjyd7n+vYrvIAA=; b=a6P2pYbqgdcwOzSd8K4bWtraQOSOjE575QGyXiv+fdGGFWMbCWb1G1N9uWCBKVwSxvOrPw m9o8TInbRJSNlWXtGfyB4JHdpoQRY4RNBjL0sHm03YZSAuO/iMrW+Aro5Otsc7SostMLGA y6uODNAYItBVHNzuGqkvCr6n04kknVw= X-MC-Unique: GoinHH0cMq-jL2ldMVUT2Q-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 11/44] tests/functional: Prepare the meson build system for the functional tests Date: Fri, 30 Aug 2024 15:38:05 +0200 Message-ID: <20240830133841.142644-12-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025469705116600 Provide a meson.build file for the upcoming python-based functional tests, and add some wrapper glue targets to the tests/Makefile.include file. We are going to use two "speed" modes for the functional tests: The "quick" tests can be run at any time (i.e. also during "make check"), while the "thorough" tests should only be run when running a "make check-functional" test run (since these tests might download additional assets from the internet). The changes to the meson.build files are partly based on an earlier patch by Ani Sinha. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- tests/Makefile.include | 11 +++++ tests/functional/meson.build | 81 ++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 93 insertions(+) create mode 100644 tests/functional/meson.build diff --git a/tests/Makefile.include b/tests/Makefile.include index fbb1a4b211..66c8cc3123 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -9,6 +9,8 @@ check-help: @echo "Individual test suites:" @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" @echo " $(MAKE) check-qtest Run qtest tests" + @echo " $(MAKE) check-functional Run python-based functional test= s" + @echo " $(MAKE) check-functional-TARGET Run functional tests for a given= target" @echo " $(MAKE) check-unit Run qobject tests" @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" @echo " $(MAKE) check-block Run block tests" @@ -152,6 +154,15 @@ check-acceptance-deprecated-warning: =20 check-acceptance: check-acceptance-deprecated-warning | check-avocado =20 +FUNCTIONAL_TARGETS=3D$(patsubst %-softmmu,check-functional-%, $(filter %-s= oftmmu,$(TARGETS))) +.PHONY: $(FUNCTIONAL_TARGETS) +$(FUNCTIONAL_TARGETS): + @$(MAKE) SPEED=3Dthorough $(subst -functional,-func,$@) + +.PHONY: check-functional +check-functional: + @$(MAKE) SPEED=3Dthorough check-func check-func-quick + # Consolidated targets =20 .PHONY: check check-clean get-vm-images diff --git a/tests/functional/meson.build b/tests/functional/meson.build new file mode 100644 index 0000000000..052d2e8781 --- /dev/null +++ b/tests/functional/meson.build @@ -0,0 +1,81 @@ +# QEMU functional tests: +# Tests that are put in the 'quick' category are run by default during +# 'make check'. Everything that should not be run during 'make check' +# (e.g. tests that fetch assets from the internet) should be put into +# the 'thorough' category instead. + +# Most tests run too slow with TCI enabled, so skip the functional tests t= here +if get_option('tcg_interpreter') + subdir_done() +endif + +# Timeouts for individual tests that can be slow e.g. with debugging enabl= ed +test_timeouts =3D { +} + +tests_generic_system =3D [ +] + +tests_generic_linuxuser =3D [ +] + +tests_generic_bsduser =3D [ +] + +tests_x86_64_system_quick =3D [ +] + +tests_x86_64_system_thorough =3D [ +] + +foreach speed : ['quick', 'thorough'] + foreach dir : target_dirs + + target_base =3D dir.split('-')[0] + + if dir.endswith('-softmmu') + sysmode =3D 'system' + test_emulator =3D emulators['qemu-system-' + target_base] + elif dir.endswith('-linux-user') + sysmode =3D 'linuxuser' + test_emulator =3D emulators['qemu-' + target_base] + elif dir.endswith('-bsd-user') + sysmode =3D 'bsduser' + test_emulator =3D emulators['qemu-' + target_base] + else + continue + endif + + if speed =3D=3D 'quick' + suites =3D ['func-quick', 'func-' + target_base] + target_tests =3D get_variable('tests_' + target_base + '_' + sysmode= + '_quick', []) \ + + get_variable('tests_generic_' + sysmode) + else + suites =3D ['func-' + speed, 'func-' + target_base + '-' + speed, sp= eed] + target_tests =3D get_variable('tests_' + target_base + '_' + sysmode= + '_' + speed, []) + endif + + test_deps =3D roms + test_env =3D environment() + if have_tools + test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu= -img') + test_deps +=3D [qemu_img] + endif + test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) + test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) + test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + + meson.current_source_dir()) + + foreach test : target_tests + test('func-@0@/@1@'.format(target_base, test), + python, + depends: [test_deps, test_emulator, emulator_modules], + env: test_env, + args: [meson.current_source_dir() / 'test_' + test + '.py'], + protocol: 'tap', + timeout: test_timeouts.get(test, 60), + priority: test_timeouts.get(test, 60), + suite: suites) + endforeach + endforeach +endforeach diff --git a/tests/meson.build b/tests/meson.build index 80dd3029cf..907a4c1c98 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -85,3 +85,4 @@ subdir('unit') subdir('qapi-schema') subdir('qtest') subdir('migration') +subdir('functional') --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025474; cv=none; d=zohomail.com; s=zohoarc; b=h83f0j8ErqBRKJuy2D48x6gCkYE5uyYtx06K0rfbrBLaILBg8utglK1oGf3ovxptuBsQ3GEh67EC9LHLDMoTucN49WZRPo+uSVOy51+ImzXuG8BA21/7X0I0NioiSKe2uiwPXnxvXcTpMirV6BNcMUbLDFX3MHp1Zi8fmdkcY6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025474; 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=Bumd0wJKUmb3aXLcNWl8OffjFiBYeI4qCx6a8cTOncI=; b=kS8AF/cUcAw5D1n/z1Kyp/GyT7hv6Y9KK2PM6kVPYH/PdKxw9J9lbChKbpJToD8M0oyLOdolOsDmSzflXLYEHYF6O9Kri4eDn09qpCvKSbTCdsZojqYmCOFEMXyVqvuL2gJ3nbpFbtQ/1SBX78KcHDbU7hJDqdJWhM2go/ptvX8= 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 1725025474108647.2472843751608; Fri, 30 Aug 2024 06:44:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1r7-0008O0-Em; Fri, 30 Aug 2024 09:40:01 -0400 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 1sk1r5-0008EY-It for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1qy-0005Fr-DV for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:39:56 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-PR2XAHVuMQCybwpij-BF_g-1; Fri, 30 Aug 2024 09:39:48 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 17A0619560AB; Fri, 30 Aug 2024 13:39:47 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2B4DF300019C; Fri, 30 Aug 2024 13:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bumd0wJKUmb3aXLcNWl8OffjFiBYeI4qCx6a8cTOncI=; b=W/lUtEj0NNN7w/Ml80PryN3XdXwqsEXKRhT/EleFdXFIxWJEoFtdj/5PNV7FAUhvxBjY8G JQThhTSJZTtLrdypTdFoaPVicTb6epe9r9LoXUgW5Asl4saH4/wyMHZo7Jdp1OIa0Rvh/S vQp3qtxbbz4l9yPzdGuaDm/jB3KTshk= X-MC-Unique: PR2XAHVuMQCybwpij-BF_g-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 12/44] tests/functional: Convert simple avocado tests into standalone python tests Date: Fri, 30 Aug 2024 15:38:06 +0200 Message-ID: <20240830133841.142644-13-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025475807116600 These test are rather simple and don't need any modifications apart from adjusting the "from avocado_qemu" line. To ease debugging, make the files executable and add a shebang line and Python '__main__' handling, too, so that these tests can now be run by executing them directly. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 5 ++ tests/functional/meson.build | 5 ++ .../test_cpu_queries.py} | 12 +++-- .../test_empty_cpu_model.py} | 7 ++- .../test_mem_addr_space.py} | 52 +++---------------- .../test_pc_cpu_hotplug_props.py} | 11 ++-- .../test_virtio_version.py} | 8 +-- 7 files changed, 40 insertions(+), 60 deletions(-) rename tests/{avocado/cpu_queries.py =3D> functional/test_cpu_queries.py} = (85%) mode change 100644 =3D> 100755 rename tests/{avocado/empty_cpu_model.py =3D> functional/test_empty_cpu_mo= del.py} (84%) mode change 100644 =3D> 100755 rename tests/{avocado/mem-addr-space-check.py =3D> functional/test_mem_add= r_space.py} (93%) mode change 100644 =3D> 100755 rename tests/{avocado/pc_cpu_hotplug_props.py =3D> functional/test_pc_cpu_= hotplug_props.py} (90%) mode change 100644 =3D> 100755 rename tests/{avocado/virtio_version.py =3D> functional/test_virtio_versio= n.py} (98%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 80cc84dd99..b3a0ac0e8b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1833,6 +1833,8 @@ F: hw/isa/apm.c F: include/hw/isa/apm.h F: tests/unit/test-x86-topo.c F: tests/qtest/test-x86-cpuid-compat.c +F: tests/functional/test_mem_addr_space.py +F: tests/functional/test_pc_cpu_hotplug_props.py =20 PC Chipset M: Michael S. Tsirkin @@ -1899,6 +1901,8 @@ F: include/hw/boards.h F: include/hw/core/cpu.h F: include/hw/cpu/cluster.h F: include/sysemu/numa.h +F: tests/functional/test_cpu_queries.py +F: tests/functional/test_empty_cpu_model.py F: tests/unit/test-smp-parse.c T: git https://gitlab.com/ehabkost/qemu.git machine-next =20 @@ -2238,6 +2242,7 @@ F: net/vhost-user.c F: include/hw/virtio/ F: docs/devel/virtio* F: docs/devel/migration/virtio.rst +F: tests/functional/test_virtio_version.py =20 virtio-balloon M: Michael S. Tsirkin diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 052d2e8781..91201a2e26 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -14,6 +14,7 @@ test_timeouts =3D { } =20 tests_generic_system =3D [ + 'empty_cpu_model', ] =20 tests_generic_linuxuser =3D [ @@ -23,6 +24,10 @@ tests_generic_bsduser =3D [ ] =20 tests_x86_64_system_quick =3D [ + 'cpu_queries', + 'mem_addr_space', + 'pc_cpu_hotplug_props', + 'virtio_version', ] =20 tests_x86_64_system_thorough =3D [ diff --git a/tests/avocado/cpu_queries.py b/tests/functional/test_cpu_queri= es.py old mode 100644 new mode 100755 similarity index 85% rename from tests/avocado/cpu_queries.py rename to tests/functional/test_cpu_queries.py index d3faa14720..b1122a0e8f --- a/tests/avocado/cpu_queries.py +++ b/tests/functional/test_cpu_queries.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Sanity check of query-cpu-* results # # Copyright (c) 2019 Red Hat, Inc. @@ -8,7 +10,7 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 class QueryCPUModelExpansion(QemuSystemTest): """ @@ -16,10 +18,7 @@ class QueryCPUModelExpansion(QemuSystemTest): """ =20 def test(self): - """ - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dmachine:none - """ + self.set_machine('none') self.vm.add_args('-S') self.vm.launch() =20 @@ -33,3 +32,6 @@ def test(self): e =3D self.vm.cmd('query-cpu-model-expansion', model=3Dmodel, type=3D'full') self.assertEqual(e['model']['name'], c['name']) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/empty_cpu_model.py b/tests/functional/test_empty= _cpu_model.py old mode 100644 new mode 100755 similarity index 84% rename from tests/avocado/empty_cpu_model.py rename to tests/functional/test_empty_cpu_model.py index d906ef3d3c..0081b06d85 --- a/tests/avocado/empty_cpu_model.py +++ b/tests/functional/test_empty_cpu_model.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Check for crash when using empty -cpu option # # Copyright (c) 2019 Red Hat, Inc. @@ -7,7 +9,7 @@ # # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 class EmptyCPUModel(QemuSystemTest): def test(self): @@ -17,3 +19,6 @@ def test(self): self.vm.wait() self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be = 1") self.assertRegex(self.vm.get_log(), r'-cpu option cannot be empty') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/mem-addr-space-check.py b/tests/functional/test_= mem_addr_space.py old mode 100644 new mode 100755 similarity index 93% rename from tests/avocado/mem-addr-space-check.py rename to tests/functional/test_mem_addr_space.py index d3974599f4..bb0cf062ca --- a/tests/avocado/mem-addr-space-check.py +++ b/tests/functional/test_mem_addr_space.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Check for crash when using memory beyond the available guest processor # address space. # @@ -8,7 +10,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest import time =20 class MemAddrCheck(QemuSystemTest): @@ -22,9 +24,6 @@ class MemAddrCheck(QemuSystemTest): # for all 32-bit cases, pci64_hole_size is 0. def test_phybits_low_pse36(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - With pse36 feature ON, a processor has 36 bits of addressing. So i= t can access up to a maximum of 64GiB of memory. Memory hotplug region b= egins at 4 GiB boundary when "above_4g_mem_size" is 0 (this would be tru= e when @@ -52,9 +51,6 @@ def test_phybits_low_pse36(self): =20 def test_phybits_low_pae(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - With pae feature ON, a processor has 36 bits of addressing. So it = can access up to a maximum of 64GiB of memory. Rest is the same as the= case with pse36 above. @@ -72,9 +68,6 @@ def test_phybits_low_pae(self): =20 def test_phybits_ok_pentium_pse36(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Setting maxmem to 59.5G and making sure that QEMU can start with t= he same options as the failing case above with pse36 cpu feature. """ @@ -91,9 +84,6 @@ def test_phybits_ok_pentium_pse36(self): =20 def test_phybits_ok_pentium_pae(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Test is same as above but now with pae cpu feature turned on. Setting maxmem to 59.5G and making sure that QEMU can start fine with the same options as the case above. @@ -111,9 +101,6 @@ def test_phybits_ok_pentium_pae(self): =20 def test_phybits_ok_pentium2(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Pentium2 has 36 bits of addressing, so its same as pentium with pse36 ON. """ @@ -130,9 +117,6 @@ def test_phybits_ok_pentium2(self): =20 def test_phybits_low_nonpse36(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Pentium processor has 32 bits of addressing without pse36 or pae so it can access physical address up to 4 GiB. Setting maxmem to 4 GiB should make QEMU fail to start with "phys-bits too low" @@ -153,9 +137,6 @@ def test_phybits_low_nonpse36(self): # now lets test some 64-bit CPU cases. def test_phybits_low_tcg_q35_70_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - For q35 7.1 machines and above, there is a HT window that starts at 1024 GiB and ends at 1 TiB - 1. If the max GPA falls in this range, "above_4G" memory is adjusted to start at 1 TiB boundary for AMD c= pus @@ -182,9 +163,6 @@ def test_phybits_low_tcg_q35_70_amd(self): =20 def test_phybits_low_tcg_q35_71_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - AMD_HT_START is defined to be at 1012 GiB. So for q35 machines version > 7.0 and AMD cpus, instead of 1024 GiB limit for 40 bit processor address space, it has to be 1012 GiB , that is 12 GiB @@ -205,9 +183,6 @@ def test_phybits_low_tcg_q35_71_amd(self): =20 def test_phybits_ok_tcg_q35_70_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same as q35-7.0 AMD case except that here we check that QEMU can successfully start when maxmem is < 988G. """ @@ -224,9 +199,6 @@ def test_phybits_ok_tcg_q35_70_amd(self): =20 def test_phybits_ok_tcg_q35_71_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same as q35-7.1 AMD case except that here we check that QEMU can successfully start when maxmem is < 976G. """ @@ -243,9 +215,6 @@ def test_phybits_ok_tcg_q35_71_amd(self): =20 def test_phybits_ok_tcg_q35_71_intel(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same parameters as test_phybits_low_tcg_q35_71_amd() but use Intel cpu instead. QEMU should start fine in this case as "above_4G" memory starts at 4G. @@ -264,9 +233,6 @@ def test_phybits_ok_tcg_q35_71_intel(self): =20 def test_phybits_low_tcg_q35_71_amd_41bits(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - AMD processor with 41 bits. Max cpu hw address =3D 2 TiB. By setting maxram above 1012 GiB - 32 GiB - 4 GiB =3D 976 GiB, we= can force "above_4G" memory to start at 1 TiB for q35-7.1 machines @@ -291,9 +257,6 @@ def test_phybits_low_tcg_q35_71_amd_41bits(self): =20 def test_phybits_ok_tcg_q35_71_amd_41bits(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - AMD processor with 41 bits. Max cpu hw address =3D 2 TiB. Same as above but by setting maxram between 976 GiB and 992 Gib, QEMU should start fine. @@ -312,9 +275,6 @@ def test_phybits_ok_tcg_q35_71_amd_41bits(self): =20 def test_phybits_low_tcg_q35_intel_cxl(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - cxl memory window starts after memory device range. Here, we use 1= GiB of cxl window memory. 4G_mem end aligns at 4G. pci64_hole is 32 Gi= B and starts after the cxl memory window. @@ -335,9 +295,6 @@ def test_phybits_low_tcg_q35_intel_cxl(self): =20 def test_phybits_ok_tcg_q35_intel_cxl(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same as above but here we do not reserve any cxl memory window. He= nce, with the exact same parameters as above, QEMU should start fine ev= en with cxl enabled. @@ -352,3 +309,6 @@ def test_phybits_ok_tcg_q35_intel_cxl(self): time.sleep(self.DELAY_Q35_BOOT_SEQUENCE) self.vm.shutdown() self.assertNotRegex(self.vm.get_log(), r'phys-bits too low') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/pc_cpu_hotplug_props.py b/tests/functional/test_= pc_cpu_hotplug_props.py old mode 100644 new mode 100755 similarity index 90% rename from tests/avocado/pc_cpu_hotplug_props.py rename to tests/functional/test_pc_cpu_hotplug_props.py index 4bd3e02665..9d5a37cb17 --- a/tests/avocado/pc_cpu_hotplug_props.py +++ b/tests/functional/test_pc_cpu_hotplug_props.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # Ensure CPU die-id can be omitted on -device # @@ -20,16 +21,16 @@ # License along with this library; if not, see . # =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 class OmittedCPUProps(QemuSystemTest): - """ - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dcpu:qemu64 - """ + def test_no_die_id(self): self.vm.add_args('-nodefaults', '-S') self.vm.add_args('-smp', '1,sockets=3D2,cores=3D2,threads=3D2,maxc= pus=3D8') self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=3D1,core-= id=3D0,thread-id=3D0') self.vm.launch() self.assertEqual(len(self.vm.cmd('query-cpus-fast')), 2) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/virtio_version.py b/tests/functional/test_virtio= _version.py old mode 100644 new mode 100755 similarity index 98% rename from tests/avocado/virtio_version.py rename to tests/functional/test_virtio_version.py index afe5e828b5..eb23060564 --- a/tests/avocado/virtio_version.py +++ b/tests/functional/test_virtio_version.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """ Check compatibility of virtio device types """ @@ -12,7 +13,7 @@ import os =20 from qemu.machine import QEMUMachine -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 # Virtio Device IDs: VIRTIO_NET =3D 1 @@ -60,8 +61,6 @@ class VirtioVersionCheck(QemuSystemTest): Check if virtio-version-specific device types result in the same device tree created by `disable-modern` and `disable-legacy`. - - :avocado: tags=3Darch:x86_64 """ =20 # just in case there are failures, show larger diff: @@ -173,3 +172,6 @@ def test_modern_only_devs(self): self.check_modern_only('virtio-mouse-pci', VIRTIO_INPUT) self.check_modern_only('virtio-tablet-pci', VIRTIO_INPUT) self.check_modern_only('virtio-keyboard-pci', VIRTIO_INPUT) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025259; cv=none; d=zohomail.com; s=zohoarc; b=XniDcUxpWUihRdCJLd6P6gVcRaTmDjT4vaqLEMWEKwyFA8JxG994mBYW8NJZkScd1ngqCREL5x8QR2znib3Bw36Sz93ENYQLDFzvdKyDHOcZ5GlJTcWWOAai/wLmGs4n0hPbLpyKiGR8sLucBp9B5HM0zL0qtPYzhcMbrRfGcBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025259; 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=qllCZWrFtAiXglaEkwFzaLJNTfJMfpAgtKCZrXXd94A=; b=CcWz6KyTuGL0zh8Hnd6J78l2wFhbDnMj2vDxvYKMLg3ySLkBXxtGdBxGa1/lUPRZWBElUc+ztg2VKtku3hum4tXlXvWy2k950XjPYmwbm4AVzaWC+QF97jxRqgbdHW8xnNo5rn8/+gS/BZNCuDViZAIcpR+lmitjFzec4rXYD+k= 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 1725025259580956.2977566110931; Fri, 30 Aug 2024 06:40:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rB-0000DH-Gp; Fri, 30 Aug 2024 09:40:05 -0400 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 1sk1r9-00005K-Ji for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1r5-0005G6-8w for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:02 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-1TO6WDhzMHOXC5aVJ_DiRg-1; Fri, 30 Aug 2024 09:39:53 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C90481955BED; Fri, 30 Aug 2024 13:39:51 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 964B53001FE8; Fri, 30 Aug 2024 13:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qllCZWrFtAiXglaEkwFzaLJNTfJMfpAgtKCZrXXd94A=; b=VJkHIs/4tfVIJZbSdtPxTcR+LPATEcw/dSjciIP1ID/b9idBhtMtxHotJXSThmk3fj5tM8 0d7RZKzzlNXKEq6+zA22TrqGESMGOj/JnBjT11fybgXgzfX6tWpC1q0sYpC/Q4MOaZ5unT ZTP/zviTxmfB8qxLLRxkjwDQVpOXcmE= X-MC-Unique: 1TO6WDhzMHOXC5aVJ_DiRg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 13/44] tests/functional: Convert avocado tests that just need a small adjustment Date: Fri, 30 Aug 2024 15:38:07 +0200 Message-ID: <20240830133841.142644-14-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025260579116600 These simple tests can be converted to stand-alone tests quite easily, e.g. by just setting the machine to 'none' now manually or by adding "-cpu" command line parameters, since we don't support the corresponding avocado tags in the new python test framework. Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 3 + tests/functional/meson.build | 6 ++ .../test_info_usernet.py} | 11 ++- .../test_ppc_74xx.py} | 74 ++++++++----------- .../version.py =3D> functional/test_version.py} | 13 ++-- 5 files changed, 56 insertions(+), 51 deletions(-) rename tests/{avocado/info_usernet.py =3D> functional/test_info_usernet.py= } (87%) mode change 100644 =3D> 100755 rename tests/{avocado/ppc_74xx.py =3D> functional/test_ppc_74xx.py} (74%) mode change 100644 =3D> 100755 rename tests/{avocado/version.py =3D> functional/test_version.py} (78%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index b3a0ac0e8b..4912f8d0da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -318,6 +318,7 @@ F: configs/devices/ppc* F: docs/system/ppc/embedded.rst F: docs/system/target-ppc.rst F: tests/tcg/ppc*/* +F: tests/functional/test_ppc_74xx.py =20 RISC-V TCG CPUs M: Palmer Dabbelt @@ -2107,6 +2108,7 @@ S: Odd Fixes F: hw/net/ F: include/hw/net/ F: tests/qtest/virtio-net-test.c +F: tests/functional/test_info_usernet.py F: docs/virtio-net-failover.rst T: git https://github.com/jasowang/qemu.git net =20 @@ -2976,6 +2978,7 @@ S: Supported F: include/qemu/option.h F: tests/unit/test-keyval.c F: tests/unit/test-qemu-opts.c +F: tests/functional/test_version.py F: util/keyval.c F: util/qemu-option.c =20 diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 91201a2e26..f1f344f860 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -15,6 +15,12 @@ test_timeouts =3D { =20 tests_generic_system =3D [ 'empty_cpu_model', + 'info_usernet', + 'version', +] + +tests_ppc_quick =3D [ + 'ppc_74xx', ] =20 tests_generic_linuxuser =3D [ diff --git a/tests/avocado/info_usernet.py b/tests/functional/test_info_use= rnet.py old mode 100644 new mode 100755 similarity index 87% rename from tests/avocado/info_usernet.py rename to tests/functional/test_info_usernet.py index e1aa7a6e0a..cd37524d94 --- a/tests/avocado/info_usernet.py +++ b/tests/functional/test_info_usernet.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test for the hmp command "info usernet" # # Copyright (c) 2021 Red Hat, Inc. @@ -8,18 +10,16 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 from qemu.utils import get_info_usernet_hostfwd_port =20 =20 class InfoUsernet(QemuSystemTest): - """ - :avocado: tags=3Dmachine:none - """ =20 def test_hostfwd(self): self.require_netdev('user') + self.set_machine('none') self.vm.add_args('-netdev', 'user,id=3Dvnet,hostfwd=3D:127.0.0.1:0= -:22') self.vm.launch() res =3D self.vm.cmd('human-monitor-command', @@ -31,3 +31,6 @@ def test_hostfwd(self): self.assertGreater(port, 0, ('Found a redirected port that is not greater t= han' ' zero')) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/ppc_74xx.py b/tests/functional/test_ppc_74xx.py old mode 100644 new mode 100755 similarity index 74% rename from tests/avocado/ppc_74xx.py rename to tests/functional/test_ppc_74xx.py index f54757c243..5386016f26 --- a/tests/avocado/ppc_74xx.py +++ b/tests/functional/test_ppc_74xx.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Smoke tests for 74xx cpus (aka G4). # # Copyright (c) 2021, IBM Corp. @@ -5,132 +7,120 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test import QemuSystemTest +from qemu_test import wait_for_console_pattern =20 class ppc74xxCpu(QemuSystemTest): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Daccel:tcg - """ + timeout =3D 5 =20 def test_ppc_7400(self): - """ - :avocado: tags=3Dcpu:7400 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7400') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7410(self): - """ - :avocado: tags=3Dcpu:7410 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7410') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,74xx') =20 def test_ppc_7441(self): - """ - :avocado: tags=3Dcpu:7441 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7441') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7445(self): - """ - :avocado: tags=3Dcpu:7445 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7445') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7447(self): - """ - :avocado: tags=3Dcpu:7447 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7447') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7447a(self): - """ - :avocado: tags=3Dcpu:7447a - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7447a') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7448(self): - """ - :avocado: tags=3Dcpu:7448 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7448') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,MPC86xx') =20 def test_ppc_7450(self): - """ - :avocado: tags=3Dcpu:7450 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7450') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7451(self): - """ - :avocado: tags=3Dcpu:7451 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7451') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7455(self): - """ - :avocado: tags=3Dcpu:7455 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7455') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7457(self): - """ - :avocado: tags=3Dcpu:7457 - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7457') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') =20 def test_ppc_7457a(self): - """ - :avocado: tags=3Dcpu:7457a - """ self.require_accelerator("tcg") + self.set_machine('g3beige') self.vm.set_console() + self.vm.add_args('-cpu', '7457a') self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS') wait_for_console_pattern(self, '>> CPU type PowerPC,G4') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/version.py b/tests/functional/test_version.py old mode 100644 new mode 100755 similarity index 78% rename from tests/avocado/version.py rename to tests/functional/test_version.py index c6139568a1..3ab3b67f7e --- a/tests/avocado/version.py +++ b/tests/functional/test_version.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Version check example test # # Copyright (c) 2018 Red Hat, Inc. @@ -9,17 +11,18 @@ # later. See the COPYING file in the top-level directory. =20 =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 =20 class Version(QemuSystemTest): - """ - :avocado: tags=3Dquick - :avocado: tags=3Dmachine:none - """ + def test_qmp_human_info_version(self): + self.set_machine('none') self.vm.add_args('-nodefaults') self.vm.launch() res =3D self.vm.cmd('human-monitor-command', command_line=3D'info version') self.assertRegex(res, r'^(\d+\.\d+\.\d)') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025391; cv=none; d=zohomail.com; s=zohoarc; b=CL3UDZR+RBDPDJ041ADAUIeebv1iJbrVQS7e8lrrMuZNmycEFAJC7+UVT2Pt3Yrh9shD5K7Qj+LZydwloHHdwg7/doJznA2dQ9smvW+NSq9I/vfT68MbEJXfz2gwlTJr7Z5b+O0T92D1f/tPiImlN8TaNtiIC2ET339wuEaRUp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025391; 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=WrdjZbPpqhWSdGfNDUmHAWsPg/wXibqRaKKudTUdidI=; b=iNOEzfdazOOCEZzt2JbjUyH3l1slW1z/nCisf3XatK8i/ZIieTHG1cLy9/nN0dC7LgYm+N+y1p+3siiOEH9Z2v6fcF7KEu79Ns2cy57Up2X6FeWXt94rcPrZLgD/euilgiJD/ABTptCgXRAViJ0hcSE6SqE5CU2WrAObVTWTeE4= 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 1725025391151286.3573234306458; Fri, 30 Aug 2024 06:43:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rA-00009C-MY; Fri, 30 Aug 2024 09:40:04 -0400 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 1sk1r9-00005O-KQ for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1r6-0005Gn-RG for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:02 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-492-0d8Pal6_P6CSVX4mwciVkw-1; Fri, 30 Aug 2024 09:39:57 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C4F161955F42; Fri, 30 Aug 2024 13:39:55 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 387C0300019C; Fri, 30 Aug 2024 13:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WrdjZbPpqhWSdGfNDUmHAWsPg/wXibqRaKKudTUdidI=; b=Rtug8LizI6rYh9H0VXqH9LtpBoJz8sFNH6HuH3rjj6c8Be97rKENcTBsxhDE9WqJAYZi/8 Am0L2pBc5SxcS5l8yWf0FHxfIhYCVIDNDZLPBtUjHiq1fEpXRcVKS5wK8GL+ZoS29MOEdT TuEfILniYfcBJH2IwRB9DkbYZ7dgwhY= X-MC-Unique: 0d8Pal6_P6CSVX4mwciVkw-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 14/44] tests/functional: add a module for handling asset download & caching Date: Fri, 30 Aug 2024 15:38:08 +0200 Message-ID: <20240830133841.142644-15-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025393446116600 From: Daniel P. Berrang=C3=A9 The 'Asset' class is a simple module that declares a downloadable asset that can be cached locally. Downloads are stored in the user's home dir at ~/.cache/qemu/download, using a sha256 sum of the URL. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 [thuth: Drop sha1 support, use hash on file content for naming instead of U= RL, add the possibility to specify the cache dir via environment variab= le] Signed-off-by: Thomas Huth --- tests/functional/qemu_test/__init__.py | 1 + tests/functional/qemu_test/asset.py | 97 ++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 tests/functional/qemu_test/asset.py diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu= _test/__init__.py index 2f1e0bc70d..db05c8f412 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -6,6 +6,7 @@ # later. See the COPYING file in the top-level directory. =20 =20 +from .asset import Asset from .config import BUILD_DIR from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \ interrupt_interactive_console_until_pattern, wait_for_console_pattern,= \ diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_te= st/asset.py new file mode 100644 index 0000000000..c0e675d847 --- /dev/null +++ b/tests/functional/qemu_test/asset.py @@ -0,0 +1,97 @@ +# Test utilities for fetching & caching assets +# +# Copyright 2024 Red Hat, Inc. +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import hashlib +import logging +import os +import subprocess +import urllib.request +from pathlib import Path +from shutil import copyfileobj + + +# Instances of this class must be declared as class level variables +# starting with a name "ASSET_". This enables the pre-caching logic +# to easily find all referenced assets and download them prior to +# execution of the tests. +class Asset: + + def __init__(self, url, hashsum): + self.url =3D url + self.hash =3D hashsum + cache_dir_env =3D os.getenv('QEMU_TEST_CACHE_DIR') + if cache_dir_env: + self.cache_dir =3D Path(cache_dir_env, "download") + else: + self.cache_dir =3D Path(Path("~").expanduser(), + ".cache", "qemu", "download") + self.cache_file =3D Path(self.cache_dir, hashsum) + self.log =3D logging.getLogger('qemu-test') + + def __repr__(self): + return "Asset: url=3D%s hash=3D%s cache=3D%s" % ( + self.url, self.hash, self.cache_file) + + def _check(self, cache_file): + if self.hash is None: + return True + if len(self.hash) =3D=3D 64: + sum_prog =3D 'sha256sum' + elif len(self.hash) =3D=3D 128: + sum_prog =3D 'sha512sum' + else: + raise Exception("unknown hash type") + + checksum =3D subprocess.check_output( + [sum_prog, str(cache_file)]).split()[0] + return self.hash =3D=3D checksum.decode("utf-8") + + def valid(self): + return self.cache_file.exists() and self._check(self.cache_file) + + def fetch(self): + if not self.cache_dir.exists(): + self.cache_dir.mkdir(parents=3DTrue, exist_ok=3DTrue) + + if self.valid(): + self.log.debug("Using cached asset %s for %s", + self.cache_file, self.url) + return str(self.cache_file) + + self.log.info("Downloading %s to %s...", self.url, self.cache_file) + tmp_cache_file =3D self.cache_file.with_suffix(".download") + + try: + resp =3D urllib.request.urlopen(self.url) + except Exception as e: + self.log.error("Unable to download %s: %s", self.url, e) + raise + + try: + with tmp_cache_file.open("wb+") as dst: + copyfileobj(resp, dst) + except: + tmp_cache_file.unlink() + raise + try: + # Set these just for informational purposes + os.setxattr(str(tmp_cache_file), "user.qemu-asset-url", + self.url.encode('utf8')) + os.setxattr(str(tmp_cache_file), "user.qemu-asset-hash", + self.hash.encode('utf8')) + except Exception as e: + self.log.debug("Unable to set xattr on %s: %s", tmp_cache_file= , e) + pass + + if not self._check(tmp_cache_file): + tmp_cache_file.unlink() + raise Exception("Hash of %s does not match %s" % + (self.url, self.hash)) + tmp_cache_file.replace(self.cache_file) + + self.log.info("Cached %s at %s" % (self.url, self.cache_file)) + return str(self.cache_file) --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025407; cv=none; d=zohomail.com; s=zohoarc; b=ZkBb5pNHoOyz+S1vk+7hT8utdQcjYraI3lBXJIOeIqE54PAW8twyBdQgPHoEcWamHfTijIzM6mQnbFxXtW0MwEUPn7aZbHJrdPw+KAGajU1AvZZRsjR/JG32z9vXbHt7zBy/X0+U7LL3MLbdpSHzjQIQiqst/2Q/69ZQjFxhyH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025407; 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=dJbQZJGwqu7BKGegMKr2BErsIPZVL+r3Bfkwsv4GRx8=; b=lSWbwcMt4YiBrZnwopOMv2tGhZmWGSwUlasaCVcFc98nmiAOW3UdprRgOjjlc9O6WORaTZfwNRVDjN9QnLzEp9mDjJ48E1nDnzqi7VhKnuXmbYD5PqmWfzVV1rBQ4I7kAC7a9oKTmc+9guoiwAEmw+bA5ROX64Mnz/sp++WTnuM= 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 1725025407354732.1052296705702; Fri, 30 Aug 2024 06:43:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rG-0000Ot-3x; Fri, 30 Aug 2024 09:40:10 -0400 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 1sk1rC-0000JF-NY for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rA-0005QS-DN for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:06 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-Phv6HJwLNLuNO2Fk1YwucQ-1; Fri, 30 Aug 2024 09:40:02 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 832741955D4A; Fri, 30 Aug 2024 13:40:01 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 848C83001FC3; Fri, 30 Aug 2024 13:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dJbQZJGwqu7BKGegMKr2BErsIPZVL+r3Bfkwsv4GRx8=; b=GzHtzrsn1vyuX5SG23Xk2GVoqu8jePd5JVpM5mXPKbf4f0pSOGB7i5+V3++zFyxB7/sgNL AkbVeK9hdB+HgXTc4qOD4enY8HKwgXd6z3WkhMcRQ2h4McGn6YOBAEefZXzNQBfz+a7MMo 10JwNBn+jCgGVcNuyclTiIDN6wRn3K0= X-MC-Unique: Phv6HJwLNLuNO2Fk1YwucQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 15/44] tests/functional: enable pre-emptive caching of assets Date: Fri, 30 Aug 2024 15:38:09 +0200 Message-ID: <20240830133841.142644-16-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025409362116600 From: Daniel P. Berrang=C3=A9 Many tests need to access assets stored on remote sites. We don't want to download these during test execution when run by meson, since this risks hitting test timeouts when data transfers are slow. Add support for pre-emptive caching of assets by setting the env var QEMU_TEST_PRECACHE to point to a timestamp file. When this is set, instead of running the test, the assets will be downloaded and saved to the cache, then the timestamp file created. A meson custom target is created as a dependency of each test suite to trigger the pre-emptive caching logic before the test runs. When run in caching mode, it will locate assets by looking for class level variables with a name prefix "ASSET_", and type "Asset". At the ninja level ninja test --suite functional will speculatively download any assets that are not already cached, so it is advisable to set a timeout multiplier. QEMU_TEST_NO_DOWNLOAD=3D1 ninja test --suite functional will fail the test if a required asset is not already cached ninja precache-functional will download and cache all assets required by the functional tests At the make level, precaching is always done by make check-functional Signed-off-by: Daniel P. Berrang=C3=A9 Tested-by: Richard Henderson [thuth: Remove the duplicated "path =3D os.path.basename(...)" line] Signed-off-by: Thomas Huth --- tests/Makefile.include | 3 ++- tests/functional/meson.build | 33 +++++++++++++++++++++++-- tests/functional/qemu_test/asset.py | 34 ++++++++++++++++++++++++++ tests/functional/qemu_test/testcase.py | 7 ++++++ 4 files changed, 74 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 66c8cc3123..010369bd3a 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -161,7 +161,8 @@ $(FUNCTIONAL_TARGETS): =20 .PHONY: check-functional check-functional: - @$(MAKE) SPEED=3Dthorough check-func check-func-quick + @$(NINJA) precache-functional + @QEMU_TEST_NO_DOWNLOAD=3D1 $(MAKE) SPEED=3Dthorough check-func check-func= -quick =20 # Consolidated targets =20 diff --git a/tests/functional/meson.build b/tests/functional/meson.build index f1f344f860..df79775df3 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -39,6 +39,7 @@ tests_x86_64_system_quick =3D [ tests_x86_64_system_thorough =3D [ ] =20 +precache_all =3D [] foreach speed : ['quick', 'thorough'] foreach dir : target_dirs =20 @@ -78,11 +79,35 @@ foreach speed : ['quick', 'thorough'] meson.current_source_dir()) =20 foreach test : target_tests - test('func-@0@/@1@'.format(target_base, test), + testname =3D '@0@-@1@'.format(target_base, test) + testfile =3D 'test_' + test + '.py' + testpath =3D meson.current_source_dir() / testfile + teststamp =3D testname + '.tstamp' + test_precache_env =3D environment() + test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir(= ) / teststamp) + test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'p= ython:' + + meson.current_source_dir()) + precache =3D custom_target('func-precache-' + testname, + output: teststamp, + command: [python, testpath], + depend_files: files(testpath), + build_by_default: false, + env: test_precache_env) + precache_all +=3D precache + + # Ideally we would add 'precache' to 'depends' here, such that + # 'build_by_default: false' lets the pre-caching automatically + # run immediately before the test runs. In practice this is + # broken in meson, with it running the pre-caching in the normal + # compile phase https://github.com/mesonbuild/meson/issues/2518 + # If the above bug ever gets fixed, when QEMU changes the min + # meson version, add the 'depends' and remove the custom + # 'run_target' logic below & in Makefile.include + test('func-' + testname, python, depends: [test_deps, test_emulator, emulator_modules], env: test_env, - args: [meson.current_source_dir() / 'test_' + test + '.py'], + args: [testpath], protocol: 'tap', timeout: test_timeouts.get(test, 60), priority: test_timeouts.get(test, 60), @@ -90,3 +115,7 @@ foreach speed : ['quick', 'thorough'] endforeach endforeach endforeach + +run_target('precache-functional', + depends: precache_all, + command: ['true']) diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_te= st/asset.py index c0e675d847..b329ab7dbe 100644 --- a/tests/functional/qemu_test/asset.py +++ b/tests/functional/qemu_test/asset.py @@ -9,6 +9,8 @@ import logging import os import subprocess +import sys +import unittest import urllib.request from pathlib import Path from shutil import copyfileobj @@ -62,6 +64,9 @@ def fetch(self): self.cache_file, self.url) return str(self.cache_file) =20 + if os.environ.get("QEMU_TEST_NO_DOWNLOAD", False): + raise Exception("Asset cache is invalid and downloads disabled= ") + self.log.info("Downloading %s to %s...", self.url, self.cache_file) tmp_cache_file =3D self.cache_file.with_suffix(".download") =20 @@ -95,3 +100,32 @@ def fetch(self): =20 self.log.info("Cached %s at %s" % (self.url, self.cache_file)) return str(self.cache_file) + + def precache_test(test): + log =3D logging.getLogger('qemu-test') + log.setLevel(logging.DEBUG) + handler =3D logging.StreamHandler(sys.stdout) + handler.setLevel(logging.DEBUG) + formatter =3D logging.Formatter( + '%(asctime)s - %(name)s - %(levelname)s - %(message)s') + handler.setFormatter(formatter) + log.addHandler(handler) + for name, asset in vars(test.__class__).items(): + if name.startswith("ASSET_") and type(asset) =3D=3D Asset: + log.info("Attempting to cache '%s'" % asset) + asset.fetch() + log.removeHandler(handler) + + def precache_suite(suite): + for test in suite: + if isinstance(test, unittest.TestSuite): + Asset.precache_suite(test) + elif isinstance(test, unittest.TestCase): + Asset.precache_test(test) + + def precache_suites(path, cacheTstamp): + loader =3D unittest.loader.defaultTestLoader + tests =3D loader.loadTestsFromNames([path], None) + + with open(cacheTstamp, "w") as fh: + Asset.precache_suite(tests) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index b2dd863c6e..18314be9d1 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -21,6 +21,7 @@ from qemu.machine import QEMUMachine from qemu.utils import kvm_available, tcg_available =20 +from .asset import Asset from .cmd import run_cmd from .config import BUILD_DIR =20 @@ -58,6 +59,12 @@ def tearDown(self): =20 def main(): path =3D os.path.basename(sys.argv[0])[:-3] + + cache =3D os.environ.get("QEMU_TEST_PRECACHE", None) + if cache is not None: + Asset.precache_suites(path, cache) + return + tr =3D pycotap.TAPTestRunner(message_log =3D pycotap.LogMode.LogTo= Error, test_output_log =3D pycotap.LogMode.Log= ToError) unittest.main(module =3D None, testRunner =3D tr, argv=3D["__dummy= __", path]) --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025260; cv=none; d=zohomail.com; s=zohoarc; b=l4wh0dC9s5XhSPjQVcLZD8R4zZXhlewQ7/N9wPKiSNqml95iVPQNfcqPsbICtX+HwRySbQuGpQuDT66kNT6pkD7bRYxP3ZwrU89P/yCpOfsUaGiDckv+DTUirm66FCdlFaBnZDWIg+9vBg/zThGdSxht03k66rRAH58DrZI/Qos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025260; h=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=t0yj/K7Piv+Pfe1AqD43B1EX2IY/geuILA4GSFmvF50=; b=ExOgm5VtAzKNi4C00ljEDQAjjWa963T6R4OQATxlV5AQ32sLKklO35JBY5CABZ7FeeryU/JG/leqizH6QL5veB7ydWdGhqub002Vt5RDdny2u4UM43vVsDUrbXxdkszwAUC9FBMI7qWU6XVl0mHvKcnW+ff7ee2ZaxSdlsChDr0= 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 1725025260109998.2720163043681; Fri, 30 Aug 2024 06:41:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rL-0000rg-42; Fri, 30 Aug 2024 09:40:15 -0400 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 1sk1rH-0000dp-Qr for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rF-0005Ud-PJ for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:11 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-491-rvc0OQWHMZSCcYwyI_05dA-1; Fri, 30 Aug 2024 09:40:05 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D309B19560B4; Fri, 30 Aug 2024 13:40:04 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 97678300019C; Fri, 30 Aug 2024 13:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t0yj/K7Piv+Pfe1AqD43B1EX2IY/geuILA4GSFmvF50=; b=D16iQz4eLBQSx0PvPds+HEwhhmQHdbcPoamPi3xcfrp4anWpeyYHFrA+fHpiArjOhpP9cP rlNERQ9UAXaYbemjYV2fS71S/ruvr8IqQpcq35GUnLhaGJA0bkF6CNyzbjevclclb79iqr GgBEgwke4SgjRn5fU6qEwx0jGCHI0KY= X-MC-Unique: rvc0OQWHMZSCcYwyI_05dA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 16/44] tests/functional: Allow asset downloading with concurrent threads Date: Fri, 30 Aug 2024 15:38:10 +0200 Message-ID: <20240830133841.142644-17-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025260619116600 Content-Type: text/plain; charset="utf-8" When running "make -j$(nproc) check-functional", tests that use the same asset might be running in parallel. Improve the downloading to detect this situation and wait for the other thread to finish the download. Signed-off-by: Thomas Huth --- tests/functional/qemu_test/asset.py | 62 ++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_te= st/asset.py index b329ab7dbe..d3be2aff82 100644 --- a/tests/functional/qemu_test/asset.py +++ b/tests/functional/qemu_test/asset.py @@ -12,6 +12,7 @@ import sys import unittest import urllib.request +from time import sleep from pathlib import Path from shutil import copyfileobj =20 @@ -55,6 +56,35 @@ def _check(self, cache_file): def valid(self): return self.cache_file.exists() and self._check(self.cache_file) =20 + def _wait_for_other_download(self, tmp_cache_file): + # Another thread already seems to download the asset, so wait until + # it is done, while also checking the size to see whether it is st= uck + try: + current_size =3D tmp_cache_file.stat().st_size + new_size =3D current_size + except: + if os.path.exists(self.cache_file): + return True + raise + waittime =3D lastchange =3D 600 + while waittime > 0: + sleep(1) + waittime -=3D 1 + try: + new_size =3D tmp_cache_file.stat().st_size + except: + if os.path.exists(self.cache_file): + return True + raise + if new_size !=3D current_size: + lastchange =3D waittime + current_size =3D new_size + elif lastchange - waittime > 90: + return False + + self.log.debug("Time out while waiting for %s!", tmp_cache_file) + raise + def fetch(self): if not self.cache_dir.exists(): self.cache_dir.mkdir(parents=3DTrue, exist_ok=3DTrue) @@ -70,18 +100,28 @@ def fetch(self): self.log.info("Downloading %s to %s...", self.url, self.cache_file) tmp_cache_file =3D self.cache_file.with_suffix(".download") =20 - try: - resp =3D urllib.request.urlopen(self.url) - except Exception as e: - self.log.error("Unable to download %s: %s", self.url, e) - raise + for retries in range(3): + try: + with tmp_cache_file.open("xb") as dst: + with urllib.request.urlopen(self.url) as resp: + copyfileobj(resp, dst) + break + except FileExistsError: + self.log.debug("%s already exists, " + "waiting for other thread to finish...", + tmp_cache_file) + if self._wait_for_other_download(tmp_cache_file): + return str(self.cache_file) + self.log.debug("%s seems to be stale, " + "deleting and retrying download...", + tmp_cache_file) + tmp_cache_file.unlink() + continue + except Exception as e: + self.log.error("Unable to download %s: %s", self.url, e) + tmp_cache_file.unlink() + raise =20 - try: - with tmp_cache_file.open("wb+") as dst: - copyfileobj(resp, dst) - except: - tmp_cache_file.unlink() - raise try: # Set these just for informational purposes os.setxattr(str(tmp_cache_file), "user.qemu-asset-url", --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025439; cv=none; d=zohomail.com; s=zohoarc; b=hUoYidMUXms8B4pvV39Glu8Bi0WfTQctfznGH7G/LHw9a2U3AdnYsMC3/5er2EXHdhKvO8JZDCeR32bF27SQVoaMt3fRPqzlkB6xNPhmYlVkKk9Z4V1dBqC6kXXd88muBI3s14RlvTFRJ/yWodPyUKq12DHS+IDQlrjl6Ve3mcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025439; h=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=2rksVRK8o4aOlLpZh/yPWx337Xxkb5AJKtWGGJ+8/9s=; b=neO5QCD4662xjUvOfh+TeZ1N+Vx2zW6jgx+vGDTGwAbqEn/+k0Krc0Zz0H1qFIusFOGkl3Xzjl4Os1nP1Rx5UV+sIGeXzWIwpp8bDPZG8Tl9xDGMzOZ5I2vARm4shW59H1IMyVac1yjh+6/p3XszmYlRl3RHqpm2P1x6LsQ3JM0= 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 172502543963596.31783537024171; Fri, 30 Aug 2024 06:43:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1ri-0001vl-LP; Fri, 30 Aug 2024 09:40:40 -0400 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 1sk1rP-0001HT-QY for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rL-0005V6-CC for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:18 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-9TVw5pF9O7uwmcXe3jULMQ-1; Fri, 30 Aug 2024 09:40:11 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3CE631955D59; Fri, 30 Aug 2024 13:40:10 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3778E300019C; Fri, 30 Aug 2024 13:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2rksVRK8o4aOlLpZh/yPWx337Xxkb5AJKtWGGJ+8/9s=; b=Y4+IawzCytMf73tfLbDdw6UWyyp3dCreirzJWSPLr0Nb6x7enfs9hC7KV/XWtprsTSMqeD 3jSG695dc/uvkyS+wMitNolcnq/LnKoJoY/cLYokFtA3Bgm1dC5KtiIE+Ou1rmBxmAiYwl 2rEJxkvDuRrlOtnhECnLNTAH+faPWJs= X-MC-Unique: 9TVw5pF9O7uwmcXe3jULMQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 17/44] tests/functional: Convert some tests that download files via fetch_asset() Date: Fri, 30 Aug 2024 15:38:11 +0200 Message-ID: <20240830133841.142644-18-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025441681116600 Content-Type: text/plain; charset="utf-8" Now that we've got the Asset class with pre-caching, we can convert some Avocado tests that use fetch_asset() for downloading their required files. Signed-off-by: Thomas Huth --- MAINTAINERS | 12 ++--- tests/avocado/machine_mips_loongson3v.py | 39 -------------- tests/functional/meson.build | 30 +++++++++-- .../test_arm_n8x0.py} | 36 ++++++------- .../test_avr_mega2560.py} | 22 ++++---- .../test_loongarch64_virt.py} | 46 +++++++++-------- tests/functional/test_mips64el_loongson3v.py | 39 ++++++++++++++ .../test_netdev_ethtool.py} | 51 +++++++------------ .../ppc_405.py =3D> functional/test_ppc_405.py} | 29 ++++++----- 9 files changed, 160 insertions(+), 144 deletions(-) delete mode 100644 tests/avocado/machine_mips_loongson3v.py rename tests/{avocado/machine_arm_n8x0.py =3D> functional/test_arm_n8x0.py= } (51%) mode change 100644 =3D> 100755 rename tests/{avocado/machine_avr6.py =3D> functional/test_avr_mega2560.py= } (72%) mode change 100644 =3D> 100755 rename tests/{avocado/machine_loongarch.py =3D> functional/test_loongarch6= 4_virt.py} (54%) mode change 100644 =3D> 100755 create mode 100755 tests/functional/test_mips64el_loongson3v.py rename tests/{avocado/netdev-ethtool.py =3D> functional/test_netdev_ethtoo= l.py} (66%) mode change 100644 =3D> 100755 rename tests/{avocado/ppc_405.py =3D> functional/test_ppc_405.py} (53%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 4912f8d0da..6545662eaf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -222,7 +222,7 @@ S: Maintained F: docs/system/target-avr.rst F: gdb-xml/avr-cpu.xml F: target/avr/ -F: tests/avocado/machine_avr6.py +F: tests/functional/test_avr_mega2560.py =20 CRIS TCG CPUs M: Edgar E. Iglesias @@ -266,7 +266,7 @@ M: Song Gao S: Maintained F: target/loongarch/ F: tests/tcg/loongarch64/ -F: tests/avocado/machine_loongarch.py +F: tests/functional/test_loongarch64_virt.py =20 M68K TCG CPUs M: Laurent Vivier @@ -886,7 +886,7 @@ F: include/hw/display/blizzard.h F: include/hw/input/lm832x.h F: include/hw/input/tsc2xxx.h F: include/hw/misc/cbus.h -F: tests/avocado/machine_arm_n8x0.py +F: tests/functional/test_arm_n8x0.py F: docs/system/arm/nseries.rst =20 Palm @@ -1397,7 +1397,7 @@ F: hw/mips/loongson3_virt.c F: include/hw/intc/loongson_ipi_common.h F: include/hw/intc/loongson_ipi.h F: include/hw/intc/loongson_liointc.h -F: tests/avocado/machine_mips_loongson3v.py +F: tests/functional/test_mips64el_loongson3v.py =20 Boston M: Paul Burton @@ -1423,7 +1423,7 @@ PowerPC Machines L: qemu-ppc@nongnu.org S: Orphan F: hw/ppc/ppc405* -F: tests/avocado/ppc_405.py +F: tests/functional/test_ppc_405.py =20 Bamboo L: qemu-ppc@nongnu.org @@ -2495,7 +2495,7 @@ R: Sriram Yagnaraman S: Maintained F: docs/system/devices/igb.rst F: hw/net/igb* -F: tests/avocado/netdev-ethtool.py +F: tests/functional/test_netdev_ethtool.py F: tests/qtest/igb-test.c F: tests/qtest/libqos/igb.c =20 diff --git a/tests/avocado/machine_mips_loongson3v.py b/tests/avocado/machi= ne_mips_loongson3v.py deleted file mode 100644 index 5194cf18c9..0000000000 --- a/tests/avocado/machine_mips_loongson3v.py +++ /dev/null @@ -1,39 +0,0 @@ -# Functional tests for the Generic Loongson-3 Platform. -# -# Copyright (c) 2021 Jiaxun Yang -# -# This work is licensed under the terms of the GNU GPL, version 2 or later. -# See the COPYING file in the top-level directory. -# -# SPDX-License-Identifier: GPL-2.0-or-later - -import os -import time - -from avocado import skipUnless -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern - -class MipsLoongson3v(QemuSystemTest): - timeout =3D 60 - - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') - def test_pmon_serial_console(self): - """ - :avocado: tags=3Darch:mips64el - :avocado: tags=3Dendian:little - :avocado: tags=3Dmachine:loongson3-virt - :avocado: tags=3Dcpu:Loongson-3A1000 - :avocado: tags=3Ddevice:liointc - :avocado: tags=3Ddevice:goldfish_rtc - """ - - pmon_hash =3D '7c8b45dd81ccfc55ff28f5aa267a41c3' - pmon_path =3D self.fetch_asset('https://github.com/loongson-commun= ity/pmon/' - 'releases/download/20210112/pmon-3avir= t.bin', - asset_hash=3Dpmon_hash, algorithm=3D'= md5') - - self.vm.set_console() - self.vm.add_args('-bios', pmon_path) - self.vm.launch() - wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:') diff --git a/tests/functional/meson.build b/tests/functional/meson.build index df79775df3..11ff246cef 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -11,6 +11,7 @@ endif =20 # Timeouts for individual tests that can be slow e.g. with debugging enabl= ed test_timeouts =3D { + 'netdev_ethtool' : 180, } =20 tests_generic_system =3D [ @@ -19,16 +20,36 @@ tests_generic_system =3D [ 'version', ] =20 -tests_ppc_quick =3D [ - 'ppc_74xx', -] - tests_generic_linuxuser =3D [ ] =20 tests_generic_bsduser =3D [ ] =20 +tests_arm_system_thorough =3D [ + 'arm_n8x0', +] + +tests_avr_system_thorough =3D [ + 'avr_mega2560', +] + +tests_loongarch64_system_thorough =3D [ + 'loongarch64_virt', +] + +tests_mips64el_system_thorough =3D [ + 'mips64el_loongson3v', +] + +tests_ppc_system_quick =3D [ + 'ppc_74xx', +] + +tests_ppc_system_thorough =3D [ + 'ppc_405', +] + tests_x86_64_system_quick =3D [ 'cpu_queries', 'mem_addr_space', @@ -37,6 +58,7 @@ tests_x86_64_system_quick =3D [ ] =20 tests_x86_64_system_thorough =3D [ + 'netdev_ethtool', ] =20 precache_all =3D [] diff --git a/tests/avocado/machine_arm_n8x0.py b/tests/functional/test_arm_= n8x0.py old mode 100644 new mode 100755 similarity index 51% rename from tests/avocado/machine_arm_n8x0.py rename to tests/functional/test_arm_n8x0.py index 12e9a6803b..ffcf468fe8 --- a/tests/avocado/machine_arm_n8x0.py +++ b/tests/functional/test_arm_n8x0.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a Linux kernel and checks the console # # Copyright (c) 2020 Red Hat, Inc. @@ -10,21 +12,22 @@ =20 import os =20 -from avocado import skipUnless -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from unittest import skipUnless +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern =20 class N8x0Machine(QemuSystemTest): """Boots the Linux kernel and checks that the console is operational""" =20 timeout =3D 90 =20 + ASSET_KERNEL =3D Asset( + ('http://stskeeps.subnetmask.net/meego-n8x0/' + 'meego-arm-n8x0-1.0.80.20100712.1431-vmlinuz-2.6.35~rc4-129.1-n8x= 0'), + '629f4616caacacd116d23d7572178f93691b0b918b25e28d7736c24f888d4292') + def __do_test_n8x0(self): - kernel_url =3D ('http://stskeeps.subnetmask.net/meego-n8x0/' - 'meego-arm-n8x0-1.0.80.20100712.1431-' - 'vmlinuz-2.6.35~rc4-129.1-n8x0') - kernel_hash =3D 'e9d5ab8d7548923a0061b6fbf601465e479ed269' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + kernel_path =3D self.ASSET_KERNEL.fetch() =20 self.vm.set_console(console_index=3D1) self.vm.add_args('-kernel', kernel_path, @@ -32,18 +35,15 @@ def __do_test_n8x0(self): self.vm.launch() wait_for_console_pattern(self, 'TSC2005 driver initializing') =20 - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') def test_n800(self): - """ - :avocado: tags=3Darch:arm - :avocado: tags=3Dmachine:n800 - """ + self.set_machine('n800') self.__do_test_n8x0() =20 - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') def test_n810(self): - """ - :avocado: tags=3Darch:arm - :avocado: tags=3Dmachine:n810 - """ + self.set_machine('n810') self.__do_test_n8x0() + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/machine_avr6.py b/tests/functional/test_avr_mega= 2560.py old mode 100644 new mode 100755 similarity index 72% rename from tests/avocado/machine_avr6.py rename to tests/functional/test_avr_mega2560.py index 5485db79c6..8e47b4200b --- a/tests/avocado/machine_avr6.py +++ b/tests/functional/test_avr_mega2560.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # QEMU AVR integration tests # @@ -19,26 +20,24 @@ =20 import time =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest, Asset =20 class AVR6Machine(QemuSystemTest): timeout =3D 5 =20 + ASSET_ROM =3D Asset(('https://github.com/seharris/qemu-avr-tests' + '/raw/36c3e67b8755dcf/free-rtos/Demo' + '/AVR_ATMega2560_GCC/demo.elf'), + 'ee4833bd65fc69e84a79ed1c608affddbd499a60e63acf87d91= 13618401904e4') + def test_freertos(self): - """ - :avocado: tags=3Darch:avr - :avocado: tags=3Dmachine:arduino-mega-2560-v3 - """ """ https://github.com/seharris/qemu-avr-tests/raw/master/free-rtos/De= mo/AVR_ATMega2560_GCC/demo.elf constantly prints out 'ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRS= TUVWX' """ - rom_url =3D ('https://github.com/seharris/qemu-avr-tests' - '/raw/36c3e67b8755dcf/free-rtos/Demo' - '/AVR_ATMega2560_GCC/demo.elf') - rom_hash =3D '7eb521f511ca8f2622e0a3c5e8dd686efbb911d4' - rom_path =3D self.fetch_asset(rom_url, asset_hash=3Drom_hash) + rom_path =3D self.ASSET_ROM.fetch() =20 + self.set_machine('arduino-mega-2560-v3') self.vm.add_args('-bios', rom_path) self.vm.add_args('-nographic') self.vm.launch() @@ -48,3 +47,6 @@ def test_freertos(self): =20 self.assertIn('ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRSTUVWX', self.vm.get_log()) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/machine_loongarch.py b/tests/functional/test_loo= ngarch64_virt.py old mode 100644 new mode 100755 similarity index 54% rename from tests/avocado/machine_loongarch.py rename to tests/functional/test_loongarch64_virt.py index 8de308f2d6..2b8baa2c2a --- a/tests/avocado/machine_loongarch.py +++ b/tests/functional/test_loongarch64_virt.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # SPDX-License-Identifier: GPL-2.0-or-later # # LoongArch virt test. @@ -5,15 +7,28 @@ # Copyright (c) 2023 Loongson Technology Corporation Limited # =20 -from avocado_qemu import QemuSystemTest -from avocado_qemu import exec_command_and_wait_for_pattern -from avocado_qemu import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import wait_for_console_pattern =20 class LoongArchMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 timeout =3D 120 =20 + ASSET_KERNEL =3D Asset( + ('https://github.com/yangxiaojuan-loongson/qemu-binary/' + 'releases/download/2024-05-30/vmlinuz.efi'), + '08b88a45f48a5fd92260bae895be4e5175be2397481a6f7821b9f39b2965b79e') + ASSET_INITRD =3D Asset( + ('https://github.com/yangxiaojuan-loongson/qemu-binary/' + 'releases/download/2024-05-30/ramdisk'), + '03d6fb6f8ee64ecac961120a0bdacf741f17b3bee2141f17fa01908c8baf176a') + ASSET_BIOS =3D Asset( + ('https://github.com/yangxiaojuan-loongson/qemu-binary/' + 'releases/download/2024-05-30/QEMU_EFI.fd'), + '937c1e7815e2340150c194a9f8f0474259038a3d7b8845ed62cc08163c46bea1') + def wait_for_console_pattern(self, success_message, vm=3DNone): wait_for_console_pattern(self, success_message, failure_message=3D'Kernel panic - not syn= cing', @@ -21,25 +36,11 @@ def wait_for_console_pattern(self, success_message, vm= =3DNone): =20 def test_loongarch64_devices(self): =20 - """ - :avocado: tags=3Darch:loongarch64 - :avocado: tags=3Dmachine:virt - """ - - kernel_url =3D ('https://github.com/yangxiaojuan-loongson/qemu-bin= ary/' - 'releases/download/2024-05-30/vmlinuz.efi') - kernel_hash =3D '951b485b16e3788b6db03a3e1793c067009e31a2' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + self.set_machine('virt') =20 - initrd_url =3D ('https://github.com/yangxiaojuan-loongson/qemu-bin= ary/' - 'releases/download/2024-05-30/ramdisk') - initrd_hash =3D 'c67658d9b2a447ce7db2f73ba3d373c9b2b90ab2' - initrd_path =3D self.fetch_asset(initrd_url, asset_hash=3Dinitrd_h= ash) - - bios_url =3D ('https://github.com/yangxiaojuan-loongson/qemu-binar= y/' - 'releases/download/2024-05-30/QEMU_EFI.fd') - bios_hash =3D ('f4d0966b5117d4cd82327c050dd668741046be69') - bios_path =3D self.fetch_asset(bios_url, asset_hash=3Dbios_hash) + kernel_path =3D self.ASSET_KERNEL.fetch() + initrd_path =3D self.ASSET_INITRD.fetch() + bios_path =3D self.ASSET_BIOS.fetch() =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + @@ -56,3 +57,6 @@ def test_loongarch64_devices(self): self.wait_for_console_pattern('Run /sbin/init as init process') exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', 'processor : 3') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/functional/test_mips64el_loongson3v.py b/tests/functiona= l/test_mips64el_loongson3v.py new file mode 100755 index 0000000000..55d62928c7 --- /dev/null +++ b/tests/functional/test_mips64el_loongson3v.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# +# Functional tests for the Generic Loongson-3 Platform. +# +# Copyright (c) 2021 Jiaxun Yang +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import time + +from unittest import skipUnless +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern + +class MipsLoongson3v(QemuSystemTest): + timeout =3D 60 + + ASSET_PMON =3D Asset( + ('https://github.com/loongson-community/pmon/' + 'releases/download/20210112/pmon-3avirt.bin'), + 'fcdf6bb2cb7885a4a62f31fcb0d5e368bac7b6cea28f40c6dfa678af22fea20a') + + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + def test_pmon_serial_console(self): + self.set_machine('loongson3-virt') + + pmon_path =3D self.ASSET_PMON.fetch() + + self.vm.set_console() + self.vm.add_args('-bios', pmon_path) + self.vm.launch() + wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/netdev-ethtool.py b/tests/functional/test_netdev= _ethtool.py old mode 100644 new mode 100755 similarity index 66% rename from tests/avocado/netdev-ethtool.py rename to tests/functional/test_netdev_ethtool.py index 5f33288f81..d5b911c918 --- a/tests/avocado/netdev-ethtool.py +++ b/tests/functional/test_netdev_ethtool.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # ethtool tests for emulated network devices # # This test leverages ethtool's --test sequence to validate network @@ -5,39 +7,33 @@ # # SPDX-License-Identifier: GPL-2.0-or-late =20 -from avocado import skip -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from unittest import skip +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern =20 class NetDevEthtool(QemuSystemTest): - """ - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dmachine:q35 - """ =20 # Runs in about 17s under KVM, 19s under TCG, 25s under GCOV timeout =3D 45 =20 # Fetch assets from the netdev-ethtool subdir of my shared test # images directory on fileserver.linaro.org. - def get_asset(self, name, sha1): - base_url =3D ('https://fileserver.linaro.org/s/' - 'kE4nCFLdQcoBF9t/download?' - 'path=3D%2Fnetdev-ethtool&files=3D' ) - url =3D base_url + name - # use explicit name rather than failing to neatly parse the - # URL into a unique one - return self.fetch_asset(name=3Dname, locations=3D(url), asset_hash= =3Dsha1) + ASSET_BASEURL =3D ('https://fileserver.linaro.org/s/kE4nCFLdQcoBF9t/' + 'download?path=3D%2Fnetdev-ethtool&files=3D') + ASSET_BZIMAGE =3D Asset( + ASSET_BASEURL + "bzImage", + "ed62ee06ea620b1035747f3f66a5e9fc5d3096b29f75562ada888b04cd1c4baf") + ASSET_ROOTFS =3D Asset( + ASSET_BASEURL + "rootfs.squashfs", + "8f0207e3c4d40832ae73c1a927e42ca30ccb1e71f047acb6ddb161ba422934e6") =20 def common_test_code(self, netdev, extra_args=3DNone): + self.set_machine('q35') =20 # This custom kernel has drivers for all the supported network # devices we can emulate in QEMU - kernel =3D self.get_asset("bzImage", - "33469d7802732d5815226166581442395cb289e2") - - rootfs =3D self.get_asset("rootfs.squashfs", - "9793cea7021414ae844bda51f558bd6565b50cdc") + kernel =3D self.ASSET_BZIMAGE.fetch() + rootfs =3D self.ASSET_ROOTFS.fetch() =20 append =3D 'printk.time=3D0 console=3DttyS0 ' append +=3D 'root=3D/dev/sr0 rootfstype=3Dsquashfs ' @@ -68,15 +64,9 @@ def common_test_code(self, netdev, extra_args=3DNone): self.vm.kill() =20 def test_igb(self): - """ - :avocado: tags=3Ddevice:igb - """ self.common_test_code("igb") =20 def test_igb_nomsi(self): - """ - :avocado: tags=3Ddevice:igb - """ self.common_test_code("igb", "pci=3Dnomsi") =20 # It seems the other popular cards we model in QEMU currently fail @@ -88,14 +78,11 @@ def test_igb_nomsi(self): =20 @skip("Incomplete reg 0x00178 support") def test_e1000(self): - """ - :avocado: tags=3Ddevice:e1000 - """ self.common_test_code("e1000") =20 @skip("Incomplete reg 0x00178 support") def test_i82550(self): - """ - :avocado: tags=3Ddevice:i82550 - """ self.common_test_code("i82550") + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/ppc_405.py b/tests/functional/test_ppc_405.py old mode 100644 new mode 100755 similarity index 53% rename from tests/avocado/ppc_405.py rename to tests/functional/test_ppc_405.py index 4e7e01aa76..9851c03ee9 --- a/tests/avocado/ppc_405.py +++ b/tests/functional/test_ppc_405.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test that the U-Boot firmware boots on ppc 405 machines and check the co= nsole # # Copyright (c) 2021 Red Hat, Inc. @@ -5,20 +7,21 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado.utils import archive -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern -from avocado_qemu import exec_command_and_wait_for_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test import exec_command_and_wait_for_pattern =20 class Ppc405Machine(QemuSystemTest): =20 timeout =3D 90 =20 + ASSET_UBOOT =3D Asset( + ('https://gitlab.com/huth/u-boot/-/raw/taihu-2021-10-09/' + 'u-boot-taihu.bin'), + 'a076bb6cdeaafa406330e51e074b66d8878d9036d67d4caa0137be03ee4c112c') + def do_test_ppc405(self): - uboot_url =3D ('https://gitlab.com/huth/u-boot/-/raw/' - 'taihu-2021-10-09/u-boot-taihu.bin') - uboot_hash =3D ('3208940e908a5edc7c03eab072c60f0dcfadc2ab'); - file_path =3D self.fetch_asset(uboot_url, asset_hash=3Duboot_hash) + file_path =3D self.ASSET_UBOOT.fetch() self.vm.set_console(console_index=3D1) self.vm.add_args('-bios', file_path) self.vm.launch() @@ -26,11 +29,9 @@ def do_test_ppc405(self): exec_command_and_wait_for_pattern(self, 'reset', 'AMCC PowerPC 405= EP') =20 def test_ppc_ref405ep(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:ref405ep - :avocado: tags=3Dcpu:405ep - :avocado: tags=3Daccel:tcg - """ self.require_accelerator("tcg") + self.set_machine('ref405ep') self.do_test_ppc405() + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025275; cv=none; d=zohomail.com; s=zohoarc; b=fXS7yaOYRQoEyDg8InpGxYuHPMb/khjl4qY0U16oUAoJWsWLc40oExjrrsXeA4jU+YHsbvw+83z1RH/TBIc278S5S5Gf5wXTpxKrylhs5jxDqiTzBt9srkk3fc+K2/6txdcIV68b9lmf+gwCxu9e4nl+h6YgEJDy+NEQsolDFvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025275; 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=CUlCdrlZD/QOIQ9A2IzQIjYOYxtFjKTIDyU/PU/G1mI=; b=LcRHqn42W3+4sGICu231jDlJHe9lX/KMY/CUD7hxJ3P9PxZ5DbslPPGKkl/WcAe1C0JAcl4/+XuE+N//okagHdu7sqzexmuheVHSInkMlK55ulUSLiBwdGBCzHBVpBQnF3v8p6TyNgY/nOqpB1WEc336ocTodl/WFalpRIEvb6I= 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 1725025275152341.7731819972587; Fri, 30 Aug 2024 06:41:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rq-0002sF-Dk; Fri, 30 Aug 2024 09:40:48 -0400 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 1sk1rR-0001OD-7a for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rP-0005VE-I3 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:20 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-DspJlZomMjOeuCCS7U5imA-1; Fri, 30 Aug 2024 09:40:15 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 543F91955BF9; Fri, 30 Aug 2024 13:40:14 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D2B5B300019C; Fri, 30 Aug 2024 13:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CUlCdrlZD/QOIQ9A2IzQIjYOYxtFjKTIDyU/PU/G1mI=; b=bZv7ehSFB3b4JSe9DC+Fs44d3UHQ6Qpm8tNDtHuVeM8N+aqh+S2SajvkESiyZopLm/X46a OummjmO+MemhcMLKxwIrNuMNvRZ0KKi1AjKzzK5GTbP4Mqrcsfm9Z5/r5nwNrWLqLkVOMt IwU/ggObdAUXRqSlRCncSbplxZEOQFo= X-MC-Unique: DspJlZomMjOeuCCS7U5imA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 18/44] tests/functional: Add a function for extracting files from an archive Date: Fri, 30 Aug 2024 15:38:12 +0200 Message-ID: <20240830133841.142644-19-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025276718116600 Some Avocado-based tests use the "archive" module from avocado.utils to extract files from an archive. To be able to use these tests without Avocado, we have to provide our own function for extracting files. Fortunately, there is already the tarfile module that will provide us with this functionality, so let's just add a nice wrapper function around that. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- tests/functional/qemu_test/utils.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/functional/qemu_test/utils.py diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py new file mode 100644 index 0000000000..4eb5e5d5e5 --- /dev/null +++ b/tests/functional/qemu_test/utils.py @@ -0,0 +1,21 @@ +# Utilities for python-based QEMU tests +# +# Copyright 2024 Red Hat, Inc. +# +# Authors: +# Thomas Huth +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import tarfile + +def archive_extract(archive, dest_dir, member=3DNone): + with tarfile.open(archive) as tf: + if hasattr(tarfile, 'data_filter'): + tf.extraction_filter =3D getattr(tarfile, 'data_filter', + (lambda member, path: member)) + if member: + tf.extract(member=3Dmember, path=3Ddest_dir) + else: + tf.extractall(path=3Ddest_dir) --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025346; cv=none; d=zohomail.com; s=zohoarc; b=ZInKKUyyCLqghfUqOTtH2sEpXd876YwUEh2HzCYrXN/LmpwO+/iSLeW8XTo1AtHO1KkL5kFDCqhG9QUIV1t8O0zZTH/OM9PR6s5kadEpZsGLx44lW+oFcxI+SMGWfr74vRYc0X+MJYo9ewkjk6k7+Iz3u166aKCHldCuplu/rRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025346; 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=HJd71dQVdMAFv/uCnQZYm2Z8thHkP99RpzNuTQjb65I=; b=juee4EqPJ+dIm/u8I9/VJbFJU5mJ2a5j+X358WDnffwSF5QcgUwZDFk10R70PfZnwApqi45SrUP2qHbbbZm1Px9guIAf6sU7DWu6KX+nv/Md6NmXNDPBZl6PJC3IYCtyXwI9L1owdNFbhGzkJNbSzgJAmO5fKqddSORLjK2Apl0= 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 1725025346811267.0746754248046; Fri, 30 Aug 2024 06:42:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rt-0003XE-TL; Fri, 30 Aug 2024 09:40:49 -0400 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 1sk1rZ-000213-Qd for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rV-0005Vw-TC for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:27 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-pOmVt_pgPLaNHYQOnHPNNQ-1; Fri, 30 Aug 2024 09:40:20 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8C9CD1956095; Fri, 30 Aug 2024 13:40:19 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DF6A2300019C; Fri, 30 Aug 2024 13:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HJd71dQVdMAFv/uCnQZYm2Z8thHkP99RpzNuTQjb65I=; b=VwL6UKNT8R6KL/1CRRKCtTNTsEuOHL602x9pfJhVaqYkKsFI/NrPZJUttlfiQQdsBt/m/Q dRdYnPIbIxDoGF26Jn3rC6HfF8SOMdZ2Gw789mEAquJZkGcDErdk3+ACsOKd5rB5+XO78l CGAjZ0943MNubFIXR0iY/ZUmLD9Ux4Y= X-MC-Unique: pOmVt_pgPLaNHYQOnHPNNQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 19/44] tests/functional: Convert some avocado tests that needed avocado.utils.archive Date: Fri, 30 Aug 2024 15:38:13 +0200 Message-ID: <20240830133841.142644-20-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025347147116600 Instead of using the "archive" module from avocado.utils, switch these tests to use the new wrapper function that is based on the "tarfile" module instead. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 6 +-- tests/avocado/machine_sparc64_sun4u.py | 36 ---------------- tests/functional/meson.build | 6 +++ .../test_arm_canona1100.py} | 30 ++++++++------ .../test_ppc_bamboo.py} | 33 +++++++-------- tests/functional/test_sparc64_sun4u.py | 41 +++++++++++++++++++ 6 files changed, 84 insertions(+), 68 deletions(-) delete mode 100644 tests/avocado/machine_sparc64_sun4u.py rename tests/{avocado/machine_arm_canona1100.py =3D> functional/test_arm_c= anona1100.py} (51%) mode change 100644 =3D> 100755 rename tests/{avocado/ppc_bamboo.py =3D> functional/test_ppc_bamboo.py} (6= 0%) mode change 100644 =3D> 100755 create mode 100755 tests/functional/test_sparc64_sun4u.py diff --git a/MAINTAINERS b/MAINTAINERS index 6545662eaf..56dcd56375 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -733,7 +733,7 @@ S: Odd Fixes F: include/hw/arm/digic.h F: hw/*/digic* F: include/hw/*/digic* -F: tests/avocado/machine_arm_canona1100.py +F: tests/functional/test_arm_canona1100.py F: docs/system/arm/digic.rst =20 Goldfish RTC @@ -1430,7 +1430,7 @@ L: qemu-ppc@nongnu.org S: Orphan F: hw/ppc/ppc440_bamboo.c F: hw/pci-host/ppc4xx_pci.c -F: tests/avocado/ppc_bamboo.py +F: tests/functional/test_ppc_bamboo.py =20 e500 L: qemu-ppc@nongnu.org @@ -1716,7 +1716,7 @@ F: include/hw/pci-host/sabre.h F: hw/pci-bridge/simba.c F: include/hw/pci-bridge/simba.h F: pc-bios/openbios-sparc64 -F: tests/avocado/machine_sparc64_sun4u.py +F: tests/functional/test_sparc64_sun4u.py =20 Sun4v M: Artyom Tarasenko diff --git a/tests/avocado/machine_sparc64_sun4u.py b/tests/avocado/machine= _sparc64_sun4u.py deleted file mode 100644 index d333c0ae91..0000000000 --- a/tests/avocado/machine_sparc64_sun4u.py +++ /dev/null @@ -1,36 +0,0 @@ -# Functional test that boots a Linux kernel and checks the console -# -# Copyright (c) 2020 Red Hat, Inc. -# -# Author: -# Thomas Huth -# -# This work is licensed under the terms of the GNU GPL, version 2 or -# later. See the COPYING file in the top-level directory. - -import os - -from avocado_qemu import wait_for_console_pattern -from avocado.utils import archive -from boot_linux_console import LinuxKernelTest - -class Sun4uMachine(LinuxKernelTest): - """Boots the Linux kernel and checks that the console is operational""" - - timeout =3D 90 - - def test_sparc64_sun4u(self): - """ - :avocado: tags=3Darch:sparc64 - :avocado: tags=3Dmachine:sun4u - """ - tar_url =3D ('https://qemu-advcal.gitlab.io' - '/qac-best-of-multiarch/download/day23.tar.xz') - tar_hash =3D '142db83cd974ffadc4f75c8a5cad5bcc5722c240' - file_path =3D self.fetch_asset(tar_url, asset_hash=3Dtar_hash) - archive.extract(file_path, self.workdir) - self.vm.set_console() - self.vm.add_args('-kernel', self.workdir + '/day23/vmlinux', - '-append', self.KERNEL_COMMON_COMMAND_LINE) - self.vm.launch() - wait_for_console_pattern(self, 'Starting logging: OK') diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 11ff246cef..920c0a3928 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -27,6 +27,7 @@ tests_generic_bsduser =3D [ ] =20 tests_arm_system_thorough =3D [ + 'arm_canona1100', 'arm_n8x0', ] =20 @@ -48,6 +49,11 @@ tests_ppc_system_quick =3D [ =20 tests_ppc_system_thorough =3D [ 'ppc_405', + 'ppc_bamboo', +] + +tests_sparc64_system_thorough =3D [ + 'sparc64_sun4u', ] =20 tests_x86_64_system_quick =3D [ diff --git a/tests/avocado/machine_arm_canona1100.py b/tests/functional/tes= t_arm_canona1100.py old mode 100644 new mode 100755 similarity index 51% rename from tests/avocado/machine_arm_canona1100.py rename to tests/functional/test_arm_canona1100.py index a42d8b0f2b..65f1228296 --- a/tests/avocado/machine_arm_canona1100.py +++ b/tests/functional/test_arm_canona1100.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots the canon-a1100 machine with firmware # # Copyright (c) 2020 Red Hat, Inc. @@ -8,28 +10,30 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern -from avocado.utils import archive +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test.utils import archive_extract =20 class CanonA1100Machine(QemuSystemTest): """Boots the barebox firmware and checks that the console is operation= al""" =20 timeout =3D 90 =20 + ASSET_BIOS =3D Asset(('https://qemu-advcal.gitlab.io' + '/qac-best-of-multiarch/download/day18.tar.xz'), + '28e71874ce985be66b7fd1345ed88cb2523b982f899c8d2900= d6353054a1be49') + def test_arm_canona1100(self): - """ - :avocado: tags=3Darch:arm - :avocado: tags=3Dmachine:canon-a1100 - :avocado: tags=3Ddevice:pflash_cfi02 - """ - tar_url =3D ('https://qemu-advcal.gitlab.io' - '/qac-best-of-multiarch/download/day18.tar.xz') - tar_hash =3D '068b5fc4242b29381acee94713509f8a876e9db6' - file_path =3D self.fetch_asset(tar_url, asset_hash=3Dtar_hash) - archive.extract(file_path, self.workdir) + self.set_machine('canon-a1100') + + file_path =3D self.ASSET_BIOS.fetch() + archive_extract(file_path, dest_dir=3Dself.workdir, + member=3D"day18/barebox.canon-a1100.bin") self.vm.set_console() self.vm.add_args('-bios', self.workdir + '/day18/barebox.canon-a1100.bin') self.vm.launch() wait_for_console_pattern(self, 'running /env/bin/init') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/ppc_bamboo.py b/tests/functional/test_ppc_bamboo= .py old mode 100644 new mode 100755 similarity index 60% rename from tests/avocado/ppc_bamboo.py rename to tests/functional/test_ppc_bamboo.py index a81be3d608..e72cbdee12 --- a/tests/avocado/ppc_bamboo.py +++ b/tests/functional/test_ppc_bamboo.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test that Linux kernel boots on the ppc bamboo board and check the conso= le # # Copyright (c) 2021 Red Hat @@ -5,30 +7,26 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado.utils import archive -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern -from avocado_qemu import exec_command_and_wait_for_pattern +from qemu_test.utils import archive_extract +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test import exec_command_and_wait_for_pattern =20 class BambooMachine(QemuSystemTest): =20 timeout =3D 90 =20 + ASSET_IMAGE =3D Asset( + ('http://landley.net/aboriginal/downloads/binaries/' + 'system-image-powerpc-440fp.tar.gz'), + 'c12b58f841c775a0e6df4832a55afe6b74814d1565d08ddeafc1fb949a075c5e') + def test_ppc_bamboo(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:bamboo - :avocado: tags=3Dcpu:440epb - :avocado: tags=3Ddevice:rtl8139 - :avocado: tags=3Daccel:tcg - """ + self.set_machine('bamboo') self.require_accelerator("tcg") self.require_netdev('user') - tar_url =3D ('http://landley.net/aboriginal/downloads/binaries/' - 'system-image-powerpc-440fp.tar.gz') - tar_hash =3D '53e5f16414b195b82d2c70272f81c2eedb39bad9' - file_path =3D self.fetch_asset(tar_url, asset_hash=3Dtar_hash) - archive.extract(file_path, self.workdir) + file_path =3D self.ASSET_IMAGE.fetch() + archive_extract(file_path, self.workdir) self.vm.set_console() self.vm.add_args('-kernel', self.workdir + '/system-image-powerpc-440fp/linux', @@ -40,3 +38,6 @@ def test_ppc_bamboo(self): exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2', '10.0.2.2 is alive!') exec_command_and_wait_for_pattern(self, 'halt', 'System Halted') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/functional/test_sparc64_sun4u.py b/tests/functional/test= _sparc64_sun4u.py new file mode 100755 index 0000000000..32e245f4ad --- /dev/null +++ b/tests/functional/test_sparc64_sun4u.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a Linux kernel and checks the console +# +# Copyright (c) 2020 Red Hat, Inc. +# +# Author: +# Thomas Huth +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import os + +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test.utils import archive_extract + +class Sun4uMachine(QemuSystemTest): + """Boots the Linux kernel and checks that the console is operational""" + + timeout =3D 90 + + ASSET_IMAGE =3D Asset( + ('https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/' + 'day23.tar.xz'), + 'a3ed92450704af244178351afd0e769776e7decb298e95a63abfd9a6e3f6c854') + + def test_sparc64_sun4u(self): + self.set_machine('sun4u') + file_path =3D self.ASSET_IMAGE.fetch() + kernel_name =3D 'day23/vmlinux' + archive_extract(file_path, self.workdir, kernel_name) + self.vm.set_console() + self.vm.add_args('-kernel', os.path.join(self.workdir, kernel_name= ), + '-append', 'printk.time=3D0') + self.vm.launch() + wait_for_console_pattern(self, 'Starting logging: OK') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025333; cv=none; d=zohomail.com; s=zohoarc; b=jBdMBmao5m/WJ2SL8LXPnvQtZ9QLUu25oiVUvbb9LthpJYaoH9oi+iwWD67Acl82hTU8Tc40oRlIlsQf7Ph8Ds+i90BVrUlaBrC7osV3++zhJZk7M+KQl6m1zfOUwgMO4mQEFG3y/lXumzp+iBOSMir9NfQ9zPu7TcsAfuXpBc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025333; 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=rk70OICAhAeLbntuaC3FwBywPK9KTtmY0S3oKiI8VMQ=; b=T9MpKFKKUGT2Ejje/KWWGN6ytaEKz0MuxzBNAu1LCwODTvNIDCHvPHbGCEC9PqgHBL4DeSVHs54aQdNV6aVzv6YDCvV5x9CYo7P6qIhW5NYcFTyAyT8KXjvdoBXCtgM1wJzjOOIFvZpqRkgF2yuoxBKDtwMJfTbj4UskyXXSuYE= 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 1725025333007645.3495462628258; Fri, 30 Aug 2024 06:42:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rw-0003sh-2k; Fri, 30 Aug 2024 09:40:52 -0400 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 1sk1rn-0002tz-6d for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rZ-0005WC-HP for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:32 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-287-zDSwwbTEPSuaiv3Op42wXA-1; Fri, 30 Aug 2024 09:40:24 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8BB791955D4B; Fri, 30 Aug 2024 13:40:23 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 11AAD3002242; Fri, 30 Aug 2024 13:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rk70OICAhAeLbntuaC3FwBywPK9KTtmY0S3oKiI8VMQ=; b=PGjyzi/Xlynbbl+K1Kw/foRhVLbf3Am3lmgFZ+DyvRMh3rGtu1uiL11G/Gku4ounwUarge lJZJIsIeaL4U7sBjcWuKGZBJhZ+25GT/Bx8Thu519SHpwpaKogNfjYzon+b0Q/GlIj2nMR lgJ6RKQSqtftPetUZ2OoptBFdReELZA= X-MC-Unique: zDSwwbTEPSuaiv3Op42wXA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 20/44] tests/functional: Convert the s390x avocado tests into standalone tests Date: Fri, 30 Aug 2024 15:38:14 +0200 Message-ID: <20240830133841.142644-21-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025335119116600 These tests use archive.lzma_uncompress() from the Avocado utils, so provide a small helper function for this, based on the standard lzma module from Python instead. And while we're at it, replace the MD5 hashes in the topology test with proper SHA256 hashes, since MD5 should not be used anymore nowadays. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 4 +- tests/functional/meson.build | 6 ++ tests/functional/qemu_test/utils.py | 14 +++ .../test_s390x_ccw_virtio.py} | 79 ++++++++--------- .../test_s390x_topology.py} | 86 ++++++++----------- 5 files changed, 94 insertions(+), 95 deletions(-) rename tests/{avocado/machine_s390_ccw_virtio.py =3D> functional/test_s390= x_ccw_virtio.py} (85%) mode change 100644 =3D> 100755 rename tests/{avocado/s390_topology.py =3D> functional/test_s390x_topology= .py} (88%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 56dcd56375..7fad267307 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1743,7 +1743,7 @@ S: Supported F: hw/s390x/ F: include/hw/s390x/ F: configs/devices/s390x-softmmu/default.mak -F: tests/avocado/machine_s390_ccw_virtio.py +F: tests/functional/test_s390x_ccw_virtio.py T: git https://github.com/borntraeger/qemu.git s390-next L: qemu-s390x@nongnu.org =20 @@ -1806,7 +1806,7 @@ F: hw/s390x/cpu-topology.c F: target/s390x/kvm/stsi-topology.c F: docs/devel/s390-cpu-topology.rst F: docs/system/s390x/cpu-topology.rst -F: tests/avocado/s390_topology.py +F: tests/functional/test_s390x_topology.py =20 X86 Machines ------------ diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 920c0a3928..16aa304c24 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -12,6 +12,7 @@ endif # Timeouts for individual tests that can be slow e.g. with debugging enabl= ed test_timeouts =3D { 'netdev_ethtool' : 180, + 's390x_ccw_virtio' : 180, } =20 tests_generic_system =3D [ @@ -52,6 +53,11 @@ tests_ppc_system_thorough =3D [ 'ppc_bamboo', ] =20 +tests_s390x_system_thorough =3D [ + 's390x_ccw_virtio', + 's390x_topology', +] + tests_sparc64_system_thorough =3D [ 'sparc64_sun4u', ] diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 4eb5e5d5e5..a12dac51b6 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -8,6 +8,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 +import lzma +import os +import shutil import tarfile =20 def archive_extract(archive, dest_dir, member=3DNone): @@ -19,3 +22,14 @@ def archive_extract(archive, dest_dir, member=3DNone): tf.extract(member=3Dmember, path=3Ddest_dir) else: tf.extractall(path=3Ddest_dir) + +def lzma_uncompress(xz_path, output_path): + if os.path.exists(output_path): + return + with lzma.open(xz_path, 'rb') as lzma_in: + try: + with open(output_path, 'wb') as raw_out: + shutil.copyfileobj(lzma_in, raw_out) + except: + os.remove(output_path) + raise diff --git a/tests/avocado/machine_s390_ccw_virtio.py b/tests/functional/te= st_s390x_ccw_virtio.py old mode 100644 new mode 100755 similarity index 85% rename from tests/avocado/machine_s390_ccw_virtio.py rename to tests/functional/test_s390x_ccw_virtio.py index 7a214110fc..f7acd90a89 --- a/tests/avocado/machine_s390_ccw_virtio.py +++ b/tests/functional/test_s390x_ccw_virtio.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots an s390x Linux guest with ccw and PCI devices # attached and checks whether the devices are recognized by Linux # @@ -12,17 +14,38 @@ import os import tempfile =20 -from avocado import skipUnless -from avocado_qemu import QemuSystemTest -from avocado_qemu import exec_command_and_wait_for_pattern -from avocado_qemu import wait_for_console_pattern -from avocado.utils import archive +from qemu_test import QemuSystemTest, Asset +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import wait_for_console_pattern +from qemu_test.utils import lzma_uncompress =20 class S390CCWVirtioMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 timeout =3D 120 =20 + ASSET_BUSTER_KERNEL =3D Asset( + ('https://snapshot.debian.org/archive/debian/' + '20201126T092837Z/dists/buster/main/installer-s390x/' + '20190702+deb10u6/images/generic/kernel.debian'), + 'd411d17c39ae7ad38d27534376cbe88b68b403c325739364122c2e6f1537e818') + ASSET_BUSTER_INITRD =3D Asset( + ('https://snapshot.debian.org/archive/debian/' + '20201126T092837Z/dists/buster/main/installer-s390x/' + '20190702+deb10u6/images/generic/initrd.debian'), + '836bbd0fe6a5ca81274c28c2b063ea315ce1868660866e9b60180c575fef9fd5') + + ASSET_F31_KERNEL =3D Asset( + ('https://archives.fedoraproject.org/pub/archive' + '/fedora-secondary/releases/31/Server/s390x/os' + '/images/kernel.img'), + '480859574f3f44caa6cd35c62d70e1ac0609134e22ce2a954bbed9b110c06e0b') + ASSET_F31_INITRD =3D Asset( + ('https://archives.fedoraproject.org/pub/archive' + '/fedora-secondary/releases/31/Server/s390x/os' + '/images/initrd.img'), + '04c46095b2c49020b1c2327158898b7db747e4892ae319726192fb949716aa9c') + def wait_for_console_pattern(self, success_message, vm=3DNone): wait_for_console_pattern(self, success_message, failure_message=3D'Kernel panic - not syn= cing', @@ -41,23 +64,10 @@ def clear_guest_dmesg(self): self.dmesg_clear_count +=3D 1 =20 def test_s390x_devices(self): + self.set_machine('s390-ccw-virtio') =20 - """ - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio - """ - - kernel_url =3D ('https://snapshot.debian.org/archive/debian/' - '20201126T092837Z/dists/buster/main/installer-s390x/' - '20190702+deb10u6/images/generic/kernel.debian') - kernel_hash =3D '5821fbee57d6220a067a8b967d24595621aa1eb6' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) - - initrd_url =3D ('https://snapshot.debian.org/archive/debian/' - '20201126T092837Z/dists/buster/main/installer-s390x/' - '20190702+deb10u6/images/generic/initrd.debian') - initrd_hash =3D '81ba09c97bef46e8f4660ac25b4ac0a5be3a94d6' - initrd_path =3D self.fetch_asset(initrd_url, asset_hash=3Dinitrd_h= ash) + kernel_path =3D self.ASSET_BUSTER_KERNEL.fetch() + initrd_path =3D self.ASSET_BUSTER_INITRD.fetch() =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + @@ -160,29 +170,13 @@ def test_s390x_devices(self): =20 =20 def test_s390x_fedora(self): + self.set_machine('s390-ccw-virtio') =20 - """ - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio - :avocado: tags=3Ddevice:virtio-gpu - :avocado: tags=3Ddevice:virtio-crypto - :avocado: tags=3Ddevice:virtio-net - :avocado: tags=3Dflaky - """ - - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/31/Server/s390x/os' - '/images/kernel.img') - kernel_hash =3D 'b93d1efcafcf29c1673a4ce371a1f8b43941cfeb' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + kernel_path =3D self.ASSET_F31_KERNEL.fetch() =20 - initrd_url =3D ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/31/Server/s390x/os' - '/images/initrd.img') - initrd_hash =3D '3de45d411df5624b8d8ef21cd0b44419ab59b12f' - initrd_path_xz =3D self.fetch_asset(initrd_url, asset_hash=3Dinitr= d_hash) + initrd_path_xz =3D self.ASSET_F31_INITRD.fetch() initrd_path =3D os.path.join(self.workdir, 'initrd-raw.img') - archive.lzma_uncompress(initrd_path_xz, initrd_path) + lzma_uncompress(initrd_path_xz, initrd_path) =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + ' audit= =3D0 ' @@ -277,3 +271,6 @@ def test_s390x_fedora(self): exec_command_and_wait_for_pattern(self, 'while ! (dmesg -c | grep Start.virtcrypto_remove)= ; do' ' sleep 1 ; done', 'Start virtcrypto_remove.') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/s390_topology.py b/tests/functional/test_s390x_t= opology.py old mode 100644 new mode 100755 similarity index 88% rename from tests/avocado/s390_topology.py rename to tests/functional/test_s390x_topology.py index 9154ac8776..20727f6bdf --- a/tests/avocado/s390_topology.py +++ b/tests/functional/test_s390x_topology.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a Linux kernel and checks the console # # Copyright IBM Corp. 2023 @@ -9,16 +11,13 @@ # later. See the COPYING file in the top-level directory. =20 import os -import shutil import time =20 -from avocado_qemu import QemuSystemTest -from avocado_qemu import exec_command -from avocado_qemu import exec_command_and_wait_for_pattern -from avocado_qemu import interrupt_interactive_console_until_pattern -from avocado_qemu import wait_for_console_pattern -from avocado.utils import process -from avocado.utils import archive +from qemu_test import QemuSystemTest, Asset +from qemu_test import exec_command +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import wait_for_console_pattern +from qemu_test.utils import lzma_uncompress =20 =20 class S390CPUTopology(QemuSystemTest): @@ -47,6 +46,17 @@ class S390CPUTopology(QemuSystemTest): 'root=3D/dev/ram ' 'selinux=3D0 ' 'rdinit=3D/bin/sh') + ASSET_F35_KERNEL =3D Asset( + ('https://archives.fedoraproject.org/pub/archive' + '/fedora-secondary/releases/35/Server/s390x/os' + '/images/kernel.img'), + '1f2dddfd11bb1393dd2eb2e784036fbf6fc11057a6d7d27f9eb12d3edc67ef73') + + ASSET_F35_INITRD =3D Asset( + ('https://archives.fedoraproject.org/pub/archive' + '/fedora-secondary/releases/35/Server/s390x/os' + '/images/initrd.img'), + '1100145fbca00240c8c372ae4b89b48c99844bc189b3dfbc3f481dc60055ca46') =20 def wait_until_booted(self): wait_for_console_pattern(self, 'no job control', @@ -78,21 +88,10 @@ def kernel_init(self): We need a minimal root filesystem with a shell. """ self.require_accelerator("kvm") - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/35/Server/s390x/os' - '/images/kernel.img') - kernel_hash =3D '0d1aaaf303f07cf0160c8c48e56fe638' - kernel_path =3D self.fetch_asset(kernel_url, algorithm=3D'md5', - asset_hash=3Dkernel_hash) - - initrd_url =3D ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/35/Server/s390x/os' - '/images/initrd.img') - initrd_hash =3D 'a122057d95725ac030e2ec51df46e172' - initrd_path_xz =3D self.fetch_asset(initrd_url, algorithm=3D'md5', - asset_hash=3Dinitrd_hash) + kernel_path =3D self.ASSET_F35_KERNEL.fetch() + initrd_path_xz =3D self.ASSET_F35_INITRD.fetch() initrd_path =3D os.path.join(self.workdir, 'initrd-raw.img') - archive.lzma_uncompress(initrd_path_xz, initrd_path) + lzma_uncompress(initrd_path_xz, initrd_path) =20 self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE @@ -115,10 +114,8 @@ def system_init(self): def test_single(self): """ This test checks the simplest topology with a single CPU. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.launch() self.wait_until_booted() @@ -127,10 +124,8 @@ def test_single(self): def test_default(self): """ This test checks the implicit topology. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.add_args('-smp', '13,drawers=3D2,books=3D2,sockets=3D3,cores=3D2,m= axcpus=3D24') @@ -154,10 +149,8 @@ def test_move(self): """ This test checks the topology modification by moving a CPU to another socket: CPU 0 is moved from socket 0 to socket 2. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.add_args('-smp', '1,drawers=3D2,books=3D2,sockets=3D3,cores=3D2,ma= xcpus=3D24') @@ -174,10 +167,8 @@ def test_dash_device(self): """ This test verifies that a CPU defined with the '-device' command line option finds its right place inside the topology. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.add_args('-smp', '1,drawers=3D2,books=3D2,sockets=3D3,cores=3D2,ma= xcpus=3D24') @@ -221,10 +212,8 @@ def test_polarization(self): """ This test verifies that QEMU modifies the entitlement change after several guest polarization change requests. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.launch() self.wait_until_booted() @@ -267,10 +256,8 @@ def test_entitlement(self): """ This test verifies that QEMU modifies the entitlement after a guest request and that the guest sees the change. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.launch() self.wait_until_booted() @@ -313,10 +300,8 @@ def test_dedicated(self): CPU is made dedicated. QEMU retains the entitlement value when horizontal polarization is= in effect. For the guest, the field shows the effective value of the entitlem= ent. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.launch() self.wait_until_booted() @@ -345,10 +330,8 @@ def test_socket_full(self): This test verifies that QEMU does not accept to overload a socket. The socket-id 0 on book-id 0 already contains CPUs 0 and 1 and can not accept any new CPU while socket-id 0 on book-id 1 is free. - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.add_args('-smp', '3,drawers=3D2,books=3D2,sockets=3D3,cores=3D2,ma= xcpus=3D24') @@ -369,10 +352,8 @@ def test_dedicated_error(self): """ This test verifies that QEMU refuses to lower the entitlement of a dedicated CPU - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.launch() self.wait_until_booted() @@ -417,10 +398,8 @@ def test_move_error(self): """ This test verifies that QEMU refuses to move a CPU to an nonexistent location - - :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390-ccw-virtio """ + self.set_machine('s390-ccw-virtio') self.kernel_init() self.vm.launch() self.wait_until_booted() @@ -437,3 +416,6 @@ def test_move_error(self): self.assertEqual(res['error']['class'], 'GenericError') =20 self.check_topology(0, 0, 0, 0, 'medium', False) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025382; cv=none; d=zohomail.com; s=zohoarc; b=UE59xrWdNEySiZTXt94D4woW2cU0081RTYT07uWLhNKFa0Ct/6P1jPlUMUd3eesQKREwPzPvvQ+v8/ui/G3UtktuZo441YIU3+JNnqSdDB9t9Z/kuO5m1pg9nZVvc3yvZCM7RNsgpiYYWsbOBZsKBUbeQAr8fcDnt9HxqtuRXj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025382; 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=i8y9xL+uhdM64vQaVTQin1iDd7vgMvUYlj2X5gTsxGw=; b=MWoan48p2P6fe7w5DEgKrG75ZPteXGfcRMy0lC34L8E1m1+jgVZp1lrlxFRyLF06U4ypTVLscj6FisGrwSEZyFIVvuL+/Z3zPDfS+F067segu3xwJ18iAX8EiNdfCsbHRsQLiF1P44xfIQyXp6NZ3qQ8+6twYTt9qzPNcDYyFqs= 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 1725025382022144.75783268740634; Fri, 30 Aug 2024 06:43:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1ru-0003dp-F0; Fri, 30 Aug 2024 09:40:50 -0400 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 1sk1rp-00034G-3s for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1re-0005WN-93 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:44 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-417-oEy1PETkOua_dKi-qmrlaw-1; Fri, 30 Aug 2024 09:40:28 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 20C6D1955F2D; Fri, 30 Aug 2024 13:40:27 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E1454300019C; Fri, 30 Aug 2024 13:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i8y9xL+uhdM64vQaVTQin1iDd7vgMvUYlj2X5gTsxGw=; b=WUcXgUd6DAGb4HHaWc/XCRvjqETHF0/Elqiccwj5gpPaxwUo1iaW4qsbhqr5wRjq87pv0f GFQuEvxp3BIIGgBhvLbVQnO0/0zY8e3e2xrrdET5OKEUYOvjA8wkFd8p3cT1nuKihSDo6Y y7Q2Wb82yRgvND8UHa/GE1/upJFLLXI= X-MC-Unique: oEy1PETkOua_dKi-qmrlaw-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 21/44] tests/functional: Convert the x86_cpu_model_versions test Date: Fri, 30 Aug 2024 15:38:15 +0200 Message-ID: <20240830133841.142644-22-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025383302116600 Nothing thrilling in here, it's just a straight forward conversion. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 1 + tests/functional/meson.build | 1 + .../test_x86_cpu_model_versions.py} | 65 ++++++------------- 3 files changed, 21 insertions(+), 46 deletions(-) rename tests/{avocado/x86_cpu_model_versions.py =3D> functional/test_x86_c= pu_model_versions.py} (92%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 7fad267307..bbb8fc78c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1836,6 +1836,7 @@ F: tests/unit/test-x86-topo.c F: tests/qtest/test-x86-cpuid-compat.c F: tests/functional/test_mem_addr_space.py F: tests/functional/test_pc_cpu_hotplug_props.py +F: tests/functional/test_x86_cpu_model_versions.py =20 PC Chipset M: Michael S. Tsirkin diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 16aa304c24..540e1361f8 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -67,6 +67,7 @@ tests_x86_64_system_quick =3D [ 'mem_addr_space', 'pc_cpu_hotplug_props', 'virtio_version', + 'x86_cpu_model_versions', ] =20 tests_x86_64_system_thorough =3D [ diff --git a/tests/avocado/x86_cpu_model_versions.py b/tests/functional/tes= t_x86_cpu_model_versions.py old mode 100644 new mode 100755 similarity index 92% rename from tests/avocado/x86_cpu_model_versions.py rename to tests/functional/test_x86_cpu_model_versions.py index 11101e02b9..bd18acd44f --- a/tests/avocado/x86_cpu_model_versions.py +++ b/tests/functional/test_x86_cpu_model_versions.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # Basic validation of x86 versioned CPU models and CPU model aliases # @@ -20,15 +21,13 @@ # License along with this library; if not, see . # =20 - -import avocado_qemu import re =20 -class X86CPUModelAliases(avocado_qemu.QemuSystemTest): +from qemu_test import QemuSystemTest + +class X86CPUModelAliases(QemuSystemTest): """ Validation of PC CPU model versions and CPU model aliases - - :avocado: tags=3Darch:x86_64 """ def validate_aliases(self, cpus): for c in cpus.values(): @@ -76,9 +75,8 @@ def validate_variant_aliases(self, cpus): def test_4_0_alias_compatibility(self): """ Check if pc-*-4.0 unversioned CPU model won't be reported as alias= es - - :avocado: tags=3Dmachine:pc-i440fx-4.0 """ + self.set_machine('pc-i440fx-4.0') # pc-*-4.0 won't expose non-versioned CPU models as aliases # We do this to help management software to keep compatibility # with older QEMU versions that didn't have the versioned CPU model @@ -110,9 +108,8 @@ def test_4_0_alias_compatibility(self): def test_4_1_alias(self): """ Check if unversioned CPU model is an alias pointing to right versi= on - - :avocado: tags=3Dmachine:pc-i440fx-4.1 """ + self.set_machine('pc-i440fx-4.1') self.vm.add_args('-S') self.vm.launch() =20 @@ -217,9 +214,8 @@ def test_4_1_alias(self): def test_none_alias(self): """ Check if unversioned CPU model is an alias pointing to some version - - :avocado: tags=3Dmachine:none """ + self.set_machine('none') self.vm.add_args('-S') self.vm.launch() =20 @@ -243,21 +239,16 @@ def test_none_alias(self): self.validate_aliases(cpus) =20 =20 -class CascadelakeArchCapabilities(avocado_qemu.QemuSystemTest): +class CascadelakeArchCapabilities(QemuSystemTest): """ Validation of Cascadelake arch-capabilities - - :avocado: tags=3Darch:x86_64 """ def get_cpu_prop(self, prop): cpu_path =3D self.vm.cmd('query-cpus-fast')[0].get('qom-path') return self.vm.cmd('qom-get', path=3Dcpu_path, property=3Dprop) =20 def test_4_1(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.1 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.1') # machine-type only: self.vm.add_args('-S') self.set_vm_arg('-cpu', @@ -268,10 +259,7 @@ def test_4_1(self): 'pc-i440fx-4.1 + Cascadelake-Server should not ha= ve arch-capabilities') =20 def test_4_0(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.0 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.0') self.vm.add_args('-S') self.set_vm_arg('-cpu', 'Cascadelake-Server,x-force-features=3Don,check=3D= off,' @@ -281,10 +269,7 @@ def test_4_0(self): 'pc-i440fx-4.0 + Cascadelake-Server should not ha= ve arch-capabilities') =20 def test_set_4_0(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.0 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.0') # command line must override machine-type if CPU model is not vers= ioned: self.vm.add_args('-S') self.set_vm_arg('-cpu', @@ -295,10 +280,7 @@ def test_set_4_0(self): 'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabili= ties should have arch-capabilities') =20 def test_unset_4_1(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.1 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.1') self.vm.add_args('-S') self.set_vm_arg('-cpu', 'Cascadelake-Server,x-force-features=3Don,check=3D= off,' @@ -308,10 +290,7 @@ def test_unset_4_1(self): 'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabil= ities should not have arch-capabilities') =20 def test_v1_4_0(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.0 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.0') # versioned CPU model overrides machine-type: self.vm.add_args('-S') self.set_vm_arg('-cpu', @@ -322,10 +301,7 @@ def test_v1_4_0(self): 'pc-i440fx-4.0 + Cascadelake-Server-v1 should not= have arch-capabilities') =20 def test_v2_4_0(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.0 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.0') self.vm.add_args('-S') self.set_vm_arg('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,check= =3Doff,' @@ -335,10 +311,7 @@ def test_v2_4_0(self): 'pc-i440fx-4.0 + Cascadelake-Server-v2 should have= arch-capabilities') =20 def test_v1_set_4_0(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.0 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.0') # command line must override machine-type and versioned CPU model: self.vm.add_args('-S') self.set_vm_arg('-cpu', @@ -349,10 +322,7 @@ def test_v1_set_4_0(self): 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capab= ilities should have arch-capabilities') =20 def test_v2_unset_4_1(self): - """ - :avocado: tags=3Dmachine:pc-i440fx-4.1 - :avocado: tags=3Dcpu:Cascadelake-Server - """ + self.set_machine('pc-i440fx-4.1') self.vm.add_args('-S') self.set_vm_arg('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,check= =3Doff,' @@ -360,3 +330,6 @@ def test_v2_unset_4_1(self): self.vm.launch() self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server-v2,-arch-capa= bilities should not have arch-capabilities') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025499; cv=none; d=zohomail.com; s=zohoarc; b=kiDL9X0sweFv5ba5B5ALE3f7sfuexkoZfXXE2UC+UGgxawoV4fDjl0TS22l93TdBALuxh9XHqP2MGSatasHKb+NFeNe8yo/o2pVMM5RTbmBCltgxUv8k70jTkZbJO4R99vV9Mt4bJULlIBmnl/v2ejppHmz4p2flQnnBmFYck8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025499; 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=hKa18JymFuE/04dpvL3CkD3F6pYvf0w7sZ+JXzXgV2E=; b=f/OVWBc5t8zhqXVRfrv9xq7yjhLtoaBWpXEiz9aF1/KJBL8B+NkS2EIK3hrzEtukg7zdofVc3PjPVZxt0A+ARhErU/BtDMkgNzTTrgNUeA7kMj2DoCwPkbHt/QtNoCr3YZHr+m8URtdY4y+oOZcPAz8/17lSJsxIaioDd7tqis4= 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 1725025499235659.5668715570268; Fri, 30 Aug 2024 06:44:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rx-00043e-89; Fri, 30 Aug 2024 09:40:53 -0400 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 1sk1rs-0003Gf-1R for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rm-0005Wc-TC for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:47 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-wMrfR-PQMS2Nj3B5982kCg-1; Fri, 30 Aug 2024 09:40:32 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3ED4D1955F42; Fri, 30 Aug 2024 13:40:31 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 78211300019C; Fri, 30 Aug 2024 13:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hKa18JymFuE/04dpvL3CkD3F6pYvf0w7sZ+JXzXgV2E=; b=Tjbr/sn3oXEfHD5txL9OoRSC1YnJOOfX0FURW6y2COvCIxHN5OxH1+7JZwGEhZ4b0r32Mv 4zMkV2YPUpBHg/k1OVwGmd3Ca8JiiHcimnkBfNQqk+IY5B8rERaj4k7MZ+347/V/V6ynDo yx2dBxVmpPD8JgTA8FrcE8NPQY7hKXY= X-MC-Unique: wMrfR-PQMS2Nj3B5982kCg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 22/44] tests/functional: Convert the microblaze avocado tests into standalone tests Date: Fri, 30 Aug 2024 15:38:16 +0200 Message-ID: <20240830133841.142644-23-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025499916116600 The machine_microblaze.py file contained two tests, one for each endianness. Since we only support one QEMU target binary per file in the new functional test environment, we have to split this file up into two files now. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/avocado/machine_microblaze.py | 61 ------------------- tests/functional/meson.build | 8 +++ .../functional/test_microblaze_s3adsp1800.py | 40 ++++++++++++ .../test_microblazeel_s3adsp1800.py | 42 +++++++++++++ 5 files changed, 91 insertions(+), 62 deletions(-) delete mode 100644 tests/avocado/machine_microblaze.py create mode 100755 tests/functional/test_microblaze_s3adsp1800.py create mode 100755 tests/functional/test_microblazeel_s3adsp1800.py diff --git a/MAINTAINERS b/MAINTAINERS index bbb8fc78c5..91f5a0545f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1329,7 +1329,7 @@ M: Edgar E. Iglesias S: Maintained F: hw/microblaze/petalogix_s3adsp1800_mmu.c F: include/hw/char/xilinx_uartlite.h -F: tests/avocado/machine_microblaze.py +F: tests/functional/test_microblaze*.py =20 petalogix_ml605 M: Edgar E. Iglesias diff --git a/tests/avocado/machine_microblaze.py b/tests/avocado/machine_mi= croblaze.py deleted file mode 100644 index 807709cd11..0000000000 --- a/tests/avocado/machine_microblaze.py +++ /dev/null @@ -1,61 +0,0 @@ -# Functional test that boots a microblaze Linux kernel and checks the cons= ole -# -# Copyright (c) 2018, 2021 Red Hat, Inc. -# -# This work is licensed under the terms of the GNU GPL, version 2 or -# later. See the COPYING file in the top-level directory. - -import time -from avocado_qemu import exec_command, exec_command_and_wait_for_pattern -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern -from avocado.utils import archive - -class MicroblazeMachine(QemuSystemTest): - - timeout =3D 90 - - def test_microblaze_s3adsp1800(self): - """ - :avocado: tags=3Darch:microblaze - :avocado: tags=3Dmachine:petalogix-s3adsp1800 - """ - - tar_url =3D ('https://qemu-advcal.gitlab.io' - '/qac-best-of-multiarch/download/day17.tar.xz') - tar_hash =3D '08bf3e3bfb6b6c7ce1e54ab65d54e189f2caf13f' - file_path =3D self.fetch_asset(tar_url, asset_hash=3Dtar_hash) - archive.extract(file_path, self.workdir) - self.vm.set_console() - self.vm.add_args('-kernel', self.workdir + '/day17/ballerina.bin') - self.vm.launch() - wait_for_console_pattern(self, 'This architecture does not have ' - 'kernel memory protection') - # Note: - # The kernel sometimes gets stuck after the "This architecture ..." - # message, that's why we don't test for a later string here. This - # needs some investigation by a microblaze wizard one day... - - def test_microblazeel_s3adsp1800(self): - """ - :avocado: tags=3Darch:microblazeel - :avocado: tags=3Dmachine:petalogix-s3adsp1800 - """ - - self.require_netdev('user') - tar_url =3D ('http://www.qemu-advent-calendar.org/2023/download/' - 'day13.tar.gz') - tar_hash =3D '6623d5fff5f84cfa8f34e286f32eff6a26546f44' - file_path =3D self.fetch_asset(tar_url, asset_hash=3Dtar_hash) - archive.extract(file_path, self.workdir) - self.vm.set_console() - self.vm.add_args('-kernel', self.workdir + '/day13/xmaton.bin') - self.vm.add_args('-nic', 'user,tftp=3D' + self.workdir + '/day13/') - self.vm.launch() - wait_for_console_pattern(self, 'QEMU Advent Calendar 2023') - time.sleep(0.1) - exec_command(self, 'root') - time.sleep(0.1) - exec_command_and_wait_for_pattern(self, - 'tftp -g -r xmaton.png 10.0.2.2 ; md5sum xmaton.png', - '821cd3cab8efd16ad6ee5acc3642a8ea') diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 540e1361f8..f32afed30f 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -40,6 +40,14 @@ tests_loongarch64_system_thorough =3D [ 'loongarch64_virt', ] =20 +tests_microblaze_system_thorough =3D [ + 'microblaze_s3adsp1800' +] + +tests_microblazeel_system_thorough =3D [ + 'microblazeel_s3adsp1800' +] + tests_mips64el_system_thorough =3D [ 'mips64el_loongson3v', ] diff --git a/tests/functional/test_microblaze_s3adsp1800.py b/tests/functio= nal/test_microblaze_s3adsp1800.py new file mode 100755 index 0000000000..4f692ffdb1 --- /dev/null +++ b/tests/functional/test_microblaze_s3adsp1800.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a microblaze Linux kernel and checks the cons= ole +# +# Copyright (c) 2018, 2021 Red Hat, Inc. +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import time +from qemu_test import exec_command, exec_command_and_wait_for_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test.utils import archive_extract + +class MicroblazeMachine(QemuSystemTest): + + timeout =3D 90 + + ASSET_IMAGE =3D Asset( + ('https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/' + 'day17.tar.xz'), + '3ba7439dfbea7af4876662c97f8e1f0cdad9231fc166e4861d17042489270057') + + def test_microblaze_s3adsp1800(self): + self.set_machine('petalogix-s3adsp1800') + file_path =3D self.ASSET_IMAGE.fetch() + archive_extract(file_path, self.workdir) + self.vm.set_console() + self.vm.add_args('-kernel', self.workdir + '/day17/ballerina.bin') + self.vm.launch() + wait_for_console_pattern(self, 'This architecture does not have ' + 'kernel memory protection') + # Note: + # The kernel sometimes gets stuck after the "This architecture ..." + # message, that's why we don't test for a later string here. This + # needs some investigation by a microblaze wizard one day... + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/functional/test_microblazeel_s3adsp1800.py b/tests/funct= ional/test_microblazeel_s3adsp1800.py new file mode 100755 index 0000000000..faa3927f2e --- /dev/null +++ b/tests/functional/test_microblazeel_s3adsp1800.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a microblaze Linux kernel and checks the cons= ole +# +# Copyright (c) 2018, 2021 Red Hat, Inc. +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import time +from qemu_test import exec_command, exec_command_and_wait_for_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test.utils import archive_extract + +class MicroblazeelMachine(QemuSystemTest): + + timeout =3D 90 + + ASSET_IMAGE =3D Asset( + ('http://www.qemu-advent-calendar.org/2023/download/day13.tar.gz'), + 'b9b3d43c5dd79db88ada495cc6e0d1f591153fe41355e925d791fbf44de50c22') + + def test_microblazeel_s3adsp1800(self): + self.require_netdev('user') + self.set_machine('petalogix-s3adsp1800') + file_path =3D self.ASSET_IMAGE.fetch() + archive_extract(file_path, self.workdir) + self.vm.set_console() + self.vm.add_args('-kernel', self.workdir + '/day13/xmaton.bin') + self.vm.add_args('-nic', 'user,tftp=3D' + self.workdir + '/day13/') + self.vm.launch() + wait_for_console_pattern(self, 'QEMU Advent Calendar 2023') + time.sleep(0.1) + exec_command(self, 'root') + time.sleep(0.1) + exec_command_and_wait_for_pattern(self, + 'tftp -g -r xmaton.png 10.0.2.2 ; md5sum xmaton.png', + '821cd3cab8efd16ad6ee5acc3642a8ea') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025495; cv=none; d=zohomail.com; s=zohoarc; b=ChM8gp0nnnn+3iKviBYPGZ6fYikjQiuICGUMKHQWHxPbfnZ6CCCrT+2JnRZi1n/F3q+rOIpGyOAMUI6w+OalAop/bLB/K3WzdbcDDgKQ/twXSSOw4v7dyV/5hW8MmUAA3L6sSL2wLoLjA4/cbcvhp1WxJSlbABFhiqYSwdhHpWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025495; 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=Sfl/k32CB6l1DcgvbguMCEWr8OuW9Mg9tzas69X/Dis=; b=apAxdeZ2FQQKfio1TGcrCthnQiyZW8R7QOShp0UpodPCV2sYdb++MYW4FZYvSJ/Ck6CBGdVTBrJSAjA7+ynYhpjEP78TSaZBOJtsereXgg3qISKftP++GXJGN8DKKGwCskZw9MnMs80DWhp/FCStInqWLi1rSWfqgbWFW8DIHco= 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 1725025495906103.84075431199346; Fri, 30 Aug 2024 06:44:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rx-00044p-C6; Fri, 30 Aug 2024 09:40:53 -0400 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 1sk1rq-0003By-RQ for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rm-0005Wi-Rl for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:46 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-CCM2Tbd9NkaI6Pe2o90eEA-1; Fri, 30 Aug 2024 09:40:36 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF8971955D4C; Fri, 30 Aug 2024 13:40:34 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 191F4300019C; Fri, 30 Aug 2024 13:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025239; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sfl/k32CB6l1DcgvbguMCEWr8OuW9Mg9tzas69X/Dis=; b=EjdnDEFLvYWFnMqK5uy9FzCZTCk6hEOsLYZ3gW2tsOWntxRVQLElT0bO6KD3FiliJUMmuc mfjlDGbGYuIUPIeS/ZFg6S7LdOQIsfHvzTUKy2wnhBIBUYTcv9DdCZbA8rFOGXIz8LiS+h mILnUa6BFVAClEd8MKPPm4D4zVb38Us= X-MC-Unique: CCM2Tbd9NkaI6Pe2o90eEA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 23/44] tests/functional: Convert the riscv_opensbi avocado test into a standalone test Date: Fri, 30 Aug 2024 15:38:17 +0200 Message-ID: <20240830133841.142644-24-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025497903116600 The avocado test defined test functions for both, riscv32 and riscv64. Since we can run the whole file with multiple targets in the new framework, we can now consolidate the functions so we have to only define one function per machine now. However, we have to mark the "spike" test as flaky now since it sometimes fails when running the tests in parallel (the failure happens also with the Avocado test when the host is under load, so the problem is not related to this conversion to the functional framework). Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth Tested-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 + tests/avocado/riscv_opensbi.py | 63 -------------------------- tests/functional/meson.build | 8 ++++ tests/functional/test_riscv_opensbi.py | 40 ++++++++++++++++ 4 files changed, 49 insertions(+), 63 deletions(-) delete mode 100644 tests/avocado/riscv_opensbi.py create mode 100755 tests/functional/test_riscv_opensbi.py diff --git a/MAINTAINERS b/MAINTAINERS index 91f5a0545f..11cefa015e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -337,6 +337,7 @@ F: hw/intc/riscv* F: include/hw/riscv/ F: linux-user/host/riscv32/ F: linux-user/host/riscv64/ +F: tests/functional/test_riscv* F: tests/tcg/riscv64/ =20 RISC-V XThead* extensions diff --git a/tests/avocado/riscv_opensbi.py b/tests/avocado/riscv_opensbi.py deleted file mode 100644 index bfff9cc3c3..0000000000 --- a/tests/avocado/riscv_opensbi.py +++ /dev/null @@ -1,63 +0,0 @@ -# OpenSBI boot test for RISC-V machines -# -# Copyright (c) 2022, Ventana Micro -# -# This work is licensed under the terms of the GNU GPL, version 2 or -# later. See the COPYING file in the top-level directory. - -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern - -class RiscvOpenSBI(QemuSystemTest): - """ - :avocado: tags=3Daccel:tcg - """ - timeout =3D 5 - - def boot_opensbi(self): - self.vm.set_console() - self.vm.launch() - wait_for_console_pattern(self, 'Platform Name') - wait_for_console_pattern(self, 'Boot HART MEDELEG') - - def test_riscv32_spike(self): - """ - :avocado: tags=3Darch:riscv32 - :avocado: tags=3Dmachine:spike - """ - self.boot_opensbi() - - def test_riscv64_spike(self): - """ - :avocado: tags=3Darch:riscv64 - :avocado: tags=3Dmachine:spike - """ - self.boot_opensbi() - - def test_riscv32_sifive_u(self): - """ - :avocado: tags=3Darch:riscv32 - :avocado: tags=3Dmachine:sifive_u - """ - self.boot_opensbi() - - def test_riscv64_sifive_u(self): - """ - :avocado: tags=3Darch:riscv64 - :avocado: tags=3Dmachine:sifive_u - """ - self.boot_opensbi() - - def test_riscv32_virt(self): - """ - :avocado: tags=3Darch:riscv32 - :avocado: tags=3Dmachine:virt - """ - self.boot_opensbi() - - def test_riscv64_virt(self): - """ - :avocado: tags=3Darch:riscv64 - :avocado: tags=3Dmachine:virt - """ - self.boot_opensbi() diff --git a/tests/functional/meson.build b/tests/functional/meson.build index f32afed30f..700deed24a 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -61,6 +61,14 @@ tests_ppc_system_thorough =3D [ 'ppc_bamboo', ] =20 +tests_riscv32_system_quick =3D [ + 'riscv_opensbi', +] + +tests_riscv64_system_quick =3D [ + 'riscv_opensbi', +] + tests_s390x_system_thorough =3D [ 's390x_ccw_virtio', 's390x_topology', diff --git a/tests/functional/test_riscv_opensbi.py b/tests/functional/test= _riscv_opensbi.py new file mode 100755 index 0000000000..de632d05cc --- /dev/null +++ b/tests/functional/test_riscv_opensbi.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# +# OpenSBI boot test for RISC-V machines +# +# Copyright (c) 2022, Ventana Micro +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import os +from unittest import skipUnless +from qemu_test import QemuSystemTest +from qemu_test import wait_for_console_pattern + +class RiscvOpenSBI(QemuSystemTest): + + timeout =3D 5 + + def boot_opensbi(self): + self.vm.set_console() + self.vm.launch() + wait_for_console_pattern(self, 'Platform Name') + wait_for_console_pattern(self, 'Boot HART MEDELEG') + + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), + 'Test is unstable when system is under load') + def test_riscv_spike(self): + self.set_machine('spike') + self.boot_opensbi() + + def test_riscv_sifive_u(self): + self.set_machine('sifive_u') + self.boot_opensbi() + + def test_riscv_virt(self): + self.set_machine('virt') + self.boot_opensbi() + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025300; cv=none; d=zohomail.com; s=zohoarc; b=Hd5dEZU9PqbtJF85tZXvdE6DeUmbQwRalfda4ecLO/I6SK3WEe2r6XgiXNyxHr7ZRFYllfDPS+Mn/Ddp6OHePi4oin3J9rKf1BPZGvXuAYV9TGVryY5xk/21rqL6vfZWFcm8q2OInbUpc2yjwhShDgrKCX2E3I+++Gb1v4ZOQbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025300; 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=zr+s/lqYpQ8I3m4DDKnA8CYmnV0al6kWevjI/F9N7zc=; b=Lh6UyhY1c2P063KNgEudrvzFcejff783/fy8666HBr1IE1IPFbjavb8KszNBaJ7s2fiUz+1USnX3Xghul5NMYfte96GOvUrAhFuHL6qs2Hs8+snrVjsr4/uv8hU7Bm9lquC2gbMAvVjn2O+VP6avD2WPvGiCf4d84O1BrAEDUHU= 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 1725025300269627.4977782144593; Fri, 30 Aug 2024 06:41:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1rw-0003yu-R8; Fri, 30 Aug 2024 09:40:52 -0400 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 1sk1rs-0003Kb-KJ for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rp-0005X4-1v for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:47 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-492-d2OfzeBlMtaFR3rJ4M1y0w-1; Fri, 30 Aug 2024 09:40:41 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0214D1955BEE; Fri, 30 Aug 2024 13:40:40 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6B56C300019C; Fri, 30 Aug 2024 13:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zr+s/lqYpQ8I3m4DDKnA8CYmnV0al6kWevjI/F9N7zc=; b=bg18dBwPMEdkifS6IItiZd77TV87s5PpaKK0mCR3t4jHFKW8SiT4dtQ+PUr/KDI/kWCH1l o13Y6cCHyWN1Oeq8kubVqiq7jBaRMd6H437JNzgS6ewEXT0fkR9uNPuf7rBTUBWgTV2CCa MXdmJumPuTnbZ8qFawp7p2m0spoePic= X-MC-Unique: d2OfzeBlMtaFR3rJ4M1y0w-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 24/44] tests/functional: Convert the virtio_gpu avocado test into a standalone test Date: Fri, 30 Aug 2024 15:38:18 +0200 Message-ID: <20240830133841.142644-25-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025300827116600 Nothing thrilling in here, it's just a straight forward conversion. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- tests/functional/meson.build | 1 + .../test_virtio_gpu.py} | 64 +++++++++---------- 2 files changed, 30 insertions(+), 35 deletions(-) rename tests/{avocado/virtio-gpu.py =3D> functional/test_virtio_gpu.py} (7= 3%) mode change 100644 =3D> 100755 diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 700deed24a..5559d131f3 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -88,6 +88,7 @@ tests_x86_64_system_quick =3D [ =20 tests_x86_64_system_thorough =3D [ 'netdev_ethtool', + 'virtio_gpu', ] =20 precache_all =3D [] diff --git a/tests/avocado/virtio-gpu.py b/tests/functional/test_virtio_gpu= .py old mode 100644 new mode 100755 similarity index 73% rename from tests/avocado/virtio-gpu.py rename to tests/functional/test_virtio_gpu.py index 6091f614a4..441cbdcf2d --- a/tests/avocado/virtio-gpu.py +++ b/tests/functional/test_virtio_gpu.py @@ -1,14 +1,16 @@ +#!/usr/bin/env python3 +# # virtio-gpu tests # # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 =20 -from avocado_qemu import BUILD_DIR -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern -from avocado_qemu import exec_command_and_wait_for_pattern -from avocado_qemu import is_readable_executable_file +from qemu_test import BUILD_DIR +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import is_readable_executable_file =20 from qemu.utils import kvm_available =20 @@ -28,25 +30,18 @@ def pick_default_vug_bin(): =20 =20 class VirtioGPUx86(QemuSystemTest): - """ - :avocado: tags=3Dvirtio-gpu - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dcpu:host - """ =20 KERNEL_COMMAND_LINE =3D "printk.time=3D0 console=3DttyS0 rdinit=3D/bin= /bash" - KERNEL_URL =3D ( - "https://archives.fedoraproject.org/pub/archive/fedora" - "/linux/releases/33/Everything/x86_64/os/images" - "/pxeboot/vmlinuz" - ) - KERNEL_HASH =3D '1433cfe3f2ffaa44de4ecfb57ec25dc2399cdecf' - INITRD_URL =3D ( - "https://archives.fedoraproject.org/pub/archive/fedora" - "/linux/releases/33/Everything/x86_64/os/images" - "/pxeboot/initrd.img" - ) - INITRD_HASH =3D 'c828d68a027b53e5220536585efe03412332c2d9' + ASSET_KERNEL =3D Asset( + ("https://archives.fedoraproject.org/pub/archive/fedora" + "/linux/releases/33/Everything/x86_64/os/images" + "/pxeboot/vmlinuz"), + '2dc5fb5cfe9ac278fa45640f3602d9b7a08cc189ed63fd9b162b07073e4df397') + ASSET_INITRD =3D Asset( + ("https://archives.fedoraproject.org/pub/archive/fedora" + "/linux/releases/33/Everything/x86_64/os/images" + "/pxeboot/initrd.img"), + 'c49b97f893a5349e4883452178763e402bdc5caa8845b226a2d1329b5f356045') =20 def wait_for_console_pattern(self, success_message, vm=3DNone): wait_for_console_pattern( @@ -57,16 +52,14 @@ def wait_for_console_pattern(self, success_message, vm= =3DNone): ) =20 def test_virtio_vga_virgl(self): - """ - :avocado: tags=3Ddevice:virtio-vga-gl - """ # FIXME: should check presence of virtio, virgl etc self.require_accelerator('kvm') =20 - kernel_path =3D self.fetch_asset(self.KERNEL_URL, self.KERNEL_HASH) - initrd_path =3D self.fetch_asset(self.INITRD_URL, self.INITRD_HASH) + kernel_path =3D self.ASSET_KERNEL.fetch() + initrd_path =3D self.ASSET_INITRD.fetch() =20 self.vm.set_console() + self.vm.add_args("-cpu", "host") self.vm.add_args("-m", "2G") self.vm.add_args("-machine", "pc,accel=3Dkvm") self.vm.add_args("-device", "virtio-vga-gl") @@ -83,7 +76,7 @@ def test_virtio_vga_virgl(self): self.vm.launch() except: # TODO: probably fails because we are missing the VirGL featur= es - self.cancel("VirGL not enabled?") + self.skipTest("VirGL not enabled?") =20 self.wait_for_console_pattern("as init process") exec_command_and_wait_for_pattern( @@ -92,18 +85,15 @@ def test_virtio_vga_virgl(self): self.wait_for_console_pattern("features: +virgl +edid") =20 def test_vhost_user_vga_virgl(self): - """ - :avocado: tags=3Ddevice:vhost-user-vga - """ # FIXME: should check presence of vhost-user-gpu, virgl, memfd etc self.require_accelerator('kvm') =20 vug =3D pick_default_vug_bin() if not vug: - self.cancel("Could not find vhost-user-gpu") + self.skipTest("Could not find vhost-user-gpu") =20 - kernel_path =3D self.fetch_asset(self.KERNEL_URL, self.KERNEL_HASH) - initrd_path =3D self.fetch_asset(self.INITRD_URL, self.INITRD_HASH) + kernel_path =3D self.ASSET_KERNEL.fetch() + initrd_path =3D self.ASSET_INITRD.fetch() =20 # Create socketpair to connect proxy and remote processes qemu_sock, vug_sock =3D socket.socketpair( @@ -129,6 +119,7 @@ def test_vhost_user_vga_virgl(self): ) =20 self.vm.set_console() + self.vm.add_args("-cpu", "host") self.vm.add_args("-m", "2G") self.vm.add_args("-object", "memory-backend-memfd,id=3Dmem,size=3D= 2G") self.vm.add_args("-machine", "pc,memory-backend=3Dmem,accel=3Dkvm") @@ -147,7 +138,7 @@ def test_vhost_user_vga_virgl(self): self.vm.launch() except: # TODO: probably fails because we are missing the VirGL featur= es - self.cancel("VirGL not enabled?") + self.skipTest("VirGL not enabled?") self.wait_for_console_pattern("as init process") exec_command_and_wait_for_pattern(self, "/usr/sbin/modprobe virtio= _gpu", "features: +virgl +edid") @@ -155,3 +146,6 @@ def test_vhost_user_vga_virgl(self): qemu_sock.close() vugp.terminate() vugp.wait() + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025503; cv=none; d=zohomail.com; s=zohoarc; b=jag25kvIvGkuAP7tFWbV1ygb77EaHSERKtAlZjltN7WH+ngUc5VlFUAtS6wIy6IHLMePL3oSeqrHRchnM1xOTjGw0/G4UnHERe79G7pu9wam9h0FsLDdt1cAvwZjzu6UBgNZ7pI94HcHtv6MhJW60XKXMWiT2PNvBMJZPr+Gfx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025503; 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=mQzBlXlVSrdxPNlurwEBJE+0Kv/YQdLb7PufvMD1zdM=; b=LTk/7ghtKGZp0Fdpd8GyUT0flnJR7e/khd97keOZwFPYaDGiGJD1a3J5s5S/sIeuXEFXb8qqai3TQ+QxWU148XNVR9nie2gG3pGPMwPY4Rv9t19TKxsfV4/uAiyPSNy0+IrXz7tDITRif0JaxZOL7/Wqn3NqL2YHOpnDJuIJTHg= 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 1725025503697646.2942142952795; Fri, 30 Aug 2024 06:45:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1s0-0004Vc-IR; Fri, 30 Aug 2024 09:40:56 -0400 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 1sk1ry-0004CF-51 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rt-0005YA-2z for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:53 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-580-Etm_KAY2PPOJX9tP5NRQNg-1; Fri, 30 Aug 2024 09:40:45 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 22C991955D4A; Fri, 30 Aug 2024 13:40:44 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C8955300019C; Fri, 30 Aug 2024 13:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mQzBlXlVSrdxPNlurwEBJE+0Kv/YQdLb7PufvMD1zdM=; b=FT7ZbuwNrih16uNAw0NfnnCer6QuEqpSrq5hgw7zBPSlbN1lAMMj3MkUDmkDjDmPNkGtVm GZ/KvtXjaZfHaFIUf2QMUOCoKtJDvDnnf23PeYFCspMywqv6/P/R+TrIyC/HXa/JQ5GxPS 1FeBow/lcdGZNOM/19aGymdJ8/A/Sps= X-MC-Unique: Etm_KAY2PPOJX9tP5NRQNg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 25/44] tests/functional: Convert most ppc avocado tests into standalone tests Date: Fri, 30 Aug 2024 15:38:19 +0200 Message-ID: <20240830133841.142644-26-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025506924116600 Nothing thrilling in here, just straight forward conversions. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth Tested-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 9 +-- tests/functional/meson.build | 11 ++++ .../test_ppc64_powernv.py} | 56 +++++----------- .../test_ppc64_pseries.py} | 56 +++++----------- .../test_ppc_40p.py} | 65 +++++++++---------- .../test_ppc_mpc8544ds.py} | 29 +++++---- .../test_ppc_virtex_ml507.py} | 29 +++++---- 7 files changed, 113 insertions(+), 142 deletions(-) rename tests/{avocado/ppc_powernv.py =3D> functional/test_ppc64_powernv.py= } (71%) mode change 100644 =3D> 100755 rename tests/{avocado/ppc_pseries.py =3D> functional/test_ppc64_pseries.py= } (76%) mode change 100644 =3D> 100755 rename tests/{avocado/ppc_prep_40p.py =3D> functional/test_ppc_40p.py} (51= %) mode change 100644 =3D> 100755 rename tests/{avocado/ppc_mpc8544ds.py =3D> functional/test_ppc_mpc8544ds.= py} (55%) mode change 100644 =3D> 100755 rename tests/{avocado/ppc_virtex_ml507.py =3D> functional/test_ppc_virtex_= ml507.py} (60%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 11cefa015e..26c9fba7c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1454,7 +1454,7 @@ L: qemu-ppc@nongnu.org S: Orphan F: hw/ppc/mpc8544ds.c F: hw/ppc/mpc8544_guts.c -F: tests/avocado/ppc_mpc8544ds.py +F: tests/functional/test_ppc_mpc8544ds.py =20 New World (mac99) M: Mark Cave-Ayland @@ -1507,7 +1507,7 @@ F: hw/dma/i82374.c F: hw/rtc/m48t59-isa.c F: include/hw/isa/pc87312.h F: include/hw/rtc/m48t59.h -F: tests/avocado/ppc_prep_40p.py +F: tests/functional/test_ppc_40p.py =20 sPAPR (pseries) M: Nicholas Piggin @@ -1531,7 +1531,7 @@ F: tests/qtest/spapr* F: tests/qtest/libqos/*spapr* F: tests/qtest/rtas* F: tests/qtest/libqos/rtas* -F: tests/avocado/ppc_pseries.py +F: tests/functional/test_ppc64_pseries.py F: tests/avocado/ppc_hv_tests.py =20 PowerNV (Non-Virtualized) @@ -1549,6 +1549,7 @@ F: include/hw/ppc/pnv* F: include/hw/pci-host/pnv* F: pc-bios/skiboot.lid F: tests/qtest/pnv* +F: tests/functional/test_ppc64_powernv.py =20 pca955x M: Glenn Miles @@ -1563,7 +1564,7 @@ M: Edgar E. Iglesias L: qemu-ppc@nongnu.org S: Odd Fixes F: hw/ppc/virtex_ml507.c -F: tests/avocado/ppc_virtex_ml507.py +F: tests/functional/test_ppc_virtex_ml507.py =20 sam460ex M: BALATON Zoltan diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 5559d131f3..3726c61ca3 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -12,6 +12,9 @@ endif # Timeouts for individual tests that can be slow e.g. with debugging enabl= ed test_timeouts =3D { 'netdev_ethtool' : 180, + 'ppc_40p' : 240, + 'ppc64_powernv' : 120, + 'ppc64_pseries' : 120, 's390x_ccw_virtio' : 180, } =20 @@ -58,7 +61,15 @@ tests_ppc_system_quick =3D [ =20 tests_ppc_system_thorough =3D [ 'ppc_405', + 'ppc_40p', 'ppc_bamboo', + 'ppc_mpc8544ds', + 'ppc_virtex_ml507', +] + +tests_ppc64_system_thorough =3D [ + 'ppc64_powernv', + 'ppc64_pseries', ] =20 tests_riscv32_system_quick =3D [ diff --git a/tests/avocado/ppc_powernv.py b/tests/functional/test_ppc64_pow= ernv.py old mode 100644 new mode 100755 similarity index 71% rename from tests/avocado/ppc_powernv.py rename to tests/functional/test_ppc64_powernv.py index 4342941d5d..67497d6404 --- a/tests/avocado/ppc_powernv.py +++ b/tests/functional/test_ppc64_powernv.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test that Linux kernel boots on ppc powernv machines and check the conso= le # # Copyright (c) 2018, 2020 Red Hat, Inc. @@ -5,9 +7,8 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado.utils import archive -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern =20 class powernvMachine(QemuSystemTest): =20 @@ -16,13 +17,14 @@ class powernvMachine(QemuSystemTest): panic_message =3D 'Kernel panic - not syncing' good_message =3D 'VFS: Cannot open root device' =20 + ASSET_KERNEL =3D Asset( + ('https://archives.fedoraproject.org/pub/archive/fedora-secondary/' + 'releases/29/Everything/ppc64le/os/ppc/ppc64/vmlinuz'), + '383c2f5c23bc0d9d32680c3924d3fd7ee25cc5ef97091ac1aa5e1d853422fc5f') + def do_test_linux_boot(self, command_line =3D KERNEL_COMMON_COMMAND_LI= NE): self.require_accelerator("tcg") - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/29/Everything/ppc64le/os' - '/ppc/ppc64/vmlinuz') - kernel_hash =3D '3fe04abfc852b66653b8c3c897a59a689270bc77' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + kernel_path =3D self.ASSET_KERNEL.fetch() =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_path, @@ -30,23 +32,13 @@ def do_test_linux_boot(self, command_line =3D KERNEL_CO= MMON_COMMAND_LINE): self.vm.launch() =20 def test_linux_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:powernv - :avocado: tags=3Daccel:tcg - """ - + self.set_machine('powernv') self.do_test_linux_boot() console_pattern =3D 'VFS: Cannot open root device' wait_for_console_pattern(self, console_pattern, self.panic_message) =20 def test_linux_smp_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:powernv - :avocado: tags=3Daccel:tcg - """ - + self.set_machine('powernv') self.vm.add_args('-smp', '4') self.do_test_linux_boot() console_pattern =3D 'smp: Brought up 1 node, 4 CPUs' @@ -54,12 +46,7 @@ def test_linux_smp_boot(self): wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) =20 def test_linux_smp_hpt_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:powernv - :avocado: tags=3Daccel:tcg - """ - + self.set_machine('powernv') self.vm.add_args('-smp', '4') self.do_test_linux_boot(self.KERNEL_COMMON_COMMAND_LINE + 'disable_radix') @@ -70,12 +57,7 @@ def test_linux_smp_hpt_boot(self): wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) =20 def test_linux_smt_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:powernv - :avocado: tags=3Daccel:tcg - """ - + self.set_machine('powernv') self.vm.add_args('-smp', '4,threads=3D4') self.do_test_linux_boot() console_pattern =3D 'CPU maps initialized for 4 threads per core' @@ -85,12 +67,7 @@ def test_linux_smt_boot(self): wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) =20 def test_linux_big_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:powernv - :avocado: tags=3Daccel:tcg - """ - + self.set_machine('powernv') self.vm.add_args('-smp', '16,threads=3D4,cores=3D2,sockets=3D2') =20 # powernv does not support NUMA @@ -100,3 +77,6 @@ def test_linux_big_boot(self): console_pattern =3D 'smp: Brought up 2 nodes, 16 CPUs' wait_for_console_pattern(self, console_pattern, self.panic_message) wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/ppc_pseries.py b/tests/functional/test_ppc64_pse= ries.py old mode 100644 new mode 100755 similarity index 76% rename from tests/avocado/ppc_pseries.py rename to tests/functional/test_ppc64_pseries.py index 74aaa4ac4a..fdc404ed03 --- a/tests/avocado/ppc_pseries.py +++ b/tests/functional/test_ppc64_pseries.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test that Linux kernel boots on ppc machines and check the console # # Copyright (c) 2018, 2020 Red Hat, Inc. @@ -5,9 +7,8 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado.utils import archive -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern =20 class pseriesMachine(QemuSystemTest): =20 @@ -16,12 +17,13 @@ class pseriesMachine(QemuSystemTest): panic_message =3D 'Kernel panic - not syncing' good_message =3D 'VFS: Cannot open root device' =20 + ASSET_KERNEL =3D Asset( + ('https://archives.fedoraproject.org/pub/archive/fedora-secondary/' + 'releases/29/Everything/ppc64le/os/ppc/ppc64/vmlinuz'), + '383c2f5c23bc0d9d32680c3924d3fd7ee25cc5ef97091ac1aa5e1d853422fc5f') + def do_test_ppc64_linux_boot(self, kernel_command_line =3D KERNEL_COMM= ON_COMMAND_LINE): - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive' - '/fedora-secondary/releases/29/Everything/ppc64le/os' - '/ppc/ppc64/vmlinuz') - kernel_hash =3D '3fe04abfc852b66653b8c3c897a59a689270bc77' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + kernel_path =3D self.ASSET_KERNEL.fetch() =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_path, @@ -29,32 +31,20 @@ def do_test_ppc64_linux_boot(self, kernel_command_line = =3D KERNEL_COMMON_COMMAND_L self.vm.launch() =20 def test_ppc64_vof_linux_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - """ - + self.set_machine('pseries') self.vm.add_args('-machine', 'x-vof=3Don') self.do_test_ppc64_linux_boot() console_pattern =3D 'VFS: Cannot open root device' wait_for_console_pattern(self, console_pattern, self.panic_message) =20 def test_ppc64_linux_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - """ - + self.set_machine('pseries') self.do_test_ppc64_linux_boot() console_pattern =3D 'VFS: Cannot open root device' wait_for_console_pattern(self, console_pattern, self.panic_message) =20 def test_ppc64_linux_smp_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - """ - + self.set_machine('pseries') self.vm.add_args('-smp', '4') self.do_test_ppc64_linux_boot() console_pattern =3D 'smp: Brought up 1 node, 4 CPUs' @@ -62,11 +52,7 @@ def test_ppc64_linux_smp_boot(self): wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) =20 def test_ppc64_linux_hpt_smp_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - """ - + self.set_machine('pseries') self.vm.add_args('-smp', '4') self.do_test_ppc64_linux_boot(self.KERNEL_COMMON_COMMAND_LINE + 'disable_radix') @@ -77,11 +63,6 @@ def test_ppc64_linux_hpt_smp_boot(self): wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) =20 def test_ppc64_linux_smt_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - """ - self.vm.add_args('-smp', '4,threads=3D4') self.do_test_ppc64_linux_boot() console_pattern =3D 'CPU maps initialized for 4 threads per core' @@ -91,11 +72,7 @@ def test_ppc64_linux_smt_boot(self): wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) =20 def test_ppc64_linux_big_boot(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - """ - + self.set_machine('pseries') self.vm.add_args('-smp', '16,threads=3D4,cores=3D2,sockets=3D2') self.vm.add_args('-m', '512M', '-object', 'memory-backend-ram,size=3D256M,id=3Dm= 0', @@ -108,3 +85,6 @@ def test_ppc64_linux_big_boot(self): console_pattern =3D 'smp: Brought up 2 nodes, 16 CPUs' wait_for_console_pattern(self, console_pattern, self.panic_message) wait_for_console_pattern(self, self.good_message, self.panic_messa= ge) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/ppc_prep_40p.py b/tests/functional/test_ppc_40p.= py old mode 100644 new mode 100755 similarity index 51% rename from tests/avocado/ppc_prep_40p.py rename to tests/functional/test_ppc_40p.py index d4f1eb7e1d..c64e876c1f --- a/tests/avocado/ppc_prep_40p.py +++ b/tests/functional/test_ppc_40p.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a PReP/40p machine and checks its serial cons= ole. # # Copyright (c) Philippe Mathieu-Daud=C3=A9 @@ -7,39 +9,40 @@ =20 import os =20 -from avocado import skipUnless -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from unittest import skipUnless +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern =20 =20 class IbmPrep40pMachine(QemuSystemTest): =20 timeout =3D 60 =20 + ASSET_BIOS =3D Asset( + ('http://ftpmirror.your.org/pub/misc/' + 'ftp.software.ibm.com/rs6000/firmware/' + '7020-40p/P12H0456.IMG'), + 'd957f79c73f760d1455d2286fcd901ed6d06167320eb73511b478a939be25b3f') + ASSET_NETBSD40 =3D Asset( + ('https://archive.netbsd.org/pub/NetBSD-archive/' + 'NetBSD-4.0/prep/installation/floppy/generic_com0.fs'), + 'f86236e9d01b3f0dd0f5d3b8d5bbd40c68e78b4db560a108358f5ad58e636619') + ASSET_NETBSD71 =3D Asset( + ('https://archive.netbsd.org/pub/NetBSD-archive/' + 'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso'), + 'cc7cb290b06aaa839362deb7bd9f417ac5015557db24088508330f76c3f825ec') + # 12H0455 PPS Firmware Licensed Materials # Property of IBM (C) Copyright IBM Corp. 1994. # All rights reserved. # U.S. Government Users Restricted Rights - Use, duplication or disclo= sure # restricted by GSA ADP Schedule Contract with IBM Corp. - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') def test_factory_firmware_and_netbsd(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:40p - :avocado: tags=3Dos:netbsd - :avocado: tags=3Dslowness:high - :avocado: tags=3Daccel:tcg - """ + self.set_machine('40p') self.require_accelerator("tcg") - bios_url =3D ('http://ftpmirror.your.org/pub/misc/' - 'ftp.software.ibm.com/rs6000/firmware/' - '7020-40p/P12H0456.IMG') - bios_hash =3D '1775face4e6dc27f3a6ed955ef6eb331bf817f03' - bios_path =3D self.fetch_asset(bios_url, asset_hash=3Dbios_hash) - drive_url =3D ('https://archive.netbsd.org/pub/NetBSD-archive/' - 'NetBSD-4.0/prep/installation/floppy/generic_com0.fs') - drive_hash =3D 'dbcfc09912e71bd5f0d82c7c1ee43082fb596ceb' - drive_path =3D self.fetch_asset(drive_url, asset_hash=3Ddrive_hash) + bios_path =3D self.ASSET_BIOS.fetch() + drive_path =3D self.ASSET_NETBSD40.fetch() =20 self.vm.set_console() self.vm.add_args('-bios', bios_path, @@ -50,11 +53,7 @@ def test_factory_firmware_and_netbsd(self): wait_for_console_pattern(self, 'Model: IBM PPS Model 6015') =20 def test_openbios_192m(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:40p - :avocado: tags=3Daccel:tcg - """ + self.set_machine('40p') self.require_accelerator("tcg") self.vm.set_console() self.vm.add_args('-m', '192') # test fw_cfg @@ -65,21 +64,15 @@ def test_openbios_192m(self): wait_for_console_pattern(self, '>> CPU type PowerPC,604') =20 def test_openbios_and_netbsd(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:40p - :avocado: tags=3Dos:netbsd - :avocado: tags=3Daccel:tcg - """ + self.set_machine('40p') self.require_accelerator("tcg") - drive_url =3D ('https://archive.netbsd.org/pub/NetBSD-archive/' - 'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso') - drive_hash =3D 'ac6fa2707d888b36d6fa64de6e7fe48e' - drive_path =3D self.fetch_asset(drive_url, asset_hash=3Ddrive_hash, - algorithm=3D'md5') + drive_path =3D self.ASSET_NETBSD71.fetch() self.vm.set_console() self.vm.add_args('-cdrom', drive_path, '-boot', 'd') =20 self.vm.launch() wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/ppc_mpc8544ds.py b/tests/functional/test_ppc_mpc= 8544ds.py old mode 100644 new mode 100755 similarity index 55% rename from tests/avocado/ppc_mpc8544ds.py rename to tests/functional/test_ppc_mpc8544ds.py index b599fb1cc9..2b3f0894ae --- a/tests/avocado/ppc_mpc8544ds.py +++ b/tests/functional/test_ppc_mpc8544ds.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test that Linux kernel boots on ppc machines and check the console # # Copyright (c) 2018, 2020 Red Hat, Inc. @@ -5,9 +7,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado.utils import archive -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test.utils import archive_extract +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern =20 class Mpc8544dsMachine(QemuSystemTest): =20 @@ -15,20 +17,21 @@ class Mpc8544dsMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' panic_message =3D 'Kernel panic - not syncing' =20 + ASSET_IMAGE =3D Asset( + ('https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/' + 'day04.tar.xz'), + '88bc83f3c9f3d633bcfc108a6342d677abca247066a2fb8d4636744a0d319f94') + def test_ppc_mpc8544ds(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:mpc8544ds - :avocado: tags=3Daccel:tcg - """ self.require_accelerator("tcg") - tar_url =3D ('https://qemu-advcal.gitlab.io' - '/qac-best-of-multiarch/download/day04.tar.xz') - tar_hash =3D 'f46724d281a9f30fa892d458be7beb7d34dc25f9' - file_path =3D self.fetch_asset(tar_url, asset_hash=3Dtar_hash) - archive.extract(file_path, self.workdir) + self.set_machine('mpc8544ds') + file_path =3D self.ASSET_IMAGE.fetch() + archive_extract(file_path, self.workdir, member=3D'creek/creek.bin= ') self.vm.set_console() self.vm.add_args('-kernel', self.workdir + '/creek/creek.bin') self.vm.launch() wait_for_console_pattern(self, 'QEMU advent calendar 2020', self.panic_message) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/ppc_virtex_ml507.py b/tests/functional/test_ppc_= virtex_ml507.py old mode 100644 new mode 100755 similarity index 60% rename from tests/avocado/ppc_virtex_ml507.py rename to tests/functional/test_ppc_virtex_ml507.py index a73f8ae396..ffa9a0633e --- a/tests/avocado/ppc_virtex_ml507.py +++ b/tests/functional/test_ppc_virtex_ml507.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Test that Linux kernel boots on ppc machines and check the console # # Copyright (c) 2018, 2020 Red Hat, Inc. @@ -5,9 +7,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado.utils import archive -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test.utils import archive_extract +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern =20 class VirtexMl507Machine(QemuSystemTest): =20 @@ -15,18 +17,16 @@ class VirtexMl507Machine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' panic_message =3D 'Kernel panic - not syncing' =20 + ASSET_IMAGE =3D Asset( + ('https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/' + 'day08.tar.xz'), + 'cefe5b8aeb5e9d2d1d4fd22dcf48d917d68d5a765132bf2ddd6332dc393b824c') + def test_ppc_virtex_ml507(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:virtex-ml507 - :avocado: tags=3Daccel:tcg - """ self.require_accelerator("tcg") - tar_url =3D ('https://qemu-advcal.gitlab.io' - '/qac-best-of-multiarch/download/day08.tar.xz') - tar_hash =3D '74c68f5af7a7b8f21c03097b298f3bb77ff52c1f' - file_path =3D self.fetch_asset(tar_url, asset_hash=3Dtar_hash) - archive.extract(file_path, self.workdir) + self.set_machine('virtex-ml507') + file_path =3D self.ASSET_IMAGE.fetch() + archive_extract(file_path, self.workdir) self.vm.set_console() self.vm.add_args('-kernel', self.workdir + '/hippo/hippo.linux', '-dtb', self.workdir + '/hippo/virtex440-ml507.dt= b', @@ -34,3 +34,6 @@ def test_ppc_virtex_ml507(self): self.vm.launch() wait_for_console_pattern(self, 'QEMU advent calendar 2020', self.panic_message) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025426; cv=none; d=zohomail.com; s=zohoarc; b=BFIC2asqOvTTCs8mx0xQDZli7N/FrksvWB2qKD9QQR5+4S0Imi9NGYTcS7rFJNJjnC8nmXh27YcMCeCWX+PSQmLakY3fIrSaOEx7s3pzoTdimW//f/WSauRUFVaghlq3XGkxCXCo3cEMbsrI/l9sBlXuCRFaSWKLwGzkK2vLxMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025426; 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=SWOQQkfUz6JS2lXFxnlkkQQEMwyL997hyDsGEWuURF8=; b=ghngSodpu63biW8/bgUccfzgJZrEESrzMKsWCwu+K1ZUVpBp6Ocu7wxHujF2BPm6/hH9X+Yj0U/6dibEZgDfT6MsQCE9ItcwBYJvMwYy6Y4e4UrDriBtdNz3Sgm3SBjUmYIfVlsbAj6n+KbSE0ACxiErI8gNjKb88G4C/3xaLb0= 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 1725025426502135.97626447123776; Fri, 30 Aug 2024 06:43:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1s3-0004pN-6E; Fri, 30 Aug 2024 09:40:59 -0400 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 1sk1s0-0004Yu-UM for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1rv-0005YY-Ra for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:40:56 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-330-LgGt98RUNKSIy6QWkBwgYA-1; Fri, 30 Aug 2024 09:40:49 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 82C381954B01; Fri, 30 Aug 2024 13:40:48 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9D5143001FC3; Fri, 30 Aug 2024 13:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SWOQQkfUz6JS2lXFxnlkkQQEMwyL997hyDsGEWuURF8=; b=OXQCD3jfdYYGpGLnDK5iSDH7NazmSqVXqNkIJiBDCUnKHyvNqIs5Os4Eri4FlLslJ24SCv +LhRdbnRgH5kE0tAYkdDtJya7XhKdqFUQBPz3CuPnv0t5wX3AaVrrT7FucAtnZEaZS9eoa JkRp6D1K2rejslZTlw3v3vTSi2C3iXw= X-MC-Unique: LgGt98RUNKSIy6QWkBwgYA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 26/44] tests/functional: Convert the ppc_amiga avocado test into a standalone test Date: Fri, 30 Aug 2024 15:38:20 +0200 Message-ID: <20240830133841.142644-27-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025427511116600 Use the Python standard zipfile module instead of avocado.utils for extracting the ZIP file that we download here, and use the standard subprocess module for running the "tail" command. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 1 + tests/avocado/ppc_amiga.py | 38 -------------------------- tests/functional/meson.build | 1 + tests/functional/test_ppc_amiga.py | 43 ++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 38 deletions(-) delete mode 100644 tests/avocado/ppc_amiga.py create mode 100755 tests/functional/test_ppc_amiga.py diff --git a/MAINTAINERS b/MAINTAINERS index 26c9fba7c5..f01e865025 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1597,6 +1597,7 @@ S: Maintained F: hw/ppc/amigaone.c F: hw/pci-host/articia.c F: include/hw/pci-host/articia.h +F: tests/functional/test_ppc_amiga.py =20 Virtual Open Firmware (VOF) M: Alexey Kardashevskiy diff --git a/tests/avocado/ppc_amiga.py b/tests/avocado/ppc_amiga.py deleted file mode 100644 index b6f866f91d..0000000000 --- a/tests/avocado/ppc_amiga.py +++ /dev/null @@ -1,38 +0,0 @@ -# Test AmigaNG boards -# -# Copyright (c) 2023 BALATON Zoltan -# -# This work is licensed under the terms of the GNU GPL, version 2 or -# later. See the COPYING file in the top-level directory. - -from avocado.utils import archive -from avocado.utils import process -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern - -class AmigaOneMachine(QemuSystemTest): - - timeout =3D 90 - - def test_ppc_amigaone(self): - """ - :avocado: tags=3Darch:ppc - :avocado: tags=3Dmachine:amigaone - :avocado: tags=3Ddevice:articia - :avocado: tags=3Daccel:tcg - """ - self.require_accelerator("tcg") - tar_name =3D 'A1Firmware_Floppy_05-Mar-2005.zip' - tar_url =3D ('https://www.hyperion-entertainment.com/index.php/' - 'downloads?view=3Ddownload&format=3Draw&file=3D25') - tar_hash =3D 'c52e59bc73e31d8bcc3cc2106778f7ac84f6c755' - zip_file =3D self.fetch_asset(tar_name, locations=3Dtar_url, - asset_hash=3Dtar_hash) - archive.extract(zip_file, self.workdir) - cmd =3D f"tail -c 524288 {self.workdir}/floppy_edition/updater.ima= ge >{self.workdir}/u-boot-amigaone.bin" - process.run(cmd, shell=3DTrue) - - self.vm.set_console() - self.vm.add_args('-bios', self.workdir + '/u-boot-amigaone.bin') - self.vm.launch() - wait_for_console_pattern(self, 'FLASH:') diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 3726c61ca3..8f46a90003 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -62,6 +62,7 @@ tests_ppc_system_quick =3D [ tests_ppc_system_thorough =3D [ 'ppc_405', 'ppc_40p', + 'ppc_amiga', 'ppc_bamboo', 'ppc_mpc8544ds', 'ppc_virtex_ml507', diff --git a/tests/functional/test_ppc_amiga.py b/tests/functional/test_ppc= _amiga.py new file mode 100755 index 0000000000..b793b5c432 --- /dev/null +++ b/tests/functional/test_ppc_amiga.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +# +# Test AmigaNG boards +# +# Copyright (c) 2023 BALATON Zoltan +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import subprocess + +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern, run_cmd +from zipfile import ZipFile + +class AmigaOneMachine(QemuSystemTest): + + timeout =3D 90 + + ASSET_IMAGE =3D Asset( + ('https://www.hyperion-entertainment.com/index.php/' + 'downloads?view=3Ddownload&format=3Draw&file=3D25'), + '8ff39330ba47d4f64de4ee8fd6809e9c010a9ef17fe51e95c3c1d53437cb481f') + + def test_ppc_amigaone(self): + self.require_accelerator("tcg") + self.set_machine('amigaone') + tar_name =3D 'A1Firmware_Floppy_05-Mar-2005.zip' + zip_file =3D self.ASSET_IMAGE.fetch() + with ZipFile(zip_file, 'r') as zf: + zf.extractall(path=3Dself.workdir) + bios_fh =3D open(self.workdir + "/u-boot-amigaone.bin", "wb") + subprocess.run(['tail', '-c', '524288', + self.workdir + "/floppy_edition/updater.image"], + stdout=3Dbios_fh) + + self.vm.set_console() + self.vm.add_args('-bios', self.workdir + '/u-boot-amigaone.bin') + self.vm.launch() + wait_for_console_pattern(self, 'FLASH:') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025323; cv=none; d=zohomail.com; s=zohoarc; b=nFjQDdo4ed+/6rWj7rkv37MIPkxBGAkB6h0VZo7GxRA4MPSHtjz9qFBKhtoyhonWOCKqB3X7mNrte1Z9KEN67TBSm5aGEJHVihTRLZGVf1CaoILE/RiWAdILU3opj/t+YRsuBFsqaa3II/+lhdXTiuZZnmHWtwivO0ODMGb9gaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025323; 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=rYDWIbt492k6BlYyTYOTTMPprueU9AFZYQIxleZGdDM=; b=OEKVOocJiYK4a5do08BdCL0Mia71Yh49gzceLWzITTJbaKhRNF/MTh/lBwBx5T8SH3ePmtyTJyEsY+TAlu0dJ0FvJoVR3HjOYeo5SHK+ihVfkoW6dUOuqhk/uAWYHpVgfLnXKQf193n6V/mxnCNEj129WLmKwQMfSxK0Qx7WbnY= 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 172502532360746.382927897331115; Fri, 30 Aug 2024 06:42:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1s8-0005TJ-4a; Fri, 30 Aug 2024 09:41:04 -0400 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 1sk1s4-00056q-PN for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1s0-0005Z3-Rh for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:00 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-7nUotcXIPVO9MH7QRYYasg-1; Fri, 30 Aug 2024 09:40:53 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1F26F1955D5A; Fri, 30 Aug 2024 13:40:52 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 05A703001FC3; Fri, 30 Aug 2024 13:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rYDWIbt492k6BlYyTYOTTMPprueU9AFZYQIxleZGdDM=; b=a0AUKlbumxdtQHooxScF4Dyut4DS+4fVz1X075IaYQCdVcIzhPXwN3DJqEA5wZ5CIV77Ue vWwN50JrytdOw+uqelXboGLCLXNdvxpXwhjuRFWd3qy2AcCBWngyhiheyqT87FdOWRnZ/a 5OIsiy4XXqg6N1Hyt2WkuEeA65tYxwA= X-MC-Unique: 7nUotcXIPVO9MH7QRYYasg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 27/44] tests/functional: Convert the ppc_hv avocado test into a standalone test Date: Fri, 30 Aug 2024 15:38:21 +0200 Message-ID: <20240830133841.142644-28-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025325048116600 A straight forward conversion, we just also have to remove the decorator @skipUnless(os.getenv('SPEED')) since all non-trivial functional tests are running in SPEED=3Dthorough mode now. Also make sure that the extracted assets are writable, so that the test does not fail if it gets re-run and there are stale read-only files already around. Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 2 + .../test_ppc64_hv.py} | 52 ++++++++----------- 3 files changed, 24 insertions(+), 32 deletions(-) rename tests/{avocado/ppc_hv_tests.py =3D> functional/test_ppc64_hv.py} (8= 5%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index f01e865025..cca48683ce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1532,7 +1532,7 @@ F: tests/qtest/libqos/*spapr* F: tests/qtest/rtas* F: tests/qtest/libqos/rtas* F: tests/functional/test_ppc64_pseries.py -F: tests/avocado/ppc_hv_tests.py +F: tests/functional/test_ppc64_hv.py =20 PowerNV (Non-Virtualized) M: C=C3=A9dric Le Goater diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 8f46a90003..1b2e6d142c 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -13,6 +13,7 @@ endif test_timeouts =3D { 'netdev_ethtool' : 180, 'ppc_40p' : 240, + 'ppc64_hv' : 1000, 'ppc64_powernv' : 120, 'ppc64_pseries' : 120, 's390x_ccw_virtio' : 180, @@ -69,6 +70,7 @@ tests_ppc_system_thorough =3D [ ] =20 tests_ppc64_system_thorough =3D [ + 'ppc64_hv', 'ppc64_powernv', 'ppc64_pseries', ] diff --git a/tests/avocado/ppc_hv_tests.py b/tests/functional/test_ppc64_hv= .py old mode 100644 new mode 100755 similarity index 85% rename from tests/avocado/ppc_hv_tests.py rename to tests/functional/test_ppc64_hv.py index 0e83bbac71..1a6e4b6d07 --- a/tests/avocado/ppc_hv_tests.py +++ b/tests/functional/test_ppc64_hv.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Tests that specifically try to exercise hypervisor features of the # target machines. powernv supports the Power hypervisor ISA, and # pseries supports the nested-HV hypervisor spec. @@ -7,10 +9,9 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado import skipIf, skipUnless -from avocado.utils import archive -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern, exec_command +from unittest import skipIf, skipUnless +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern, exec_command import os import time import subprocess @@ -45,8 +46,7 @@ def missing_deps(): # QEMU already installed and use that. # XXX: The order of these tests seems to matter, see git blame. @skipIf(missing_deps(), 'dependencies (%s) not installed' % ','.join(deps)) -@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') -@skipUnless(os.getenv('SPEED') =3D=3D 'slow', 'runtime limited') +@skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limited') class HypervisorTest(QemuSystemTest): =20 timeout =3D 1000 @@ -54,6 +54,11 @@ class HypervisorTest(QemuSystemTest): panic_message =3D 'Kernel panic - not syncing' good_message =3D 'VFS: Cannot open root device' =20 + ASSET_ISO =3D Asset( + ('https://dl-cdn.alpinelinux.org/alpine/v3.18/' + 'releases/ppc64le/alpine-standard-3.18.4-ppc64le.iso'), + 'c26b8d3e17c2f3f0fed02b4b1296589c2390e6d5548610099af75300edd7b3ff') + def extract_from_iso(self, iso, path): """ Extracts a file from an iso file into the test workdir @@ -72,6 +77,7 @@ def extract_from_iso(self, iso, path): subprocess.run(cmd.split(), stdout=3Dsubprocess.DEVNULL, stderr=3Dsubproces= s.DEVNULL) =20 + os.chmod(filename, 0o600) os.chdir(cwd) =20 # Return complete path to extracted file. Because callers to @@ -83,16 +89,9 @@ def extract_from_iso(self, iso, path): def setUp(self): super().setUp() =20 - iso_url =3D ('https://dl-cdn.alpinelinux.org/alpine/v3.18/releases= /ppc64le/alpine-standard-3.18.4-ppc64le.iso') - - # Alpine use sha256 so I recalculated this myself - iso_sha256 =3D 'c26b8d3e17c2f3f0fed02b4b1296589c2390e6d5548610099a= f75300edd7b3ff' - iso_path =3D self.fetch_asset(iso_url, asset_hash=3Diso_sha256, - algorithm =3D "sha256") - - self.iso_path =3D iso_path - self.vmlinuz =3D self.extract_from_iso(iso_path, '/boot/vmlinuz-lt= s') - self.initramfs =3D self.extract_from_iso(iso_path, '/boot/initramf= s-lts') + self.iso_path =3D self.ASSET_ISO.fetch() + self.vmlinuz =3D self.extract_from_iso(self.iso_path, '/boot/vmlin= uz-lts') + self.initramfs =3D self.extract_from_iso(self.iso_path, '/boot/ini= tramfs-lts') =20 def do_start_alpine(self): self.vm.set_console() @@ -158,12 +157,8 @@ def do_test_kvm(self, hpt=3DFalse): wait_for_console_pattern(self, 'alpine:~#') =20 def test_hv_pseries(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - :avocado: tags=3Daccel:tcg - """ self.require_accelerator("tcg") + self.set_machine('pseries') self.vm.add_args("-accel", "tcg,thread=3Dmulti") self.vm.add_args('-device', 'nvme,serial=3D1234,drive=3Ddrive0') self.vm.add_args("-machine", "x-vof=3Don,cap-nested-hv=3Don") @@ -173,12 +168,8 @@ def test_hv_pseries(self): self.do_stop_alpine() =20 def test_hv_pseries_kvm(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:pseries - :avocado: tags=3Daccel:kvm - """ self.require_accelerator("kvm") + self.set_machine('pseries') self.vm.add_args("-accel", "kvm") self.vm.add_args('-device', 'nvme,serial=3D1234,drive=3Ddrive0') self.vm.add_args("-machine", "x-vof=3Don,cap-nested-hv=3Don,cap-cc= f-assist=3Doff") @@ -188,12 +179,8 @@ def test_hv_pseries_kvm(self): self.do_stop_alpine() =20 def test_hv_powernv(self): - """ - :avocado: tags=3Darch:ppc64 - :avocado: tags=3Dmachine:powernv - :avocado: tags=3Daccel:tcg - """ self.require_accelerator("tcg") + self.set_machine('powernv') self.vm.add_args("-accel", "tcg,thread=3Dmulti") self.vm.add_args('-device', 'nvme,bus=3Dpcie.2,addr=3D0x0,serial= =3D1234,drive=3Ddrive0', '-device', 'e1000e,netdev=3Dnet0,mac=3DC0:FF:EE:0= 0:00:02,bus=3Dpcie.0,addr=3D0x0', @@ -203,3 +190,6 @@ def test_hv_powernv(self): self.do_test_kvm() self.do_test_kvm(True) self.do_stop_alpine() + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025277; cv=none; d=zohomail.com; s=zohoarc; b=EprDfYqJ/Fts4mG4GBOe6SDjKT9CjAoQHBm4ZZaCVJJ5sojZK/jPngvt37OFnOau/m8yunOxIussiblgNMStpVILG9aWqZDNpjWo5xSG0ujUR/z+XozJ43qddfcKIdwDXXSHwCVwjK53cT8Bm9jSbliUEH4nFtoubkZLF7RlUJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025277; 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=wZxKg14rh0yxMkEsXaaPd4X7q8JDRrbuFoST72D7jxk=; b=P6zUv9RwnLkie++wTWP/xh7kZDzjKSvrpkChVbdy7qgoW9UPsScuTynEc9kryRV8+5gqH/pPP88W9ICBd40nrCfuSWuXgq1f+ucKCXN08zykc0JGxzkx2KmHJWgiqSOmQGa8BMedtabK1zHs1kZXoZqvs+0qloXDBbjG7zh0nNM= 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 1725025277022877.5182578042601; Fri, 30 Aug 2024 06:41:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sE-00068E-HS; Fri, 30 Aug 2024 09:41:10 -0400 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 1sk1s8-0005dz-RL for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1s5-0005Zh-Hf for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:04 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-ox6i0WZiOUuxML3X3ny2mw-1; Fri, 30 Aug 2024 09:40:56 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C672319560B0; Fri, 30 Aug 2024 13:40:55 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 930D5300019C; Fri, 30 Aug 2024 13:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wZxKg14rh0yxMkEsXaaPd4X7q8JDRrbuFoST72D7jxk=; b=LnORaHdbO24ooZZx5/wfy1tqS3wQbPnCLnFZ0EqgyM+isuXWdQy0IgKCi//hUN5KKjg99W Q4Z5eUQ1fk1hMHRUm0Uzh3Bm9v2ERuFR1IYzYifiFump73eTn8Gqemk8luQb7+fR7lLai1 eWco8NOa7saRnW5E2S7jyLDCY1wdxvk= X-MC-Unique: ox6i0WZiOUuxML3X3ny2mw-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 28/44] tests/functional: Convert the m68k nextcube test with tesseract Date: Fri, 30 Aug 2024 15:38:22 +0200 Message-ID: <20240830133841.142644-29-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025278818116600 The code that handles running of tesseract needs to be tweaked a little bit to be able to run without the functions from avocado.utils, and while we're at it, drop some legacy stuff that was still there due to Tesseract 3 support that we already dropped a while ago. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 1 + tests/avocado/tesseract_utils.py | 46 ------------------- tests/functional/meson.build | 4 ++ tests/functional/qemu_test/tesseract.py | 35 ++++++++++++++ .../test_m68k_nextcube.py} | 29 ++++++------ 5 files changed, 56 insertions(+), 59 deletions(-) delete mode 100644 tests/avocado/tesseract_utils.py create mode 100644 tests/functional/qemu_test/tesseract.py rename tests/{avocado/machine_m68k_nextcube.py =3D> functional/test_m68k_n= extcube.py} (75%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index cca48683ce..394d704515 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1283,6 +1283,7 @@ S: Odd Fixes F: hw/m68k/next-*.c F: hw/display/next-fb.c F: include/hw/m68k/next-cube.h +F: tests/functional/test_m68k_nextcube.py =20 q800 M: Laurent Vivier diff --git a/tests/avocado/tesseract_utils.py b/tests/avocado/tesseract_uti= ls.py deleted file mode 100644 index 476f528147..0000000000 --- a/tests/avocado/tesseract_utils.py +++ /dev/null @@ -1,46 +0,0 @@ -# ... -# -# Copyright (c) 2019 Philippe Mathieu-Daud=C3=A9 -# -# This work is licensed under the terms of the GNU GPL, version 2 or -# later. See the COPYING file in the top-level directory. - -import re -import logging - -from avocado.utils import process -from avocado.utils.path import find_command, CmdNotFoundError - -def tesseract_available(expected_version): - try: - find_command('tesseract') - except CmdNotFoundError: - return False - res =3D process.run('tesseract --version') - try: - version =3D res.stdout_text.split()[1] - except IndexError: - version =3D res.stderr_text.split()[1] - return int(version.split('.')[0]) >=3D expected_version - - match =3D re.match(r'tesseract\s(\d)', res) - if match is None: - return False - # now this is guaranteed to be a digit - return int(match.groups()[0]) >=3D expected_version - - -def tesseract_ocr(image_path, tesseract_args=3D'', tesseract_version=3D3): - console_logger =3D logging.getLogger('tesseract') - console_logger.debug(image_path) - if tesseract_version =3D=3D 4: - tesseract_args +=3D ' --oem 1' - proc =3D process.run("tesseract {} {} stdout".format(tesseract_args, - image_path)) - lines =3D [] - for line in proc.stdout_text.split('\n'): - sline =3D line.strip() - if len(sline): - console_logger.debug(sline) - lines +=3D [sline] - return lines diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 1b2e6d142c..3a71e02e74 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -44,6 +44,10 @@ tests_loongarch64_system_thorough =3D [ 'loongarch64_virt', ] =20 +tests_m68k_system_thorough =3D [ + 'm68k_nextcube' +] + tests_microblaze_system_thorough =3D [ 'microblaze_s3adsp1800' ] diff --git a/tests/functional/qemu_test/tesseract.py b/tests/functional/qem= u_test/tesseract.py new file mode 100644 index 0000000000..c4087b7c11 --- /dev/null +++ b/tests/functional/qemu_test/tesseract.py @@ -0,0 +1,35 @@ +# ... +# +# Copyright (c) 2019 Philippe Mathieu-Daud=C3=A9 +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import re +import logging + +from . import has_cmd, run_cmd + +def tesseract_available(expected_version): + if not has_cmd('tesseract'): + return False + (stdout, stderr, ret) =3D run_cmd([ 'tesseract', '--version']) + if ret: + return False + version =3D stdout.split()[1] + return int(version.split('.')[0]) >=3D expected_version + +def tesseract_ocr(image_path, tesseract_args=3D''): + console_logger =3D logging.getLogger('console') + console_logger.debug(image_path) + (stdout, stderr, ret) =3D run_cmd(['tesseract', image_path, + 'stdout']) + if ret: + return None + lines =3D [] + for line in stdout.split('\n'): + sline =3D line.strip() + if len(sline): + console_logger.debug(sline) + lines +=3D [sline] + return lines diff --git a/tests/avocado/machine_m68k_nextcube.py b/tests/functional/test= _m68k_nextcube.py old mode 100644 new mode 100755 similarity index 75% rename from tests/avocado/machine_m68k_nextcube.py rename to tests/functional/test_m68k_nextcube.py index 1f3c883910..89385a134a --- a/tests/avocado/machine_m68k_nextcube.py +++ b/tests/functional/test_m68k_nextcube.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a VM and run OCR on the framebuffer # # Copyright (c) 2019 Philippe Mathieu-Daud=C3=A9 @@ -8,10 +10,10 @@ import os import time =20 -from avocado_qemu import QemuSystemTest -from avocado import skipUnless +from qemu_test import QemuSystemTest, Asset +from unittest import skipUnless =20 -from tesseract_utils import tesseract_available, tesseract_ocr +from qemu_test.tesseract import tesseract_available, tesseract_ocr =20 PIL_AVAILABLE =3D True try: @@ -21,19 +23,15 @@ =20 =20 class NextCubeMachine(QemuSystemTest): - """ - :avocado: tags=3Darch:m68k - :avocado: tags=3Dmachine:next-cube - :avocado: tags=3Ddevice:framebuffer - """ =20 timeout =3D 15 =20 + ASSET_ROM =3D Asset(('https://sourceforge.net/p/previous/code/1350/tre= e/' + 'trunk/src/Rev_2.5_v66.BIN?format=3Draw'), + '1b753890b67095b73e104c939ddf62eca9e7d0aedde5108e389= 3b0ed9d8000a4') + def check_bootrom_framebuffer(self, screenshot_path): - rom_url =3D ('https://sourceforge.net/p/previous/code/1350/tree/' - 'trunk/src/Rev_2.5_v66.BIN?format=3Draw') - rom_hash =3D 'b3534796abae238a0111299fc406a9349f7fee24' - rom_path =3D self.fetch_asset(rom_url, asset_hash=3Drom_hash) + rom_path =3D self.ASSET_ROM.fetch() =20 self.vm.add_args('-bios', rom_path) self.vm.launch() @@ -48,6 +46,7 @@ def check_bootrom_framebuffer(self, screenshot_path): =20 @skipUnless(PIL_AVAILABLE, 'Python PIL not installed') def test_bootrom_framebuffer_size(self): + self.set_machine('next-cube') screenshot_path =3D os.path.join(self.workdir, "dump.ppm") self.check_bootrom_framebuffer(screenshot_path) =20 @@ -60,11 +59,15 @@ def test_bootrom_framebuffer_size(self): # that it is still alpha-level software. @skipUnless(tesseract_available(4), 'tesseract OCR tool not available') def test_bootrom_framebuffer_ocr_with_tesseract(self): + self.set_machine('next-cube') screenshot_path =3D os.path.join(self.workdir, "dump.ppm") self.check_bootrom_framebuffer(screenshot_path) - lines =3D tesseract_ocr(screenshot_path, tesseract_version=3D4) + lines =3D tesseract_ocr(screenshot_path) text =3D '\n'.join(lines) self.assertIn('Testing the FPU', text) self.assertIn('System test failed. Error code', text) self.assertIn('Boot command', text) self.assertIn('Next>', text) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025361; cv=none; d=zohomail.com; s=zohoarc; b=d2hlRN+/JFTzHfXGTh3uX9Sxj/t3zaOPZj7+DzFY1wjBkhRRJOGI+K2a8nb7nx3HuTZ8xMtUvRBoN++WlgNYFz1jf6WCjiwvyg32EERb8PcXqTRnSMvAGf+sUnD4mmW7u9M/K35+xbaKVYbG0bD5/XmEqstIMizs0r2ipvHgxp0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025361; 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=k9YcrFsn6OY3zZLl0mlkCAAdJi4a8ezPpL8w14c8Xmg=; b=hlSP+PWn+Gdg1LWd4kyw12RP6kcQLvZfc+fhDp+LDhkzj+/pvrXz97MRTOm5sGJexBIBMOnmFm8DtzXVtTtNev2gpYrdFYVxsHFL744uzMU0eUt5I4UiynssoQEbD8n/Z+3aApR3WdykynUBJvdtC9Hx90WJfIbu2YQ6ijEmap0= 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 1725025361472483.6633588078413; Fri, 30 Aug 2024 06:42:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sG-0006SY-Cf; Fri, 30 Aug 2024 09:41:12 -0400 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 1sk1sB-0005rg-Pg for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1s8-0005aB-OO for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:07 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-HZaB4lcrM926tEAmQeR-yw-1; Fri, 30 Aug 2024 09:41:00 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8212E1955D54; Fri, 30 Aug 2024 13:40:59 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2B579300019C; Fri, 30 Aug 2024 13:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k9YcrFsn6OY3zZLl0mlkCAAdJi4a8ezPpL8w14c8Xmg=; b=F9Lw8PQqWuF9TdeCWQEu+G6IfIGTEyw/Ep88WJa15UPPgiaPbkxGCTmDwuxrMx8JI4wp9f sUq3Dv63YrduWlmh8xhszeWZNEoNYny+5V0J8FZEUwotHX/wbBCxvMYHNa088z2IE0P8Be jBMw2Z2yL06GHv7EbhahYCigqMfRwGw= X-MC-Unique: HZaB4lcrM926tEAmQeR-yw-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 29/44] tests/functional: Convert the acpi-bits test into a standalone test Date: Fri, 30 Aug 2024 15:38:23 +0200 Message-ID: <20240830133841.142644-30-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025363183116600 Mostly a straight-forward conversion. Looks like we can simply drop the avocado datadrainer stuff when not using the avocado framework anymore. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 4 +- docs/devel/acpi-bits.rst | 62 ++++++-------- .../acpi-bits/bits-config/bits-cfg.txt | 0 .../acpi-bits/bits-tests/smbios.py2 | 0 .../acpi-bits/bits-tests/smilatency.py2 | 0 .../acpi-bits/bits-tests/testacpi.py2 | 0 .../acpi-bits/bits-tests/testcpuid.py2 | 0 tests/functional/meson.build | 2 + .../test_acpi_bits.py} | 83 ++++++++++--------- 9 files changed, 71 insertions(+), 80 deletions(-) rename tests/{avocado =3D> functional}/acpi-bits/bits-config/bits-cfg.txt = (100%) rename tests/{avocado =3D> functional}/acpi-bits/bits-tests/smbios.py2 (10= 0%) rename tests/{avocado =3D> functional}/acpi-bits/bits-tests/smilatency.py2= (100%) rename tests/{avocado =3D> functional}/acpi-bits/bits-tests/testacpi.py2 (= 100%) rename tests/{avocado =3D> functional}/acpi-bits/bits-tests/testcpuid.py2 = (100%) rename tests/{avocado/acpi-bits.py =3D> functional/test_acpi_bits.py} (86%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 394d704515..c2dfb3dad3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2075,8 +2075,8 @@ ACPI/AVOCADO/BIOSBITS M: Ani Sinha M: Michael S. Tsirkin S: Supported -F: tests/avocado/acpi-bits/* -F: tests/avocado/acpi-bits.py +F: tests/functional/acpi-bits/* +F: tests/functional/test_acpi_bits.py F: docs/devel/acpi-bits.rst =20 ACPI/HEST/GHES diff --git a/docs/devel/acpi-bits.rst b/docs/devel/acpi-bits.rst index 1ec394f5fb..78aeb6aa3c 100644 --- a/docs/devel/acpi-bits.rst +++ b/docs/devel/acpi-bits.rst @@ -1,6 +1,6 @@ -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D -ACPI/SMBIOS avocado tests using biosbits -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +ACPI/SMBIOS testing using biosbits +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ************ Introduction ************ @@ -35,7 +35,7 @@ for developing biosbits and its real life uses can be fou= nd in [#a]_ and [#b]_. For QEMU, we maintain a fork of bios bits in gitlab along with all the dependent submodules `here = `__. This fork contains numerous fixes, a newer acpica and changes specific to -running this avocado QEMU tests using bits. The author of this document +running these functional QEMU tests using bits. The author of this document is the sole maintainer of the QEMU fork of bios bits repository. For more information, please see author's `FOSDEM talk on this bios-bits based test framework `__. @@ -44,12 +44,12 @@ framework diff --git a/tests/avocado/acpi-bits/bits-config/bits-cfg.txt b/tests/funct= ional/acpi-bits/bits-config/bits-cfg.txt similarity index 100% rename from tests/avocado/acpi-bits/bits-config/bits-cfg.txt rename to tests/functional/acpi-bits/bits-config/bits-cfg.txt diff --git a/tests/avocado/acpi-bits/bits-tests/smbios.py2 b/tests/function= al/acpi-bits/bits-tests/smbios.py2 similarity index 100% rename from tests/avocado/acpi-bits/bits-tests/smbios.py2 rename to tests/functional/acpi-bits/bits-tests/smbios.py2 diff --git a/tests/avocado/acpi-bits/bits-tests/smilatency.py2 b/tests/func= tional/acpi-bits/bits-tests/smilatency.py2 similarity index 100% rename from tests/avocado/acpi-bits/bits-tests/smilatency.py2 rename to tests/functional/acpi-bits/bits-tests/smilatency.py2 diff --git a/tests/avocado/acpi-bits/bits-tests/testacpi.py2 b/tests/functi= onal/acpi-bits/bits-tests/testacpi.py2 similarity index 100% rename from tests/avocado/acpi-bits/bits-tests/testacpi.py2 rename to tests/functional/acpi-bits/bits-tests/testacpi.py2 diff --git a/tests/avocado/acpi-bits/bits-tests/testcpuid.py2 b/tests/funct= ional/acpi-bits/bits-tests/testcpuid.py2 similarity index 100% rename from tests/avocado/acpi-bits/bits-tests/testcpuid.py2 rename to tests/functional/acpi-bits/bits-tests/testcpuid.py2 diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 3a71e02e74..76eb00ef46 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -11,6 +11,7 @@ endif =20 # Timeouts for individual tests that can be slow e.g. with debugging enabl= ed test_timeouts =3D { + 'acpi_bits' : 240, 'netdev_ethtool' : 180, 'ppc_40p' : 240, 'ppc64_hv' : 1000, @@ -105,6 +106,7 @@ tests_x86_64_system_quick =3D [ ] =20 tests_x86_64_system_thorough =3D [ + 'acpi_bits', 'netdev_ethtool', 'virtio_gpu', ] diff --git a/tests/avocado/acpi-bits.py b/tests/functional/test_acpi_bits.py old mode 100644 new mode 100755 similarity index 86% rename from tests/avocado/acpi-bits.py rename to tests/functional/test_acpi_bits.py index efe4f52ee0..ee40647d5b --- a/tests/avocado/acpi-bits.py +++ b/tests/functional/test_acpi_bits.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# group: rw quick +# # Exercise QEMU generated ACPI/SMBIOS tables using biosbits, # https://biosbits.org/ # @@ -24,7 +24,7 @@ # pylint: disable=3Dconsider-using-f-string =20 """ -This is QEMU ACPI/SMBIOS avocado tests using biosbits. +This is QEMU ACPI/SMBIOS functional tests using biosbits. Biosbits is available originally at https://biosbits.org/. This test uses a fork of the upstream bits and has numerous fixes including an upgraded acpica. The fork is located here: @@ -41,15 +41,16 @@ import tempfile import time import zipfile + +from pathlib import Path from typing import ( List, Optional, Sequence, ) from qemu.machine import QEMUMachine -from avocado import skipIf -from avocado.utils import datadrainer as drainer -from avocado_qemu import QemuBaseTest +from unittest import skipIf +from qemu_test import QemuBaseTest, Asset =20 deps =3D ["xorriso", "mformat"] # dependent tools needed in the test setup= /box. supported_platforms =3D ['x86_64'] # supported test platforms. @@ -129,34 +130,32 @@ def base_args(self): class AcpiBitsTest(QemuBaseTest): #pylint: disable=3Dtoo-many-instance-att= ributes """ ACPI and SMBIOS tests using biosbits. - - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dacpi - """ # in slower systems the test can take as long as 3 minutes to complete. timeout =3D BITS_TIMEOUT =20 + # following are some standard configuration constants + # gitlab CI does shallow clones of depth 20 + BITS_INTERNAL_VER =3D 2020 + # commit hash must match the artifact tag below + BITS_COMMIT_HASH =3D 'c7920d2b' + # this is the latest bits release as of today. + BITS_TAG =3D "qemu-bits-10262023" + + ASSET_BITS =3D Asset(("https://gitlab.com/qemu-project/" + "biosbits-bits/-/jobs/artifacts/%s/" + "download?job=3Dqemu-bits-build" % BITS_TAG), + '1b8dd612c6831a6b491716a77acc486666aaa867051cdc34f7= ce169c2e25f487') + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._vm =3D None self._workDir =3D None self._baseDir =3D None =20 - # following are some standard configuration constants - self._bitsInternalVer =3D 2020 # gitlab CI does shallow clones of = depth 20 - self._bitsCommitHash =3D 'c7920d2b' # commit hash must match - # the artifact tag below - self._bitsTag =3D "qemu-bits-10262023" # this is the latest bits - # release as of today. - self._bitsArtSHA1Hash =3D 'b22cdfcfc7453875297d06d626f5474ee36a343= f' - self._bitsArtURL =3D ("https://gitlab.com/qemu-project/" - "biosbits-bits/-/jobs/artifacts/%s/" - "download?job=3Dqemu-bits-build" %self._bitsTa= g) self._debugcon_addr =3D '0x403' self._debugcon_log =3D 'debugcon-log.txt' - logging.basicConfig(level=3Dlogging.INFO) - self.logger =3D logging.getLogger('acpi-bits') + self.logger =3D self.log =20 def _print_log(self, log): self.logger.info('\nlogs from biosbits follows:') @@ -171,7 +170,7 @@ def copy_bits_config(self): bits_config_dir =3D os.path.join(self._baseDir, 'acpi-bits', 'bits-config') target_config_dir =3D os.path.join(self._workDir, - 'bits-%d' %self._bitsInternalVer, + 'bits-%d' %self.BITS_INTERNAL_VER, 'boot') self.assertTrue(os.path.exists(bits_config_dir)) self.assertTrue(os.path.exists(target_config_dir)) @@ -188,7 +187,7 @@ def copy_test_scripts(self): bits_test_dir =3D os.path.join(self._baseDir, 'acpi-bits', 'bits-tests') target_test_dir =3D os.path.join(self._workDir, - 'bits-%d' %self._bitsInternalVer, + 'bits-%d' %self.BITS_INTERNAL_VER, 'boot', 'python') =20 self.assertTrue(os.path.exists(bits_test_dir)) @@ -248,9 +247,9 @@ def generate_bits_iso(self): test scripts """ bits_dir =3D os.path.join(self._workDir, - 'bits-%d' %self._bitsInternalVer) + 'bits-%d' %self.BITS_INTERNAL_VER) iso_file =3D os.path.join(self._workDir, - 'bits-%d.iso' %self._bitsInternalVer) + 'bits-%d.iso' %self.BITS_INTERNAL_VER) mkrescue_script =3D os.path.join(self._workDir, 'grub-inst-x86_64-efi', 'bin', 'grub-mkrescue') @@ -264,8 +263,12 @@ def generate_bits_iso(self): =20 try: if os.getenv('V') or os.getenv('BITS_DEBUG'): - subprocess.check_call([mkrescue_script, '-o', iso_file, - bits_dir], stderr=3Dsubprocess.STDO= UT) + proc =3D subprocess.run([mkrescue_script, '-o', iso_file, + bits_dir], + stdout=3Dsubprocess.PIPE, + stderr=3Dsubprocess.STDOUT, + check=3DTrue) + self.logger.info("grub-mkrescue output %s" % proc.stdout) else: subprocess.check_call([mkrescue_script, '-o', iso_file, bits_dir], @@ -282,8 +285,9 @@ def generate_bits_iso(self): =20 def setUp(self): # pylint: disable=3Darguments-differ super().setUp('qemu-system-') + self.logger =3D self.log =20 - self._baseDir =3D os.getenv('AVOCADO_TEST_BASEDIR') + self._baseDir =3D Path(__file__).parent =20 # workdir could also be avocado's own workdir in self.workdir. # At present, I prefer to maintain my own temporary working @@ -300,15 +304,14 @@ def setUp(self): # pylint: disable=3Darguments-differ os.mkdir(prebuiltDir, mode=3D0o775) =20 bits_zip_file =3D os.path.join(prebuiltDir, 'bits-%d-%s.zip' - %(self._bitsInternalVer, - self._bitsCommitHash)) + %(self.BITS_INTERNAL_VER, + self.BITS_COMMIT_HASH)) grub_tar_file =3D os.path.join(prebuiltDir, 'bits-%d-%s-grub.tar.gz' - %(self._bitsInternalVer, - self._bitsCommitHash)) + %(self.BITS_INTERNAL_VER, + self.BITS_COMMIT_HASH)) =20 - bitsLocalArtLoc =3D self.fetch_asset(self._bitsArtURL, - asset_hash=3Dself._bitsArtSHA1H= ash) + bitsLocalArtLoc =3D self.ASSET_BITS.fetch() self.logger.info("downloaded bits artifacts to %s", bitsLocalArtLo= c) =20 # extract the bits artifact in the temp working directory @@ -369,7 +372,7 @@ def test_acpi_smbios_bits(self): """The main test case implementation.""" =20 iso_file =3D os.path.join(self._workDir, - 'bits-%d.iso' %self._bitsInternalVer) + 'bits-%d.iso' %self.BITS_INTERNAL_VER) =20 self.assertTrue(os.access(iso_file, os.R_OK)) =20 @@ -393,12 +396,6 @@ def test_acpi_smbios_bits(self): self._vm.set_console() self._vm.launch() =20 - self.logger.debug("Console output from bits VM follows ...") - c_drainer =3D drainer.LineLogger(self._vm.console_socket.fileno(), - logger=3Dself.logger.getChild("cons= ole"), - stop_check=3D(lambda : - not self._vm.is_running= ())) - c_drainer.start() =20 # biosbits has been configured to run all the specified test suites # in batch mode and then automatically initiate a vm shutdown. @@ -406,4 +403,8 @@ def test_acpi_smbios_bits(self): # with the avocado test timeout. self._vm.event_wait('SHUTDOWN', timeout=3DBITS_TIMEOUT) self._vm.wait(timeout=3DNone) + self.logger.debug("Checking console output ...") self.parse_log() + +if __name__ =3D=3D '__main__': + QemuBaseTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025482; cv=none; d=zohomail.com; s=zohoarc; b=PYgl2gdvLxQxEDciF5hT8UBo5WWKI9T93qW9u372tXRyc7btB+Vy//qd1X3uhrre3m7hGs4qS6/HnsbWBi7CRAR7voB2YXnuG/H8MehDN/Pl3Q05ZqDUR856t5KOQZSAOaGMvHLu3Aoi1c+jEA+ekbo/uThxodkPsC5PThDrU6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025482; 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=1h8nsjSdCePfHdUZXnTEXll7gpGJ8XJl5SgCjjKp8XU=; b=B1e+lHl9BYpbRdD3e2S862k69i6s2mvjJbZ9f0jz/AGyregehqQE8qxCo+Nnpf8lCi7tMGPnmGginsNBGHpZHfq65kpI5ZuVQGRNS8YcDqyBbhWz+x7W2N2BJ2kRlasnX17Ri1bxZtXRSrlBrEYZwDu53o5+UN7nU4yzrDi3Sbo= 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 1725025482500410.6470772483078; Fri, 30 Aug 2024 06:44:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sK-00073w-57; Fri, 30 Aug 2024 09:41:16 -0400 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 1sk1sF-0006KE-8A for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sC-0005am-TZ for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:10 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-CjnsKdGpOnqasfWp41wcxw-1; Fri, 30 Aug 2024 09:41:05 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 014A819560B0; Fri, 30 Aug 2024 13:41:04 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0AA74300019C; Fri, 30 Aug 2024 13:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1h8nsjSdCePfHdUZXnTEXll7gpGJ8XJl5SgCjjKp8XU=; b=fwpgEQ1mlTlEho/qeXDBUC992Ei4KoDWnwz89uSB+s3qJ+GvGPcmrKdAco9aATkl4t+YhU I9gBM6p3BhZ61P3pT4SfiT6Z8fzA/dXwL75Gr/GHOpYCF6PT1YnK7mx3ffemUvVy8pF7GD ftlbQ5a9Sbn4ll7HvxapeNVkj/ZHaOQ= X-MC-Unique: CjnsKdGpOnqasfWp41wcxw-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 30/44] tests/functional: Convert the rx_gdbsim avocado test into a standalone test Date: Fri, 30 Aug 2024 15:38:24 +0200 Message-ID: <20240830133841.142644-31-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025483760116600 Provide a "gzip_uncompress" function based on the standard "gzip" module to avoid the usage of avocado.utils here. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 4 ++ tests/functional/qemu_test/utils.py | 12 +++++ .../test_rx_gdbsim.py} | 54 ++++++++++--------- 4 files changed, 46 insertions(+), 26 deletions(-) rename tests/{avocado/machine_rx_gdbsim.py =3D> functional/test_rx_gdbsim.= py} (58%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index c2dfb3dad3..25e71ac14c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1665,7 +1665,7 @@ R: Yoshinori Sato S: Orphan F: docs/system/target-rx.rst F: hw/rx/rx-gdbsim.c -F: tests/avocado/machine_rx_gdbsim.py +F: tests/functional/test_rx_gdbsim.py =20 SH4 Machines ------------ diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 76eb00ef46..bb511482cb 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -88,6 +88,10 @@ tests_riscv64_system_quick =3D [ 'riscv_opensbi', ] =20 +tests_rx_system_thorough =3D [ + 'rx_gdbsim', +] + tests_s390x_system_thorough =3D [ 's390x_ccw_virtio', 's390x_topology', diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index a12dac51b6..99eae5fc45 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -8,6 +8,7 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 +import gzip import lzma import os import shutil @@ -23,6 +24,17 @@ def archive_extract(archive, dest_dir, member=3DNone): else: tf.extractall(path=3Ddest_dir) =20 +def gzip_uncompress(gz_path, output_path): + if os.path.exists(output_path): + return + with gzip.open(gz_path, 'rb') as gz_in: + try: + with open(output_path, 'wb') as raw_out: + shutil.copyfileobj(gz_in, raw_out) + except: + os.remove(output_path) + raise + def lzma_uncompress(xz_path, output_path): if os.path.exists(output_path): return diff --git a/tests/avocado/machine_rx_gdbsim.py b/tests/functional/test_rx_= gdbsim.py old mode 100644 new mode 100755 similarity index 58% rename from tests/avocado/machine_rx_gdbsim.py rename to tests/functional/test_rx_gdbsim.py index 6bd9ce8199..5687f756bb --- a/tests/avocado/machine_rx_gdbsim.py +++ b/tests/functional/test_rx_gdbsim.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a Linux kernel and checks the console # # Copyright (c) 2018 Red Hat, Inc. @@ -10,11 +12,11 @@ =20 import os =20 -from avocado import skipUnless -from avocado_qemu import QemuSystemTest -from avocado_qemu import exec_command_and_wait_for_pattern -from avocado_qemu import wait_for_console_pattern -from avocado.utils import archive +from unittest import skipUnless +from qemu_test import QemuSystemTest, Asset +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import wait_for_console_pattern +from qemu_test.utils import gzip_uncompress =20 =20 class RxGdbSimMachine(QemuSystemTest): @@ -22,19 +24,25 @@ class RxGdbSimMachine(QemuSystemTest): timeout =3D 30 KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 + ASSET_UBOOT =3D Asset( + 'https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz', + '7146567d669e91dbac166384b29aeba1715beb844c8551e904b86831bfd9d046') + ASSET_DTB =3D Asset( + 'https://acc.dl.osdn.jp/users/23/23887/rx-virt.dtb', + 'aa278d9c1907a4501741d7ee57e7f65c02dd1b3e0323b33c6d4247f1b32cf29a') + ASSET_KERNEL =3D Asset( + 'http://acc.dl.osdn.jp/users/23/23845/zImage', + 'baa43205e74a7220ed8482188c5e9ce497226712abb7f4e7e4f825ce19ff9656') + def test_uboot(self): """ U-Boot and checks that the console is operational. - - :avocado: tags=3Darch:rx - :avocado: tags=3Dmachine:gdbsim-r5f562n8 - :avocado: tags=3Dendian:little - :avocado: tags=3Dflaky """ - uboot_url =3D ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.g= z') - uboot_hash =3D '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' - uboot_path =3D self.fetch_asset(uboot_url, asset_hash=3Duboot_hash) - uboot_path =3D archive.uncompress(uboot_path, self.workdir) + self.set_machine('gdbsim-r5f562n8') + + uboot_path_gz =3D self.ASSET_UBOOT.fetch() + uboot_path =3D os.path.join(self.workdir, 'u-boot.bin') + gzip_uncompress(uboot_path_gz, uboot_path) =20 self.vm.set_console() self.vm.add_args('-bios', uboot_path, @@ -50,18 +58,11 @@ def test_uboot(self): def test_linux_sash(self): """ Boots a Linux kernel and checks that the console is operational. - - :avocado: tags=3Darch:rx - :avocado: tags=3Dmachine:gdbsim-r5f562n7 - :avocado: tags=3Dendian:little - :avocado: tags=3Dflaky """ - dtb_url =3D ('https://acc.dl.osdn.jp/users/23/23887/rx-virt.dtb') - dtb_hash =3D '7b4e4e2c71905da44e86ce47adee2210b026ac18' - dtb_path =3D self.fetch_asset(dtb_url, asset_hash=3Ddtb_hash) - kernel_url =3D ('http://acc.dl.osdn.jp/users/23/23845/zImage') - kernel_hash =3D '39a81067f8d72faad90866ddfefa19165d68fc99' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + self.set_machine('gdbsim-r5f562n7') + + dtb_path =3D self.ASSET_DTB.fetch() + kernel_path =3D self.ASSET_KERNEL.fetch() =20 self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'earlyco= n' @@ -72,3 +73,6 @@ def test_linux_sash(self): wait_for_console_pattern(self, 'Sash command shell (version 1.1.1)= ', failure_message=3D'Kernel panic - not syn= cing') exec_command_and_wait_for_pattern(self, 'printenv', 'TERM=3Dlinux') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025441; cv=none; d=zohomail.com; s=zohoarc; b=DjcfWXH94Rt0WH7pVpvDqMxv00DnfVD4krKliFK93pJ9oceZC+z3VyIT9OphhqMcUTIS7n5mwc6U1KVk32ZKGe7SqlQmARf1LA18bHCQPB+oLvLpYg+6DvgDyWbRGe4BDwpg3/YaHF0XvvFYDLGCEd1Xij4/+/M5ClQL/lOmX4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025441; h=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=E4Z4Tadna4Nvhy+cocQw37rWEQ0YSUp9nQFszQCOnYI=; b=lvjSsD+09O/lHTRY0UPfu2w8cdnrd40AeKHGBLyvQSUaWAyht5pqqkdXn/5DmSTg1qdvKjf2McG6RQl6V5a6bqDqzHkL0pomfy6fWca9oEe8eRq27firat4XUKA72UyBBGJPzr0ZZDkJTmoQ24J2/AWCnq9+YzHlfBGQRP0r1Lg= 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 17250254412791021.8389858512114; Fri, 30 Aug 2024 06:44:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sO-0007nh-Ps; Fri, 30 Aug 2024 09:41:20 -0400 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 1sk1sL-0007J2-Gd for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sJ-0005bK-7T for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:17 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-LQcqF77EPvGByF-ba0L0BA-1; Fri, 30 Aug 2024 09:41:09 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 184D51955D56; Fri, 30 Aug 2024 13:41:08 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 72C103001FE5; Fri, 30 Aug 2024 13:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E4Z4Tadna4Nvhy+cocQw37rWEQ0YSUp9nQFszQCOnYI=; b=NObIbuJ48WrL5F3SuCjo8EBv+EvKU5UVrlppEoUVV0QtMCtpdsZ3dIXh2frZY1tj5TRBe1 vUFDdRgQTG/rU8tESbn6SReEU7J6N9UzYXBEhvuGqHpY1+c1Mx0iIHP0tQGJ0uHsOUMUtv VmOFXJpaVtaarJlS4/7rV2fS4xDRk2Y= X-MC-Unique: LQcqF77EPvGByF-ba0L0BA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 31/44] tests/functional: Convert the linux_initrd avocado test into a standalone test Date: Fri, 30 Aug 2024 15:38:25 +0200 Message-ID: <20240830133841.142644-32-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025441525116600 Content-Type: text/plain; charset="utf-8" While we're at it, update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays. Signed-off-by: Thomas Huth --- tests/functional/meson.build | 1 + .../test_linux_initrd.py} | 37 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) rename tests/{avocado/linux_initrd.py =3D> functional/test_linux_initrd.py= } (76%) mode change 100644 =3D> 100755 diff --git a/tests/functional/meson.build b/tests/functional/meson.build index bb511482cb..34a9b277f8 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -111,6 +111,7 @@ tests_x86_64_system_quick =3D [ =20 tests_x86_64_system_thorough =3D [ 'acpi_bits', + 'linux_initrd', 'netdev_ethtool', 'virtio_gpu', ] diff --git a/tests/avocado/linux_initrd.py b/tests/functional/test_linux_in= itrd.py old mode 100644 new mode 100755 similarity index 76% rename from tests/avocado/linux_initrd.py rename to tests/functional/test_linux_initrd.py index 7f47b98ae7..c71a59d4c9 --- a/tests/avocado/linux_initrd.py +++ b/tests/functional/test_linux_initrd.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Linux initrd integration test. # # Copyright (c) 2018 Red Hat, Inc. @@ -12,20 +14,27 @@ import logging import tempfile =20 -from avocado_qemu import QemuSystemTest -from avocado import skipUnless +from qemu_test import QemuSystemTest, Asset +from unittest import skipUnless =20 =20 class LinuxInitrd(QemuSystemTest): """ Checks QEMU evaluates correctly the initrd file passed as -initrd opti= on. - - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dmachine:pc """ =20 timeout =3D 300 =20 + ASSET_F18_KERNEL =3D Asset( + ('https://archives.fedoraproject.org/pub/archive/fedora/linux/' + 'releases/18/Fedora/x86_64/os/images/pxeboot/vmlinuz'), + '1a27cb42559ce29237ac186699d063556ad69c8349d732bb1bd8d614e5a8cc2e') + + ASSET_F28_KERNEL =3D Asset( + ('https://archives.fedoraproject.org/pub/archive/fedora/linux/' + 'releases/28/Everything/x86_64/os/images/pxeboot/vmlinuz'), + 'd05909c9d4a742a6fcc84dcc0361009e4611769619cc187a07107579a035f24e') + def test_with_2gib_file_should_exit_error_msg_with_linux_v3_6(self): """ Pretends to boot QEMU with an initrd file with size of 2GiB @@ -33,10 +42,8 @@ def test_with_2gib_file_should_exit_error_msg_with_linux= _v3_6(self): Fedora-18 shipped with linux-3.6 which have not supported xloadfla= gs cannot support more than 2GiB initrd. """ - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive/fe= dora/li' - 'nux/releases/18/Fedora/x86_64/os/images/pxeboot/vml= inuz') - kernel_hash =3D '41464f68efe42b9991250bed86c7081d2ccdbb21' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + self.set_machine('pc') + kernel_path =3D self.ASSET_F18_KERNEL.fetch() max_size =3D 2 * (1024 ** 3) - 1 =20 with tempfile.NamedTemporaryFile() as initrd: @@ -56,16 +63,11 @@ def test_with_2gib_file_should_exit_error_msg_with_linu= x_v3_6(self): @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') def test_with_2gib_file_should_work_with_linux_v4_16(self): """ - :avocado: tags=3Dflaky - QEMU has supported up to 4 GiB initrd for recent kernel Expect guest can reach 'Unpacking initramfs...' """ - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive/fe= dora' - '/linux/releases/28/Everything/x86_64/os/images/pxeb= oot/' - 'vmlinuz') - kernel_hash =3D '238e083e114c48200f80d889f7e32eeb2793e02a' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + self.set_machine('pc') + kernel_path =3D self.ASSET_F28_KERNEL.fetch() max_size =3D 2 * (1024 ** 3) + 1 =20 with tempfile.NamedTemporaryFile() as initrd: @@ -89,3 +91,6 @@ def test_with_2gib_file_should_work_with_linux_v4_16(self= ): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025317; cv=none; d=zohomail.com; s=zohoarc; b=l17AKwfvsqkNwTFgpr5dPpzcEFbtrwm55KbuNMhN9hYgRnThE3xKdyaTc7eSG4+XY19TnWmzfoJ9ulDRSfnBVV7/1+sPBnzUYCmX0rPVP0zmUeArHaHCKTdTK6DMfctZct0FvRRP0NANnr6FwpnfIMMVWRDgxxnc/MfYDJpduco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025317; h=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=bMkh+YGpTjhbMYB2P7rekHhrL11Gu9OuMlhFAjczmh8=; b=BP33Fq35htuxCxiT4UEeoutWgB7OjYOzhSOnWUc9uaqppFJONHV4S/x+dc+qk/f3mzQnaxSdTg6+nYBQqjwirJx34WTVbJhPFGeKtaUm/qxlyED4czxpuLh0LrG/PXcL/JlOXZLdtAgZ9vRdtDd3Uh3iGNysZ+jV1/aqL3p/4QU= 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 1725025317316176.15709918161292; Fri, 30 Aug 2024 06:41:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sQ-00089S-Ml; Fri, 30 Aug 2024 09:41:22 -0400 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 1sk1sO-0007nT-Ft for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sM-0005cQ-It for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:20 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-oEpSR-CaMUGOVr0Y8hVBBQ-1; Fri, 30 Aug 2024 09:41:13 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5125C1955BF7; Fri, 30 Aug 2024 13:41:12 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3E38D300019C; Fri, 30 Aug 2024 13:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bMkh+YGpTjhbMYB2P7rekHhrL11Gu9OuMlhFAjczmh8=; b=f6L4ihPXEBMFl8ZFlvjdT35Xb0Uhi+sLXIjqZ6adyB7P63WqDRy0We+bAcgXl0oX53hwUu TpibEid84FFLD7yj4FoAeEkgiXNIR2VaK5CB/yr3FL8ES4wOPeLhDMl42aoKge/EmyptlI uwbe+dnqgZJ5LhDBJWoQClzeo3+WBss= X-MC-Unique: oEpSR-CaMUGOVr0Y8hVBBQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 32/44] tests/functional: Convert the vnc test Date: Fri, 30 Aug 2024 15:38:26 +0200 Message-ID: <20240830133841.142644-33-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025318808116600 Content-Type: text/plain; charset="utf-8" Nothing thrilling in here, it's just a straight forward conversion. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- tests/functional/meson.build | 1 + tests/{avocado/vnc.py =3D> functional/test_vnc.py} | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) rename tests/{avocado/vnc.py =3D> functional/test_vnc.py} (97%) mode change 100644 =3D> 100755 diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 34a9b277f8..58f6bcf95d 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -107,6 +107,7 @@ tests_x86_64_system_quick =3D [ 'pc_cpu_hotplug_props', 'virtio_version', 'x86_cpu_model_versions', + 'vnc', ] =20 tests_x86_64_system_thorough =3D [ diff --git a/tests/avocado/vnc.py b/tests/functional/test_vnc.py old mode 100644 new mode 100755 similarity index 97% rename from tests/avocado/vnc.py rename to tests/functional/test_vnc.py index 862c8996a8..b769d3b268 --- a/tests/avocado/vnc.py +++ b/tests/functional/test_vnc.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Simple functional tests for VNC functionality # # Copyright (c) 2018 Red Hat, Inc. @@ -11,7 +13,7 @@ import socket from typing import List =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 =20 VNC_ADDR =3D '127.0.0.1' @@ -51,10 +53,7 @@ def find_free_ports(count: int) -> List[int]: =20 =20 class Vnc(QemuSystemTest): - """ - :avocado: tags=3Dvnc,quick - :avocado: tags=3Dmachine:none - """ + def test_no_vnc(self): self.vm.add_args('-nodefaults', '-S') self.vm.launch() @@ -113,3 +112,6 @@ def test_change_listen(self): self.assertFalse(check_connect(a)) self.assertTrue(check_connect(b)) self.assertTrue(check_connect(c)) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025500; cv=none; d=zohomail.com; s=zohoarc; b=BRxqx+kFWgcCUp3gHbyzoRvqR32pEUheR7bjMWcMud15q03FXkhiHBUKDuBm3/rtyPv7Sd0NeuY7iTYsYprO5Qu7Y7hBmLjihXfkiIYeRsYtgXur7UPWukV9g69TTYM/Zykyvomt8BSdz5P/SNsBf/0YZA3oAmpwGb87tvOi8vM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025500; 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=g8reHlBu2HO9GEDbKdRUlnYq6oypIbdQw/HlVrHWB+0=; b=DUpu6aDldqJzpB/7/Rhsll6GQSjQrxRqdJeLvufC0G4de3ElY/+wfMoXsLHH2SVLJzLsqvSjaIf1s1Xr283twrQXULKLmiT6QzIPuYG6c1prGcm+OilGFNAx6q1o9wGc+65YTHSSr+7KvAV5kGhj+0XvuUhrViHe2cr/IkrrGLI= 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 1725025500157452.177950463967; Fri, 30 Aug 2024 06:45:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sT-000064-8Z; Fri, 30 Aug 2024 09:41:25 -0400 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 1sk1sQ-00088Q-Fq for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sN-0005ca-Cl for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:22 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-404-YN8f9HqQN7qMsEBgJQItLQ-1; Fri, 30 Aug 2024 09:41:16 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A05171955D45; Fri, 30 Aug 2024 13:41:15 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C4520300019C; Fri, 30 Aug 2024 13:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g8reHlBu2HO9GEDbKdRUlnYq6oypIbdQw/HlVrHWB+0=; b=i0RhcuBZVmLmg91i1SOlosi4c+YgN/PAMn5voF3h/uOvehN/5C0Sbx5qpcvK9Rgf7XGmha DMlFrFd6jwju7UkFDIbDuY775GxJpH2DswV52o4wZfX49/oOEd2lm6265EDnMC/QTR/B+Y Dz1y0/Bc+WNHpgGSAeXcLuXIL7Anl/o= X-MC-Unique: YN8f9HqQN7qMsEBgJQItLQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 33/44] tests/functional: Convert ARM Integrator/CP avocado tests Date: Fri, 30 Aug 2024 15:38:27 +0200 Message-ID: <20240830133841.142644-34-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025501990116600 From: Philippe Mathieu-Daud=C3=A9 Straight forward conversion. Update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays. $ QEMU_TEST_ALLOW_UNTRUSTED_CODE=3D1 make check-functional-arm ... 6/6 qemu:func-thorough+func-arm-thorough+thorough / func-arm-arm_integrat= orcp OK 3.90s 2 subtests passed Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-ID: <20240822110238.82312-1-philmd@linaro.org> Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 1 + .../test_arm_integratorcp.py} | 56 ++++++++++--------- 3 files changed, 33 insertions(+), 26 deletions(-) rename tests/{avocado/machine_arm_integratorcp.py =3D> functional/test_arm= _integratorcp.py} (63%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 25e71ac14c..14500cf8a5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -785,7 +785,7 @@ S: Maintained F: hw/arm/integratorcp.c F: hw/misc/arm_integrator_debug.c F: include/hw/misc/arm_integrator_debug.h -F: tests/avocado/machine_arm_integratorcp.py +F: tests/functional/test_arm_integratorcp.py F: docs/system/arm/integratorcp.rst =20 MCIMX6UL EVK / i.MX6ul diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 58f6bcf95d..182d40e052 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -34,6 +34,7 @@ tests_generic_bsduser =3D [ =20 tests_arm_system_thorough =3D [ 'arm_canona1100', + 'arm_integratorcp', 'arm_n8x0', ] =20 diff --git a/tests/avocado/machine_arm_integratorcp.py b/tests/functional/t= est_arm_integratorcp.py old mode 100644 new mode 100755 similarity index 63% rename from tests/avocado/machine_arm_integratorcp.py rename to tests/functional/test_arm_integratorcp.py index 87f5cf3953..0fe083f661 --- a/tests/avocado/machine_arm_integratorcp.py +++ b/tests/functional/test_arm_integratorcp.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a Linux kernel and checks the console # # Copyright (c) 2020 Red Hat, Inc. @@ -7,13 +9,15 @@ # # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. +# +# SPDX-License-Identifier: GPL-2.0-or-later =20 import os import logging =20 -from avocado import skipUnless -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from unittest import skipUnless =20 =20 NUMPY_AVAILABLE =3D True @@ -33,50 +37,49 @@ class IntegratorMachine(QemuSystemTest): =20 timeout =3D 90 =20 - def boot_integratorcp(self): - kernel_url =3D ('https://github.com/zayac/qemu-arm/raw/master/' - 'arm-test/kernel/zImage.integrator') - kernel_hash =3D '0d7adba893c503267c946a3cbdc63b4b54f25468' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + ASSET_KERNEL =3D Asset( + ('https://github.com/zayac/qemu-arm/raw/master/' + 'arm-test/kernel/zImage.integrator'), + '26e7c7e8f943de785d95bd3c74d66451604a9b6a7a3d25dceb279e7548fd8e78') + + ASSET_INITRD =3D Asset( + ('https://github.com/zayac/qemu-arm/raw/master/' + 'arm-test/kernel/arm_root.img'), + 'e187c27fb342ad148c7f33475fbed124933e0b3f4be8c74bc4f3426a4793373a') =20 - initrd_url =3D ('https://github.com/zayac/qemu-arm/raw/master/' - 'arm-test/kernel/arm_root.img') - initrd_hash =3D 'b51e4154285bf784e017a37586428332d8c7bd8b' - initrd_path =3D self.fetch_asset(initrd_url, asset_hash=3Dinitrd_h= ash) + ASSET_TUXLOGO =3D Asset( + ('https://github.com/torvalds/linux/raw/v2.6.12/' + 'drivers/video/logo/logo_linux_vga16.ppm'), + 'b762f0d91ec018887ad1b334543c2fdf9be9fdfc87672b409211efaa3ea0ef79') =20 + def boot_integratorcp(self): + kernel_path =3D self.ASSET_KERNEL.fetch() + initrd_path =3D self.ASSET_INITRD.fetch() + + self.set_machine('integratorcp') self.vm.set_console() self.vm.add_args('-kernel', kernel_path, '-initrd', initrd_path, '-append', 'printk.time=3D0 console=3DttyAMA0') self.vm.launch() =20 - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') def test_integratorcp_console(self): """ Boots the Linux kernel and checks that the console is operational - :avocado: tags=3Darch:arm - :avocado: tags=3Dmachine:integratorcp - :avocado: tags=3Ddevice:pl011 """ self.boot_integratorcp() wait_for_console_pattern(self, 'Log in as root') =20 @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') def test_framebuffer_tux_logo(self): """ Boot Linux and verify the Tux logo is displayed on the framebuffer. - :avocado: tags=3Darch:arm - :avocado: tags=3Dmachine:integratorcp - :avocado: tags=3Ddevice:pl110 - :avocado: tags=3Ddevice:framebuffer """ screendump_path =3D os.path.join(self.workdir, "screendump.pbm") - tuxlogo_url =3D ('https://github.com/torvalds/linux/raw/v2.6.12/' - 'drivers/video/logo/logo_linux_vga16.ppm') - tuxlogo_hash =3D '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af' - tuxlogo_path =3D self.fetch_asset(tuxlogo_url, asset_hash=3Dtuxlog= o_hash) + tuxlogo_path =3D self.ASSET_TUXLOGO.fetch() =20 self.boot_integratorcp() framebuffer_ready =3D 'Console: switching to colour frame buffer d= evice' @@ -97,3 +100,6 @@ def test_framebuffer_tux_logo(self): for tux_count, pt in enumerate(zip(*loc[::-1]), start=3D1): logger.debug('found Tux at position [x, y] =3D %s', pt) self.assertGreaterEqual(tux_count, cpu_count) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025356; cv=none; d=zohomail.com; s=zohoarc; b=JY46kaL/q6q/7WdrUbNsQl1Up0MnPHAqXwuYPfvj12YAmRxLWR/pfwJs5wcKam32ttFNiKHLnNOmiYiIXjqitgVJTu88gqRm+2/GaNTXdmdNLrHKIO3oQKz3/VEm5gx4HvjKsk1TRpy6WB69+COkKVd/nAzphQUWjl/UnhVoYIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025356; 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=6mdIoF3xuCHGOPdCVcPwzRR0kONRuQQzMBOLWj4UZjU=; b=bLyS5gQErYgxbj/4r6JRCJQMx6fEAusSIICfqq9G7uY+eVjir0U8NiELrMrAzRhPA/SyZCG/k7j2bjcRTwl9SuhbcUm6rRmTtfh3fkh8EoxB7ma8dLlizfhmd0lZI2DbdLjBASImuEKEdKq1R4yBsNFa4DtdyiiA+xQ8jsttz/w= 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 1725025356789690.6604632357064; Fri, 30 Aug 2024 06:42:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sb-0001TY-3b; Fri, 30 Aug 2024 09:41:33 -0400 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 1sk1sY-00015Q-Qq for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sV-0005dt-R0 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:30 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-uKfB9zBWNXOO8WrvaxU0vQ-1; Fri, 30 Aug 2024 09:41:21 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 61B441955EA1; Fri, 30 Aug 2024 13:41:20 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C96A300019C; Fri, 30 Aug 2024 13:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6mdIoF3xuCHGOPdCVcPwzRR0kONRuQQzMBOLWj4UZjU=; b=DnP7zLr1JUlcxuRnU0Ope4tphPnocY4qRoU2d7jA1LL3WWz4iQRfxzgpWt64asoA9D4BKL nEMUmCINEpJiO7XHO2GQzDxLWDoXzUHpl4aXTCZZ83D1zfJDZ3M3VMTF2ovoZXZQlvd84I PWrZdybE0y7LGioLqd1JJQj41dASAuc= X-MC-Unique: uKfB9zBWNXOO8WrvaxU0vQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 34/44] tests/functional: Convert Aarch64 SBSA-Ref avocado tests Date: Fri, 30 Aug 2024 15:38:28 +0200 Message-ID: <20240830133841.142644-35-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025357273116600 From: Philippe Mathieu-Daud=C3=A9 Straight forward conversion. Since SBSA_FLASH files are not tarballs, use lzma_uncompress() method. Avocado used to set a timeout of 11 tests * 180s =3D 1980s. Hopefully 600s should be sufficient. Running on macOS Sonoma / Apple silicon M1: $ QEMU_TEST_TIMEOUT_EXPECTED=3D1 make check-functional-aarch64 V=3D1 =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alp= ine_linux_max OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alp= ine_linux_max_pauth_impdef OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alp= ine_linux_max_pauth_off OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alp= ine_linux_neoverse_n1 OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_edk= 2_firmware OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_ope= nbsd73_cortex_a57 OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_ope= nbsd73_max OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_ope= nbsd73_max_pauth_impdef OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_ope= nbsd73_max_pauth_off OK =E2=96=B6 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_ope= nbsd73_neoverse_n1 OK 1/5 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarc= h64_sbsaref OK 241.79s 11 subtests passed ... Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Reviewed-by: Marcin Juszkiewicz Message-ID: <20240823131614.10269-1-philmd@linaro.org> Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 5 + .../test_aarch64_sbsaref.py} | 144 ++++++------------ 3 files changed, 55 insertions(+), 96 deletions(-) rename tests/{avocado/machine_aarch64_sbsaref.py =3D> functional/test_aarc= h64_sbsaref.py} (56%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 14500cf8a5..e9aa174dc7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -971,7 +971,7 @@ F: hw/misc/sbsa_ec.c F: hw/watchdog/sbsa_gwdt.c F: include/hw/watchdog/sbsa_gwdt.h F: docs/system/arm/sbsa.rst -F: tests/avocado/machine_aarch64_sbsaref.py +F: tests/functional/test_aarch64_sbsaref.py =20 Sharp SL-5500 (Collie) PDA M: Peter Maydell diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 182d40e052..bfa04818cc 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -11,6 +11,7 @@ endif =20 # Timeouts for individual tests that can be slow e.g. with debugging enabl= ed test_timeouts =3D { + 'aarch64_sbsaref' : 600, 'acpi_bits' : 240, 'netdev_ethtool' : 180, 'ppc_40p' : 240, @@ -32,6 +33,10 @@ tests_generic_linuxuser =3D [ tests_generic_bsduser =3D [ ] =20 +tests_aarch64_system_thorough =3D [ + 'aarch64_sbsaref', +] + tests_arm_system_thorough =3D [ 'arm_canona1100', 'arm_integratorcp', diff --git a/tests/avocado/machine_aarch64_sbsaref.py b/tests/functional/te= st_aarch64_sbsaref.py old mode 100644 new mode 100755 similarity index 56% rename from tests/avocado/machine_aarch64_sbsaref.py rename to tests/functional/test_aarch64_sbsaref.py index f8bf40c192..e90566cdb8 --- a/tests/avocado/machine_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a Linux kernel and checks the console # # SPDX-FileCopyrightText: 2023-2024 Linaro Ltd. @@ -8,12 +10,11 @@ =20 import os =20 -from avocado import skipUnless -from avocado.utils import archive - -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern -from avocado_qemu import interrupt_interactive_console_until_pattern +from qemu_test import QemuSystemTest, Asset +from qemu_test import wait_for_console_pattern +from qemu_test import interrupt_interactive_console_until_pattern +from qemu_test.utils import lzma_uncompress +from unittest import skipUnless =20 =20 class Aarch64SbsarefMachine(QemuSystemTest): @@ -28,6 +29,16 @@ class Aarch64SbsarefMachine(QemuSystemTest): =20 timeout =3D 180 =20 + ASSET_FLASH0 =3D Asset( + ('https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref= /' + '20240619-148232/edk2/SBSA_FLASH0.fd.xz'), + '0c954842a590988f526984de22e21ae0ab9cb351a0c99a8a58e928f0c7359cf7') + + ASSET_FLASH1 =3D Asset( + ('https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref= /' + '20240619-148232/edk2/SBSA_FLASH1.fd.xz'), + 'c6ec39374c4d79bb9e9cdeeb6db44732d90bb4a334cec92002b3f4b9cac4b5ee') + def fetch_firmware(self): """ Flash volumes generated using: @@ -44,47 +55,31 @@ def fetch_firmware(self): """ =20 # Secure BootRom (TF-A code) - fs0_xz_url =3D ( - "https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-= ref/" - "20240619-148232/edk2/SBSA_FLASH0.fd.xz" - ) - fs0_xz_hash =3D "0c954842a590988f526984de22e21ae0ab9cb351a0c99a8a5= 8e928f0c7359cf7" - tar_xz_path =3D self.fetch_asset(fs0_xz_url, asset_hash=3Dfs0_xz_h= ash, - algorithm=3D'sha256') - archive.extract(tar_xz_path, self.workdir) + fs0_xz_path =3D self.ASSET_FLASH0.fetch() fs0_path =3D os.path.join(self.workdir, "SBSA_FLASH0.fd") + lzma_uncompress(fs0_xz_path, fs0_path) =20 # Non-secure rom (UEFI and EFI variables) - fs1_xz_url =3D ( - "https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-= ref/" - "20240619-148232/edk2/SBSA_FLASH1.fd.xz" - ) - fs1_xz_hash =3D "c6ec39374c4d79bb9e9cdeeb6db44732d90bb4a334cec9200= 2b3f4b9cac4b5ee" - tar_xz_path =3D self.fetch_asset(fs1_xz_url, asset_hash=3Dfs1_xz_h= ash, - algorithm=3D'sha256') - archive.extract(tar_xz_path, self.workdir) + fs1_xz_path =3D self.ASSET_FLASH1.fetch() fs1_path =3D os.path.join(self.workdir, "SBSA_FLASH1.fd") + lzma_uncompress(fs1_xz_path, fs1_path) =20 for path in [fs0_path, fs1_path]: with open(path, "ab+") as fd: fd.truncate(256 << 20) # Expand volumes to 256MiB =20 + self.set_machine('sbsa-ref') self.vm.set_console() self.vm.add_args( - "-drive", - f"if=3Dpflash,file=3D{fs0_path},format=3Draw", - "-drive", - f"if=3Dpflash,file=3D{fs1_path},format=3Draw", - "-machine", - "sbsa-ref", + "-drive", f"if=3Dpflash,file=3D{fs0_path},format=3Draw", + "-drive", f"if=3Dpflash,file=3D{fs1_path},format=3Draw", ) =20 def test_sbsaref_edk2_firmware(self): - """ - :avocado: tags=3Dcpu:cortex-a57 - """ =20 self.fetch_firmware() + + self.vm.add_args('-cpu', 'cortex-a57') self.vm.launch() =20 # TF-A boot sequence: @@ -110,87 +105,62 @@ def test_sbsaref_edk2_firmware(self): wait_for_console_pattern(self, "UEFI firmware (version 1.0") interrupt_interactive_console_until_pattern(self, "QEMU SBSA-REF M= achine") =20 + + ASSET_ALPINE_ISO =3D Asset( + ('https://dl-cdn.alpinelinux.org/' + 'alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.iso= '), + '5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e19c4bd9dc027') + # This tests the whole boot chain from EFI to Userspace # We only boot a whole OS for the current top level CPU and GIC # Other test profiles should use more minimal boots def boot_alpine_linux(self, cpu): self.fetch_firmware() =20 - iso_url =3D ( - "https://dl-cdn.alpinelinux.org/" - "alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.= iso" - ) - - iso_hash =3D "5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e= 19c4bd9dc027" - iso_path =3D self.fetch_asset(iso_url, algorithm=3D"sha256", asset= _hash=3Diso_hash) + iso_path =3D self.ASSET_ALPINE_ISO.fetch() =20 self.vm.set_console() self.vm.add_args( - "-cpu", - cpu, - "-drive", - f"file=3D{iso_path},media=3Dcdrom,format=3Draw", + "-cpu", cpu, + "-drive", f"file=3D{iso_path},media=3Dcdrom,format=3Draw", ) =20 self.vm.launch() wait_for_console_pattern(self, "Welcome to Alpine Linux 3.17") =20 def test_sbsaref_alpine_linux_cortex_a57(self): - """ - :avocado: tags=3Dcpu:cortex-a57 - :avocado: tags=3Dos:linux - """ self.boot_alpine_linux("cortex-a57") =20 def test_sbsaref_alpine_linux_neoverse_n1(self): - """ - :avocado: tags=3Dcpu:neoverse-n1 - :avocado: tags=3Dos:linux - """ self.boot_alpine_linux("neoverse-n1") =20 def test_sbsaref_alpine_linux_max_pauth_off(self): - """ - :avocado: tags=3Dcpu:max - :avocado: tags=3Dos:linux - """ self.boot_alpine_linux("max,pauth=3Doff") =20 def test_sbsaref_alpine_linux_max_pauth_impdef(self): - """ - :avocado: tags=3Dcpu:max - :avocado: tags=3Dos:linux - """ self.boot_alpine_linux("max,pauth-impdef=3Don") =20 - @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout= ') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeo= ut') def test_sbsaref_alpine_linux_max(self): - """ - :avocado: tags=3Dcpu:max - :avocado: tags=3Dos:linux - """ self.boot_alpine_linux("max") =20 =20 + ASSET_OPENBSD_ISO =3D Asset( + ('https://cdn.openbsd.org/pub/OpenBSD/7.3/arm64/miniroot73.img'), + '7fc2c75401d6f01fbfa25f4953f72ad7d7c18650056d30755c44b9c129b707e5') + # This tests the whole boot chain from EFI to Userspace # We only boot a whole OS for the current top level CPU and GIC # Other test profiles should use more minimal boots def boot_openbsd73(self, cpu): self.fetch_firmware() =20 - img_url =3D ( - "https://cdn.openbsd.org/pub/OpenBSD/7.3/arm64/miniroot73.img" - ) - - img_hash =3D "7fc2c75401d6f01fbfa25f4953f72ad7d7c18650056d30755c44= b9c129b707e5" - img_path =3D self.fetch_asset(img_url, algorithm=3D"sha256", asset= _hash=3Dimg_hash) + img_path =3D self.ASSET_OPENBSD_ISO.fetch() =20 self.vm.set_console() self.vm.add_args( - "-cpu", - cpu, - "-drive", - f"file=3D{img_path},format=3Draw,snapshot=3Don", + "-cpu", cpu, + "-drive", f"file=3D{img_path},format=3Draw,snapshot=3Don", ) =20 self.vm.launch() @@ -199,38 +169,22 @@ def boot_openbsd73(self, cpu): " 7.3 installation program.") =20 def test_sbsaref_openbsd73_cortex_a57(self): - """ - :avocado: tags=3Dcpu:cortex-a57 - :avocado: tags=3Dos:openbsd - """ self.boot_openbsd73("cortex-a57") =20 def test_sbsaref_openbsd73_neoverse_n1(self): - """ - :avocado: tags=3Dcpu:neoverse-n1 - :avocado: tags=3Dos:openbsd - """ self.boot_openbsd73("neoverse-n1") =20 def test_sbsaref_openbsd73_max_pauth_off(self): - """ - :avocado: tags=3Dcpu:max - :avocado: tags=3Dos:openbsd - """ self.boot_openbsd73("max,pauth=3Doff") =20 - @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout= ') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeo= ut') def test_sbsaref_openbsd73_max_pauth_impdef(self): - """ - :avocado: tags=3Dcpu:max - :avocado: tags=3Dos:openbsd - """ self.boot_openbsd73("max,pauth-impdef=3Don") =20 - @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout= ') + @skipUnless(os.getenv('QEMU_TEST_TIMEOUT_EXPECTED'), 'Test might timeo= ut') def test_sbsaref_openbsd73_max(self): - """ - :avocado: tags=3Dcpu:max - :avocado: tags=3Dos:openbsd - """ self.boot_openbsd73("max") + + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025314; cv=none; d=zohomail.com; s=zohoarc; b=Ak6+toGY/T6zY+hR2YbEPN8mXYYCJvTDzGawfazDyDY6Md2MYW6mGgxHyN3cnMzxXW2DZ+G9ATcpe0shUVO+yySTgkxN1rl1T9enwbbNTAn7NhAmln6bPgO34BXtRtI6keDdAmfhSOASTk/S09X4ANoAOkcI9NgLz8YD6IDikC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025314; 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=COIEQfzLP1CAiIPZqcELBtwxDeHv0xwQTj4LFwfL18M=; b=abhn0d4lBotbvHE0Be5pC4sx92yEGhKWAqlio3rbc/cxlnxa1eDyIjGSIwo3FQ4RODu7sGPjPzAfVJCqAqPmU/oZUtvURPwibjMOdITGtswDhygqH6iVIEow0Rnh+Gk/YOFRxvbcZ7pchbNRj2dLHwPe2t9zUvl/gRspnWiJhVY= 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 1725025314387161.51563721684727; Fri, 30 Aug 2024 06:41:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sb-0001aa-JU; Fri, 30 Aug 2024 09:41:33 -0400 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 1sk1sZ-000195-1o for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sW-0005dx-Dq for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:30 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-140-bT3rnuozMdKwMkAf0k6CyA-1; Fri, 30 Aug 2024 09:41:26 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5DCB01955BED; Fri, 30 Aug 2024 13:41:24 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B6FBD300019C; Fri, 30 Aug 2024 13:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=COIEQfzLP1CAiIPZqcELBtwxDeHv0xwQTj4LFwfL18M=; b=b4BW3RY2wS65aKl4rs4lx1rMqAQsn8YyWQoussyMfLSXJ+Qk2yQnFjQ/BZq8ue9R7lbcny O7f/gTcISYtymcUfe4kH7D1OzcJfzaxww7jHMoCmW/P1+lOcp+brHopJpFMWIg3OG/S1Ai 80UXBAqEfSYTJuU53ddynqdgh8dYOAc= X-MC-Unique: bT3rnuozMdKwMkAf0k6CyA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 35/44] tests/functional: Convert Aarch64 Virt machine avocado tests Date: Fri, 30 Aug 2024 15:38:29 +0200 Message-ID: <20240830133841.142644-36-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025314931116600 From: Philippe Mathieu-Daud=C3=A9 Straight forward conversion. Update the SHA1 hash to SHA256 since SHA1 should not be used anymore nowadays. Provide get_qemu_img() helper in qemu_test. $ make check-functional-aarch64 V=3D1 =E2=96=B6 1/4 test_aarch64_virt.Aarch64VirtMachine.test_aarch64_virt_gicv= 2 OK =E2=96=B6 1/4 test_aarch64_virt.Aarch64VirtMachine.test_aarch64_virt_gicv= 3 OK =E2=96=B6 1/4 test_aarch64_virt.Aarch64VirtMachine.test_alpine_virt_tcg_g= ic_max OK 1/4 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarc= h64_virt OK 30.44s 3 subtests passed ... Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20240826103634.52384-1-philmd@linaro.org> Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 2 + tests/functional/qemu_test/__init__.py | 2 +- tests/functional/qemu_test/cmd.py | 15 ++++ .../test_aarch64_virt.py} | 69 ++++++++----------- 5 files changed, 46 insertions(+), 44 deletions(-) rename tests/{avocado/machine_aarch64_virt.py =3D> functional/test_aarch64= _virt.py} (69%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index e9aa174dc7..cbdf2863fa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1023,7 +1023,7 @@ S: Maintained F: hw/arm/virt* F: include/hw/arm/virt.h F: docs/system/arm/virt.rst -F: tests/avocado/machine_aarch64_virt.py +F: tests/functional/test_aarch64_virt.py =20 Xilinx Zynq M: Edgar E. Iglesias diff --git a/tests/functional/meson.build b/tests/functional/meson.build index bfa04818cc..4154b1cbcd 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -12,6 +12,7 @@ endif # Timeouts for individual tests that can be slow e.g. with debugging enabl= ed test_timeouts =3D { 'aarch64_sbsaref' : 600, + 'aarch64_virt' : 360, 'acpi_bits' : 240, 'netdev_ethtool' : 180, 'ppc_40p' : 240, @@ -35,6 +36,7 @@ tests_generic_bsduser =3D [ =20 tests_aarch64_system_thorough =3D [ 'aarch64_sbsaref', + 'aarch64_virt', ] =20 tests_arm_system_thorough =3D [ diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu= _test/__init__.py index db05c8f412..1d87d7122f 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -10,5 +10,5 @@ from .config import BUILD_DIR from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \ interrupt_interactive_console_until_pattern, wait_for_console_pattern,= \ - exec_command, exec_command_and_wait_for_pattern + exec_command, exec_command_and_wait_for_pattern, get_qemu_img from .testcase import QemuSystemTest, QemuBaseTest diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test= /cmd.py index 8580ee8faf..3acd617324 100644 --- a/tests/functional/qemu_test/cmd.py +++ b/tests/functional/qemu_test/cmd.py @@ -16,6 +16,8 @@ import os.path import subprocess =20 +from .config import BUILD_DIR + =20 def has_cmd(name, args=3DNone): """ @@ -176,3 +178,16 @@ def exec_command_and_wait_for_pattern(test, command, :param failure_message: if this message appears, test fails """ _console_interaction(test, success_message, failure_message, command += '\r') + +def get_qemu_img(test): + test.log.debug('Looking for and selecting a qemu-img binary') + + # If qemu-img has been built, use it, otherwise the system wide one + # will be used. + qemu_img =3D os.path.join(BUILD_DIR, 'qemu-img') + if os.path.exists(qemu_img): + return qemu_img + if has_cmd('qemu-img'): + return 'qemu-img' + test.skipTest('Could not find "qemu-img", which is required to ' + 'create temporary images') diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/functional/test_= aarch64_virt.py old mode 100644 new mode 100755 similarity index 69% rename from tests/avocado/machine_aarch64_virt.py rename to tests/functional/test_aarch64_virt.py index 6831d2c0ed..c967da41b4 --- a/tests/avocado/machine_aarch64_virt.py +++ b/tests/functional/test_aarch64_virt.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional test that boots a various Linux systems and checks the # console output. # @@ -12,12 +14,11 @@ import os import logging =20 -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern -from avocado_qemu import exec_command -from avocado_qemu import BUILD_DIR -from avocado.utils import process -from avocado.utils.path import find_command +from qemu_test import BUILD_DIR +from qemu_test import QemuSystemTest, Asset +from qemu_test import exec_command, wait_for_console_pattern +from qemu_test import get_qemu_img, run_cmd + =20 class Aarch64VirtMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' @@ -28,23 +29,18 @@ def wait_for_console_pattern(self, success_message, vm= =3DNone): failure_message=3D'Kernel panic - not syn= cing', vm=3Dvm) =20 + ASSET_ALPINE_ISO =3D Asset( + ('https://dl-cdn.alpinelinux.org/' + 'alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.iso= '), + '5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e19c4bd9dc027') + # This tests the whole boot chain from EFI to Userspace # We only boot a whole OS for the current top level CPU and GIC # Other test profiles should use more minimal boots def test_alpine_virt_tcg_gic_max(self): - """ - :avocado: tags=3Darch:aarch64 - :avocado: tags=3Dmachine:virt - :avocado: tags=3Daccel:tcg - """ - iso_url =3D ( - "https://dl-cdn.alpinelinux.org/" - "alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.= iso" - ) - - iso_hash =3D "5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e= 19c4bd9dc027" - iso_path =3D self.fetch_asset(iso_url, algorithm=3D"sha256", asset= _hash=3Diso_hash) + iso_path =3D self.ASSET_ALPINE_ISO.fetch() =20 + self.set_machine('virt') self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + 'console=3DttyAMA0') @@ -68,6 +64,11 @@ def test_alpine_virt_tcg_gic_max(self): self.wait_for_console_pattern('Welcome to Alpine Linux 3.17') =20 =20 + ASSET_KERNEL =3D Asset( + ('https://fileserver.linaro.org/s/' + 'z6B2ARM7DQT3HWN/download'), + '12a54d4805cda6ab647cb7c7bbdb16fafb3df400e0d6f16445c1a0436100ef8d') + def common_aarch64_virt(self, machine): """ Common code to launch basic virt machine with kernel+initrd @@ -75,11 +76,9 @@ def common_aarch64_virt(self, machine): """ logger =3D logging.getLogger('aarch64_virt') =20 - kernel_url =3D ('https://fileserver.linaro.org/s/' - 'z6B2ARM7DQT3HWN/download') - kernel_hash =3D 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + kernel_path =3D self.ASSET_KERNEL.fetch() =20 + self.set_machine('virt') self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + 'console=3DttyAMA0') @@ -98,14 +97,8 @@ def common_aarch64_virt(self, machine): # Also add a scratch block device logger.info('creating scratch qcow2 image') image_path =3D os.path.join(self.workdir, 'scratch.qcow2') - qemu_img =3D os.path.join(BUILD_DIR, 'qemu-img') - if not os.path.exists(qemu_img): - qemu_img =3D find_command('qemu-img', False) - if qemu_img is False: - self.cancel('Could not find "qemu-img", which is required to ' - 'create the temporary qcow2 image') - cmd =3D '%s create -f qcow2 %s 8M' % (qemu_img, image_path) - process.run(cmd) + qemu_img =3D get_qemu_img(self) + run_cmd([qemu_img, 'create', '-f', 'qcow2', image_path, '8M']) =20 # Add the device self.vm.add_args('-blockdev', @@ -128,19 +121,11 @@ def common_aarch64_virt(self, machine): time.sleep(0.1) =20 def test_aarch64_virt_gicv3(self): - """ - :avocado: tags=3Darch:aarch64 - :avocado: tags=3Dmachine:virt - :avocado: tags=3Daccel:tcg - :avocado: tags=3Dcpu:max - """ self.common_aarch64_virt("virt,gic_version=3D3") =20 def test_aarch64_virt_gicv2(self): - """ - :avocado: tags=3Darch:aarch64 - :avocado: tags=3Dmachine:virt - :avocado: tags=3Daccel:tcg - :avocado: tags=3Dcpu:max - """ self.common_aarch64_virt("virt,gic-version=3D2") + + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025413; cv=none; d=zohomail.com; s=zohoarc; b=cGj0vwjdukJ4Qz/Ap1WIY+9/wki3mQnMfMtyjIT3Mdzh767j8TlJ39PKLQyiWbmr+4edg4jAGClDRN2wn+bWAc8ZzI6hWcyj1uhSjBbx5x885nKV5voLIFKqhKa9JORUvcj6mWnN9FglkfyhGmfRI8YA0Few4rbmtYbh/9fWeCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025413; 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=Xhy1BSCohpIoQg+VSoYYxiPc5WzgWchrjchDtLPRrd8=; b=U/I2ryuK3eL4MoqNc3b3lTj1QvtudgsCEqU5DllYlTYhlv7Wo6J+KTDt6Y1bsgOC1JnghcqXWRtLnsTwUSAAxjDFGHjQ7RN4xUPNmJzSqGKHwzixPZtMpJKScHmhmXNKMNedoaQYEusM/aR2i0jll/ht3MlzqOkfreZ7xPquhUQ= 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 1725025413746225.65526249238098; Fri, 30 Aug 2024 06:43:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sg-0002MY-FM; Fri, 30 Aug 2024 09:41:38 -0400 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 1sk1sd-0001vv-L5 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sb-0005eI-8N for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:35 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-79-pEkHzIXhMfGUtgtG5RdCYw-1; Fri, 30 Aug 2024 09:41:29 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5805619560B4; Fri, 30 Aug 2024 13:41:28 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 48D57300019C; Fri, 30 Aug 2024 13:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xhy1BSCohpIoQg+VSoYYxiPc5WzgWchrjchDtLPRrd8=; b=HdgnZ3+YOfs+H3WQMZBOWdSwtwE3vtWtnNB58pufBZV6G2qsf23ZMLewygC+kI4LmnKCpb n+T9xoxfyXjJ3nKaGXfMc+mtFgBUUk4oDTxxyeqybjQkoCZ1qyE+V7/uXuf/zCn3ftuMzP KqmBq0AQIhEs+Z2aIlWUYwi6jCeVu/w= X-MC-Unique: pEkHzIXhMfGUtgtG5RdCYw-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 36/44] tests/functional: Convert mips64el Fuloong2e avocado test (1/2) Date: Fri, 30 Aug 2024 15:38:30 +0200 Message-ID: <20240830133841.142644-37-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025415334116600 From: Philippe Mathieu-Daud=C3=A9 Straight forward conversion. Update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays. Since the asset is expected locally and the test is guarded with RESCUE_YL_PATH, keep it under the 'quick' category. $ RESCUE_YL_PATH=3D/path/to/rescue-yl QEMU_TEST_ALLOW_UNTRUSTED_CODE=3D1 \ make check-functional-mips64el 1/4 qemu:func-quick+func-mips64el / func-mips64el-empty_cpu_model OK= 0.12s 1 subtests passed 2/4 qemu:func-quick+func-mips64el / func-mips64el-version OK= 0.13s 1 subtests passed 3/4 qemu:func-quick+func-mips64el / func-mips64el-info_usernet OK= 0.15s 1 subtests passed 4/4 qemu:func-quick+func-mips64el / func-mips64el-mips64el_fuloong2e OK= 0.19s 1 subtests passed Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-ID: <20240827094905.80648-2-philmd@linaro.org> Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 4 +++ .../test_mips64el_fuloong2e.py} | 33 ++++++++++--------- 3 files changed, 23 insertions(+), 16 deletions(-) rename tests/{avocado/machine_mips_fuloong2e.py =3D> functional/test_mips6= 4el_fuloong2e.py} (58%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index cbdf2863fa..f6e6e5ebf5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1384,7 +1384,7 @@ S: Odd Fixes F: hw/mips/fuloong2e.c F: hw/pci-host/bonito.c F: include/hw/pci-host/bonito.h -F: tests/avocado/machine_mips_fuloong2e.py +F: tests/functional/test_mips64el_fuloong2e.py =20 Loongson-3 virtual platforms M: Huacai Chen diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 4154b1cbcd..dcede9733e 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -65,6 +65,10 @@ tests_microblazeel_system_thorough =3D [ 'microblazeel_s3adsp1800' ] =20 +tests_mips64el_system_quick =3D [ + 'mips64el_fuloong2e', +] + tests_mips64el_system_thorough =3D [ 'mips64el_loongson3v', ] diff --git a/tests/avocado/machine_mips_fuloong2e.py b/tests/functional/tes= t_mips64el_fuloong2e.py old mode 100644 new mode 100755 similarity index 58% rename from tests/avocado/machine_mips_fuloong2e.py rename to tests/functional/test_mips64el_fuloong2e.py index 89291f47b2..7688a32713 --- a/tests/avocado/machine_mips_fuloong2e.py +++ b/tests/functional/test_mips64el_fuloong2e.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Functional tests for the Lemote Fuloong-2E machine. # # Copyright (c) 2019 Philippe Mathieu-Daud=C3=A9 @@ -8,35 +10,36 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 import os +import subprocess =20 -from avocado import skipUnless -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test import QemuSystemTest +from qemu_test import wait_for_console_pattern +from unittest import skipUnless =20 class MipsFuloong2e(QemuSystemTest): =20 timeout =3D 60 =20 - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') @skipUnless(os.getenv('RESCUE_YL_PATH'), 'RESCUE_YL_PATH not available= ') - def test_linux_kernel_isa_serial(self): - """ - :avocado: tags=3Darch:mips64el - :avocado: tags=3Dmachine:fuloong2e - :avocado: tags=3Dendian:little - :avocado: tags=3Ddevice:bonito64 - :avocado: tags=3Ddevice:via686b - """ + def test_linux_kernel_2_6_27_isa_serial(self): # Recovery system for the Yeeloong laptop # (enough to test the fuloong2e southbridge, accessing its ISA bus) # http://dev.lemote.com/files/resource/download/rescue/rescue-yl - kernel_hash =3D 'ec4d1bd89a8439c41033ca63db60160cc6d6f09a' - kernel_path =3D self.fetch_asset('file://' + os.getenv('RESCUE_YL_= PATH'), - asset_hash=3Dkernel_hash) + sha =3D 'ab588d3316777c62cc81baa20ac92e98b01955c244dff3794b711bc34= e26e51d' + kernel_path =3D os.getenv('RESCUE_YL_PATH') + output =3D subprocess.check_output(['sha256sum', kernel_path]) + checksum =3D output.split()[0] + assert checksum.decode("utf-8") =3D=3D sha =20 + self.set_machine('fuloong2e') self.vm.set_console() self.vm.add_args('-kernel', kernel_path) self.vm.launch() wait_for_console_pattern(self, 'Linux version 2.6.27.7lemote') cpu_revision =3D 'CPU revision is: 00006302 (ICT Loongson-2)' wait_for_console_pattern(self, cpu_revision) + + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025483; cv=none; d=zohomail.com; s=zohoarc; b=PxY+Y7Lq4+OplfG9V3DV2EN5fIrvqebl/6qe8kRpBuLiRITU5/ETnTwRyaHI7NnJrJaJ4+RRXDAI2nBXf9JDKP92OCbcRzHOEEox/Zl8oNJy9YWHeLhD8ELdAcDX+Q3SvE7nBg+IT/TTzOo+9pWVcYRbF78OWMy9UYUbjNWQOK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025483; 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=rD08ZnMTN0VvxHk60UxwJ6iH60cIkpG/1tMMITmmOvQ=; b=jzjamk3FPzeBc8b+rESwdAMXd7rcTMDH/VsSKF3AmEyo7WRgxAOUdZISmRsg2/Mx/i5ZO8oiOy+3S6yXdJZhgxXdudYQ0DpXXbS9SYanhJHI4zJKz3eIcsw7uCUfUubEA25PFcHhPs46/KbeZdrSnffRfMv3sg5679OtQJn5oYk= 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 1725025483028830.6867648857877; Fri, 30 Aug 2024 06:44:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sy-0003lX-Qd; Fri, 30 Aug 2024 09:41:57 -0400 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 1sk1sl-00031T-HD for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sj-0005eb-Br for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:43 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-179-FfptHt0DOI2CIdlRhtrmog-1; Fri, 30 Aug 2024 09:41:36 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 672391955BFA; Fri, 30 Aug 2024 13:41:32 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EBFDF300019C; Fri, 30 Aug 2024 13:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rD08ZnMTN0VvxHk60UxwJ6iH60cIkpG/1tMMITmmOvQ=; b=NIPi/j2N4m7qhYvv1NI5qyQsNuJOJ08S5YefLMJL86nkw1ZhXDCJfQ545PyZUzeexbvfXD ALntPRTrxH32T6w4wKAg7gpSopPu76p70YlYz3GPvbbKuFe46USnNyWpfNt2uI20Mth2xd pWNTQMGKKCXT63azXPMv06vZry2OoCQ= X-MC-Unique: FfptHt0DOI2CIdlRhtrmog-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 37/44] tests/functional: Add QemuUserTest class Date: Fri, 30 Aug 2024 15:38:31 +0200 Message-ID: <20240830133841.142644-38-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025483699116600 From: Philippe Mathieu-Daud=C3=A9 Per commit 5334df4822 ("tests/avocado: Introduce QemuUserTest base class"): Similarly to the 'System' Test base class with methods for testing system emulation, the QemuUserTest class contains methods useful to test user-mode emulation. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20240822104238.75045-2-philmd@linaro.org> Signed-off-by: Thomas Huth --- tests/functional/qemu_test/__init__.py | 2 +- tests/functional/qemu_test/testcase.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu= _test/__init__.py index 1d87d7122f..f33282efe8 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -11,4 +11,4 @@ from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \ interrupt_interactive_console_until_pattern, wait_for_console_pattern,= \ exec_command, exec_command_and_wait_for_pattern, get_qemu_img -from .testcase import QemuSystemTest, QemuBaseTest +from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index 18314be9d1..aa0146265a 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -13,6 +13,7 @@ =20 import logging import os +import subprocess import pycotap import sys import unittest @@ -70,6 +71,22 @@ def main(): unittest.main(module =3D None, testRunner =3D tr, argv=3D["__dummy= __", path]) =20 =20 +class QemuUserTest(QemuBaseTest): + + def setUp(self): + super().setUp('qemu-') + self._ldpath =3D [] + + def add_ldpath(self, ldpath): + self._ldpath.append(os.path.abspath(ldpath)) + + def run_cmd(self, bin_path, args=3D[]): + return subprocess.run([self.qemu_bin] + + ["-L %s" % ldpath for ldpath in self._ldpa= th] + + [bin_path] + + args, + text=3DTrue, capture_output=3DTrue) + class QemuSystemTest(QemuBaseTest): """Facilitates system emulation tests.""" =20 --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025405; cv=none; d=zohomail.com; s=zohoarc; b=VLaV2B9aib8ReC77oiN498kLS5EWnfBwnerfdl495zNuR/ndGApb9Y9OQTBQ8e+CDm9fnaiHfvRWJew2FwfZbaXKZRon9WXaU16kHgrP/droJal4jrUzlIBAS5iu7MBpcplVpC+C3Zvor/uOdKpKoyz/ENvkDu1boN+u7GjQwrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025405; 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=AiCpW9mlrliMsd0sml8PvZbAgZSRZheKGz2GIntE/hc=; b=D/4EXwpl0vXxirZAp3G3PemW9JCmsoxS5NxkglqzahLLAK9bzmPNp+/L4eP62e5yNubhtIzo0jHBMuZsBzIwYXrZ++bmBS3MkQ26BqGg2v+Zs9MExo2odmOkiBs9Z2xferLWl8l24sTLgBDsgBlbaoHz8H2PvpO2EK237eKExlI= 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 1725025405393778.0888048947788; Fri, 30 Aug 2024 06:43:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sz-000463-ME; Fri, 30 Aug 2024 09:41:57 -0400 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 1sk1so-0003Dc-My for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sl-0005em-Hu for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:45 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-3W5w2x5jNKWJQ4ynAB7ctg-1; Fri, 30 Aug 2024 09:41:37 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 34DD31955BF7; Fri, 30 Aug 2024 13:41:36 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BA8503001FE8; Fri, 30 Aug 2024 13:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AiCpW9mlrliMsd0sml8PvZbAgZSRZheKGz2GIntE/hc=; b=CpHjW1nOSUyg54HAzlWVfxQ4/mH2rGvAewWeza0UH2SMsNefmNe4UwmQuJRBDD9/270hGr 34AnDN4RHtdTMyLFOawmJAXGpaZxBsrfRTrHoMxvkvs82C+k0C2Ev0ppIVYgqmKy1w9+tD F11IEB4QfiYL5oQLUiQ2eFiAGe3FMUE= X-MC-Unique: 3W5w2x5jNKWJQ4ynAB7ctg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 38/44] tests/functional: Convert ARM bFLT linux-user avocado test Date: Fri, 30 Aug 2024 15:38:32 +0200 Message-ID: <20240830133841.142644-39-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025407321116600 From: Philippe Mathieu-Daud=C3=A9 Straight forward conversion. Update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays. Expose cpio_extract() in qemu_test.utils for possible reuse. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20240822104238.75045-3-philmd@linaro.org> [thuth: Add test to meson.build] Signed-off-by: Thomas Huth --- tests/avocado/load_bflt.py | 54 ----------------------------- tests/functional/meson.build | 4 +++ tests/functional/qemu_test/utils.py | 9 +++++ tests/functional/test_arm_bflt.py | 44 +++++++++++++++++++++++ 4 files changed, 57 insertions(+), 54 deletions(-) delete mode 100644 tests/avocado/load_bflt.py create mode 100755 tests/functional/test_arm_bflt.py diff --git a/tests/avocado/load_bflt.py b/tests/avocado/load_bflt.py deleted file mode 100644 index bb50cec1ee..0000000000 --- a/tests/avocado/load_bflt.py +++ /dev/null @@ -1,54 +0,0 @@ -# Test the bFLT loader format -# -# Copyright (C) 2019 Philippe Mathieu-Daud=C3=A9 -# -# SPDX-License-Identifier: GPL-2.0-or-later - -import os -import bz2 -import subprocess - -from avocado import skipUnless -from avocado_qemu import QemuUserTest -from avocado_qemu import has_cmd - - -class LoadBFLT(QemuUserTest): - - def extract_cpio(self, cpio_path): - """ - Extracts a cpio archive into the test workdir - - :param cpio_path: path to the cpio archive - """ - cwd =3D os.getcwd() - os.chdir(self.workdir) - with bz2.open(cpio_path, 'rb') as archive_cpio: - subprocess.run(['cpio', '-i'], input=3Darchive_cpio.read(), - stderr=3Dsubprocess.DEVNULL) - os.chdir(cwd) - - @skipUnless(*has_cmd('cpio')) - @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') - def test_stm32(self): - """ - :avocado: tags=3Darch:arm - :avocado: tags=3Dlinux_user - :avocado: tags=3Dquick - """ - # See https://elinux.org/STM32#User_Space - rootfs_url =3D ('https://elinux.org/images/5/51/' - 'Stm32_mini_rootfs.cpio.bz2') - rootfs_hash =3D '9f065e6ba40cce7411ba757f924f30fcc57951e6' - rootfs_path_bz2 =3D self.fetch_asset(rootfs_url, asset_hash=3Droot= fs_hash) - busybox_path =3D os.path.join(self.workdir, "/bin/busybox") - - self.extract_cpio(rootfs_path_bz2) - - res =3D self.run(busybox_path) - ver =3D 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call = binary.' - self.assertIn(ver, res.stdout_text) - - res =3D self.run(busybox_path, ['uname', '-a']) - unm =3D 'armv7l GNU/Linux' - self.assertIn(unm, res.stdout_text) diff --git a/tests/functional/meson.build b/tests/functional/meson.build index dcede9733e..6b00d240dd 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -45,6 +45,10 @@ tests_arm_system_thorough =3D [ 'arm_n8x0', ] =20 +tests_arm_linuxuser_thorough =3D [ + 'arm_bflt', +] + tests_avr_system_thorough =3D [ 'avr_mega2560', ] diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 99eae5fc45..2a1cb60d38 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -12,6 +12,7 @@ import lzma import os import shutil +import subprocess import tarfile =20 def archive_extract(archive, dest_dir, member=3DNone): @@ -45,3 +46,11 @@ def lzma_uncompress(xz_path, output_path): except: os.remove(output_path) raise + +def cpio_extract(cpio_handle, output_path): + cwd =3D os.getcwd() + os.chdir(output_path) + subprocess.run(['cpio', '-i'], + input=3Dcpio_handle.read(), + stderr=3Dsubprocess.DEVNULL) + os.chdir(cwd) diff --git a/tests/functional/test_arm_bflt.py b/tests/functional/test_arm_= bflt.py new file mode 100755 index 0000000000..281925d11a --- /dev/null +++ b/tests/functional/test_arm_bflt.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# +# Test the bFLT loader format +# +# Copyright (C) 2019 Philippe Mathieu-Daud=C3=A9 +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import bz2 + +from qemu_test import QemuUserTest, Asset +from qemu_test import has_cmd +from qemu_test.utils import cpio_extract +from unittest import skipUnless + + +class LoadBFLT(QemuUserTest): + + ASSET_ROOTFS =3D Asset( + ('https://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2'), + 'eefb788e4980c9e8d6c9d60ce7d15d4da6bf4fbc6a80f487673824600d5ba9cc= ') + + @skipUnless(*has_cmd('cpio')) + @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + def test_stm32(self): + # See https://elinux.org/STM32#User_Space + rootfs_path_bz2 =3D self.ASSET_ROOTFS.fetch() + busybox_path =3D os.path.join(self.workdir, "bin/busybox") + + with bz2.open(rootfs_path_bz2, 'rb') as cpio_handle: + cpio_extract(cpio_handle, self.workdir) + + res =3D self.run_cmd(busybox_path) + ver =3D 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call = binary.' + self.assertIn(ver, res.stdout) + + res =3D self.run_cmd(busybox_path, ['uname', '-a']) + unm =3D 'armv7l GNU/Linux' + self.assertIn(unm, res.stdout) + + +if __name__ =3D=3D '__main__': + QemuUserTest.main() --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025471; cv=none; d=zohomail.com; s=zohoarc; b=G/rxGhfwtXg/IjvqRVl+wgD9n3p8kCf5doKDBaCrjHlCzHHIRMqzuxmJfmRVsA3/4h0Pxley0rQ6uszFHgJNZZb0zIEIOw+4GJpetbO2hc3ZtimuNhQjWLYbVzomFeUDUX1h36D9vEMTu2qkqh9ClbiV3ebrrGNgy9865a0I1uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025471; 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=9p0RKHgP9JstxY3TIpZE+KxWklnhkhPn4c1qKdz/V94=; b=LKID53WBD5Kpmex3IrIJopLgEhk8fYII4qN1mTFRyiCILZWc9tWpf68f1Aim+OwhMVRw5Qj27mQse4PMvp6S0oxxL8o8T+BsjtV+THOfwCNcEzspBd3/nh0SqmL0XLtsFKbT4cdf0uhYNOPrHv1z74Vb+En+1jxJbFhIZ/XdhtI= 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 1725025471954617.0086065057661; Fri, 30 Aug 2024 06:44:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1sz-00048G-UT; Fri, 30 Aug 2024 09:41:58 -0400 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 1sk1sp-0003K4-Lu for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1sn-0005ey-70 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:47 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-493-rztWY6CiN8GrrHs7SqQ4Gg-1; Fri, 30 Aug 2024 09:41:41 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EE57D1955D47; Fri, 30 Aug 2024 13:41:39 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A259E3001FEF; Fri, 30 Aug 2024 13:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9p0RKHgP9JstxY3TIpZE+KxWklnhkhPn4c1qKdz/V94=; b=VJ9IngPICBmMglYNFivhMoS/IkQG+460icCNGrTB8Cvl/Mjw/6coXWhRoQ/I1R436K5i9Z TdAiVzdb6TwGpDHLWPlNKWPFn7N/ALOqqxXBBNPEHKt6OKL9JSlij0O0TEoSuRvGDbkeXS pPAjl5FhGX5nd2oqeB9uHUU69nsdUm0= X-MC-Unique: rztWY6CiN8GrrHs7SqQ4Gg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 39/44] tests/avocado: Remove unused QemuUserTest class Date: Fri, 30 Aug 2024 15:38:33 +0200 Message-ID: <20240830133841.142644-40-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025473646116600 From: Philippe Mathieu-Daud=C3=A9 The single test that was using the QemuUserTest class has been converted to the functional test framework. This class is now unused, remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20240822104238.75045-4-philmd@linaro.org> Signed-off-by: Thomas Huth --- tests/avocado/avocado_qemu/__init__.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado= _qemu/__init__.py index ef935614cf..0e4ecea7a0 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -384,23 +384,6 @@ def tearDown(self): super().tearDown() =20 =20 -class QemuUserTest(QemuBaseTest): - """Facilitates user-mode emulation tests.""" - - def setUp(self): - self._ldpath =3D [] - super().setUp('qemu-') - - def add_ldpath(self, ldpath): - self._ldpath.append(os.path.abspath(ldpath)) - - def run(self, bin_path, args=3D[]): - qemu_args =3D " ".join(["-L %s" % ldpath for ldpath in self._ldpat= h]) - bin_args =3D " ".join(args) - return process.run("%s %s %s %s" % (self.qemu_bin, qemu_args, - bin_path, bin_args)) - - class LinuxSSHMixIn: """Contains utility methods for interacting with a guest via SSH.""" =20 --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025461; cv=none; d=zohomail.com; s=zohoarc; b=YsuakYG0aY0rmUGNnCuC7xOiOtngxvD5L0SirfGwIvk4DS/QjYg0RtinvC6kC2k4J47OlZcMtvjzCoEVqZssq0rf1z5U75q/deGWGFfX4YveYzNEQHGPB+oBb/EnyLXfy48sgGlEcPx3yDuG1xIYn3GAnLM8cMvFjusHsXnrOCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025461; 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=3xue2iUuKaEkWVIxZkAAaRbH+DEfH+DQadRwcwSfkR8=; b=Scj/LA0ZDu+nzft0bmJTXVkAiOqMndAKyJeehP/80r2wX690tSklr+K5Yj+3Oh/Ey0P/0sWkcTaM/dM7/GYlYrsHyL5ZIOoy70l2nHWmN+090xZucwSJ5glOqviprlKdMzSkf28gl8zVy1t+KCImFcInW4q6ujca2YoFt+ig5OI= 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 1725025461680470.4486088026621; Fri, 30 Aug 2024 06:44:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1t3-0004jh-H5; Fri, 30 Aug 2024 09:42:01 -0400 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 1sk1ss-0003Td-0X for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1so-0005f9-Mx for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:48 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-FXm55_ZyPsu37if8IAw7Qg-1; Fri, 30 Aug 2024 09:41:44 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C8D311955BEE; Fri, 30 Aug 2024 13:41:43 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B368D3002249; Fri, 30 Aug 2024 13:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3xue2iUuKaEkWVIxZkAAaRbH+DEfH+DQadRwcwSfkR8=; b=ZUyyyBzltN9nM5V4T8rexUvrbcHnVOixWzA7jTpmFz9JoDHitG6tahqXE2ceeNg/1NjCt0 +SyQ9nw6tLlL00NGeaMvHaxz/6ifv8w96F1RfV9NSlTbLLs45BYfcS31CFgqp01nVg0WyZ XOngddL9KOoZJfj36qLpNVXFAVpHt1Q= X-MC-Unique: FXm55_ZyPsu37if8IAw7Qg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 40/44] gitlab-ci: Add "check-functional" to the build tests Date: Fri, 30 Aug 2024 15:38:34 +0200 Message-ID: <20240830133841.142644-41-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025463686116600 Now that we converted many tests from the "check-avocado" test suite to the "check-functional" test suite, we should make sure that these also get tested in the CI. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- .gitlab-ci.d/buildtest-template.yml | 14 +++++-- .gitlab-ci.d/buildtest.yml | 60 ++++++++++++++--------------- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-t= emplate.yml index 844c26623d..5f2fc7e6f4 100644 --- a/.gitlab-ci.d/buildtest-template.yml +++ b/.gitlab-ci.d/buildtest-template.yml @@ -59,6 +59,10 @@ - cd build - find . -type f -exec touch {} + # Avoid recompiling by hiding ninja with NINJA=3D":" + # We also have to pre-cache the functional tests manually in this case + - if [ "x${QEMU_TEST_CACHE_DIR}" !=3D "x" ]; then + $MAKE precache-functional ; + fi - $MAKE NINJA=3D":" $MAKE_CHECK_ARGS =20 .native_test_job_template: @@ -72,12 +76,13 @@ reports: junit: build/meson-logs/testlog.junit.xml =20 -.avocado_test_job_template: +.functional_test_job_template: extends: .common_test_job_template cache: key: "${CI_JOB_NAME}-cache" paths: - ${CI_PROJECT_DIR}/avocado-cache + - ${CI_PROJECT_DIR}/functional-cache policy: pull-push artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" @@ -86,6 +91,7 @@ paths: - build/tests/results/latest/results.xml - build/tests/results/latest/test-results + - build/tests/functional/*/*/*.log reports: junit: build/tests/results/latest/results.xml before_script: @@ -96,11 +102,13 @@ - echo -e '[job.output.testlogs]\nstatuses =3D ["FAIL", "INTERRUPT"]' >> ~/.config/avocado/avocado.conf - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then - du -chs ${CI_PROJECT_DIR}/avocado-cache ; + du -chs ${CI_PROJECT_DIR}/*-cache ; fi - export AVOCADO_ALLOW_UNTRUSTED_CODE=3D1 + - export QEMU_TEST_ALLOW_UNTRUSTED_CODE=3D1 + - export QEMU_TEST_CACHE_DIR=3D${CI_PROJECT_DIR}/functional-cache after_script: - cd build - - du -chs ${CI_PROJECT_DIR}/avocado-cache + - du -chs ${CI_PROJECT_DIR}/*-cache variables: QEMU_JOB_AVOCADO: 1 diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index aa32782405..1d2afae996 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -22,14 +22,14 @@ check-system-alpine: IMAGE: alpine MAKE_CHECK_ARGS: check-unit check-qtest =20 -avocado-system-alpine: - extends: .avocado_test_job_template +functional-system-alpine: + extends: .functional_test_job_template needs: - job: build-system-alpine artifacts: true variables: IMAGE: alpine - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional AVOCADO_TAGS: arch:avr arch:loongarch64 arch:mips64 arch:mipsel =20 build-system-ubuntu: @@ -53,14 +53,14 @@ check-system-ubuntu: IMAGE: ubuntu2204 MAKE_CHECK_ARGS: check =20 -avocado-system-ubuntu: - extends: .avocado_test_job_template +functional-system-ubuntu: + extends: .functional_test_job_template needs: - job: build-system-ubuntu artifacts: true variables: IMAGE: ubuntu2204 - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional AVOCADO_TAGS: arch:alpha arch:microblazeel arch:mips64el =20 build-system-debian: @@ -85,14 +85,14 @@ check-system-debian: IMAGE: debian MAKE_CHECK_ARGS: check =20 -avocado-system-debian: - extends: .avocado_test_job_template +functional-system-debian: + extends: .functional_test_job_template needs: - job: build-system-debian artifacts: true variables: IMAGE: debian - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional AVOCADO_TAGS: arch:arm arch:i386 arch:riscv64 arch:sh4 arch:sparc arch= :xtensa =20 crash-test-debian: @@ -129,14 +129,14 @@ check-system-fedora: IMAGE: fedora MAKE_CHECK_ARGS: check =20 -avocado-system-fedora: - extends: .avocado_test_job_template +functional-system-fedora: + extends: .functional_test_job_template needs: - job: build-system-fedora artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional AVOCADO_TAGS: arch:microblaze arch:mips arch:xtensa arch:m68k arch:riscv32 arch:ppc arch:sparc64 =20 @@ -243,14 +243,14 @@ check-system-centos: IMAGE: centos9 MAKE_CHECK_ARGS: check =20 -avocado-system-centos: - extends: .avocado_test_job_template +functional-system-centos: + extends: .functional_test_job_template needs: - job: build-system-centos artifacts: true variables: IMAGE: centos9 - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx arch:sh4 =20 @@ -274,14 +274,14 @@ check-system-opensuse: IMAGE: opensuse-leap MAKE_CHECK_ARGS: check =20 -avocado-system-opensuse: - extends: .avocado_test_job_template +functional-system-opensuse: + extends: .functional_test_job_template needs: - job: build-system-opensuse artifacts: true variables: IMAGE: opensuse-leap - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional AVOCADO_TAGS: arch:s390x arch:x86_64 arch:aarch64 =20 # @@ -302,15 +302,15 @@ build-system-flaky: ppc64-softmmu rx-softmmu s390x-softmmu sh4-softmmu x86_64-softmmu MAKE_CHECK_ARGS: check-build =20 -avocado-system-flaky: - extends: .avocado_test_job_template +functional-system-flaky: + extends: .functional_test_job_template needs: - job: build-system-flaky artifacts: true allow_failure: true variables: IMAGE: debian - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional QEMU_JOB_OPTIONAL: 1 QEMU_TEST_FLAKY_TESTS: 1 AVOCADO_TAGS: flaky @@ -485,14 +485,14 @@ check-cfi-aarch64: IMAGE: fedora MAKE_CHECK_ARGS: check =20 -avocado-cfi-aarch64: - extends: .avocado_test_job_template +functional-cfi-aarch64: + extends: .functional_test_job_template needs: - job: build-cfi-aarch64 artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional =20 build-cfi-ppc64-s390x: extends: @@ -523,14 +523,14 @@ check-cfi-ppc64-s390x: IMAGE: fedora MAKE_CHECK_ARGS: check =20 -avocado-cfi-ppc64-s390x: - extends: .avocado_test_job_template +functional-cfi-ppc64-s390x: + extends: .functional_test_job_template needs: - job: build-cfi-ppc64-s390x artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional =20 build-cfi-x86_64: extends: @@ -557,14 +557,14 @@ check-cfi-x86_64: IMAGE: fedora MAKE_CHECK_ARGS: check =20 -avocado-cfi-x86_64: - extends: .avocado_test_job_template +functional-cfi-x86_64: + extends: .functional_test_job_template needs: - job: build-cfi-x86_64 artifacts: true variables: IMAGE: fedora - MAKE_CHECK_ARGS: check-avocado + MAKE_CHECK_ARGS: check-avocado check-functional =20 tsan-build: extends: .native_build_job_template --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025354; cv=none; d=zohomail.com; s=zohoarc; b=jLt9o7jLzPmg+6KAyhIZ60/WLLo72bnA8HzHN3acoa7FY61dh3a+q3N8wt+fbOkBTo7VlWXyQK552eaXbtaoaCdUml4cfaLqBdFEJFxfvMnnlrNKXRAXtisF4RrJtj0a/NHGv1u5Wsg7NhashASdBZSEmm39VzVo1VDsEA6Q6qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025354; h=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=mcEgH9LYWJDcmAa9hH6gw18FiSeVNGU6E8/MWL5Wc8U=; b=MB+3+DXdiS6dcGL4MZArXi0uE5FDmFjOSU+6pHD3Z8gIvoOFG2QK7HhOf7LSHmMbSOKTDyb/Sh08uF0/BLaFwRVE9Lnlu03YgNVgCtksTjT/CEnydcjFLqHvm+pF3WVM8vRd1CaYaYQiuTmMJ9DLSAujIZIp+r4yv+EQaUnY4YQ= 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 1725025354734519.065391665312; Fri, 30 Aug 2024 06:42:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1t1-0004RP-L3; Fri, 30 Aug 2024 09:41:59 -0400 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 1sk1sv-0003kv-Ot for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1st-0005fx-CL for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:41:53 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-Z8rJm6nLNHaV34tHtutjdA-1; Fri, 30 Aug 2024 09:41:49 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6AF7119560A2; Fri, 30 Aug 2024 13:41:48 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 88CF4300019C; Fri, 30 Aug 2024 13:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mcEgH9LYWJDcmAa9hH6gw18FiSeVNGU6E8/MWL5Wc8U=; b=czqUqRPxBXXwBsGQKSXapA0SsIfbCJWiR3iuHgqHbVh2Hkw/6eago4iDdH7ugQVWX7fhsy kgXtSAKGRIi8whHL1C7wcfyNyI9W+FVWrP2LofbX6yL0rX5TLHkgGk1PLRCTO+DgH2IjIp dJCTt4Max5oY9VP6H3nnSg+E1BKYMIw= X-MC-Unique: Z8rJm6nLNHaV34tHtutjdA-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 41/44] docs/devel: Split testing docs from the build docs and move to separate folder Date: Fri, 30 Aug 2024 15:38:35 +0200 Message-ID: <20240830133841.142644-42-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025355168116600 Content-Type: text/plain; charset="utf-8" Building and testing are two separate topics, so let's split the testing into a separate category and move the related files into a separate folder. Signed-off-by: Thomas Huth --- docs/devel/index-build.rst | 14 ++++---------- docs/devel/index.rst | 1 + docs/devel/{ =3D> testing}/acpi-bits.rst | 0 docs/devel/{ =3D> testing}/ci-definitions.rst.inc | 0 docs/devel/{ =3D> testing}/ci-jobs.rst.inc | 0 docs/devel/{ =3D> testing}/ci-runners.rst.inc | 0 docs/devel/{ =3D> testing}/ci.rst | 0 docs/devel/{ =3D> testing}/fuzzing.rst | 0 docs/devel/testing/index.rst | 14 ++++++++++++++ docs/devel/{testing.rst =3D> testing/main.rst} | 0 docs/devel/{ =3D> testing}/qgraph.rst | 0 docs/devel/{ =3D> testing}/qtest.rst | 0 12 files changed, 19 insertions(+), 10 deletions(-) rename docs/devel/{ =3D> testing}/acpi-bits.rst (100%) rename docs/devel/{ =3D> testing}/ci-definitions.rst.inc (100%) rename docs/devel/{ =3D> testing}/ci-jobs.rst.inc (100%) rename docs/devel/{ =3D> testing}/ci-runners.rst.inc (100%) rename docs/devel/{ =3D> testing}/ci.rst (100%) rename docs/devel/{ =3D> testing}/fuzzing.rst (100%) create mode 100644 docs/devel/testing/index.rst rename docs/devel/{testing.rst =3D> testing/main.rst} (100%) rename docs/devel/{ =3D> testing}/qgraph.rst (100%) rename docs/devel/{ =3D> testing}/qtest.rst (100%) diff --git a/docs/devel/index-build.rst b/docs/devel/index-build.rst index 90b406ca0e..0023953be3 100644 --- a/docs/devel/index-build.rst +++ b/docs/devel/index-build.rst @@ -1,9 +1,8 @@ -QEMU Build and Test System --------------------------- +QEMU Build System +----------------- =20 -Details about how QEMU's build system works and how it is integrated -into our testing infrastructure. You will need to understand some of -the basics if you are adding new files and targets to the build. +Details about how QEMU's build system works. You will need to understand +some of the basics if you are adding new files and targets to the build. =20 .. toctree:: :maxdepth: 3 @@ -11,10 +10,5 @@ the basics if you are adding new files and targets to th= e build. build-system kconfig docs - testing - acpi-bits - qtest - ci qapi-code-gen - fuzzing control-flow-integrity diff --git a/docs/devel/index.rst b/docs/devel/index.rst index abf60457c2..a53f1bfda5 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -31,6 +31,7 @@ the :ref:`tcg_internals`. =20 index-process index-build + testing/index index-api index-internals index-tcg diff --git a/docs/devel/acpi-bits.rst b/docs/devel/testing/acpi-bits.rst similarity index 100% rename from docs/devel/acpi-bits.rst rename to docs/devel/testing/acpi-bits.rst diff --git a/docs/devel/ci-definitions.rst.inc b/docs/devel/testing/ci-defi= nitions.rst.inc similarity index 100% rename from docs/devel/ci-definitions.rst.inc rename to docs/devel/testing/ci-definitions.rst.inc diff --git a/docs/devel/ci-jobs.rst.inc b/docs/devel/testing/ci-jobs.rst.inc similarity index 100% rename from docs/devel/ci-jobs.rst.inc rename to docs/devel/testing/ci-jobs.rst.inc diff --git a/docs/devel/ci-runners.rst.inc b/docs/devel/testing/ci-runners.= rst.inc similarity index 100% rename from docs/devel/ci-runners.rst.inc rename to docs/devel/testing/ci-runners.rst.inc diff --git a/docs/devel/ci.rst b/docs/devel/testing/ci.rst similarity index 100% rename from docs/devel/ci.rst rename to docs/devel/testing/ci.rst diff --git a/docs/devel/fuzzing.rst b/docs/devel/testing/fuzzing.rst similarity index 100% rename from docs/devel/fuzzing.rst rename to docs/devel/testing/fuzzing.rst diff --git a/docs/devel/testing/index.rst b/docs/devel/testing/index.rst new file mode 100644 index 0000000000..2711fd78b7 --- /dev/null +++ b/docs/devel/testing/index.rst @@ -0,0 +1,14 @@ +Testing QEMU +------------ + +Details about how to test QEMU and how it is integrated into our CI +testing infrastructure. + +.. toctree:: + :maxdepth: 3 + + main + qtest + acpi-bits + ci + fuzzing diff --git a/docs/devel/testing.rst b/docs/devel/testing/main.rst similarity index 100% rename from docs/devel/testing.rst rename to docs/devel/testing/main.rst diff --git a/docs/devel/qgraph.rst b/docs/devel/testing/qgraph.rst similarity index 100% rename from docs/devel/qgraph.rst rename to docs/devel/testing/qgraph.rst diff --git a/docs/devel/qtest.rst b/docs/devel/testing/qtest.rst similarity index 100% rename from docs/devel/qtest.rst rename to docs/devel/testing/qtest.rst --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025399; cv=none; d=zohomail.com; s=zohoarc; b=KC9Avij8+Qs5GnKdUi9W8NHhvQNc5VLQQGgu0y+EfmEq6zB7RhvX49RVWRI0pOmQLH2qeZYL9e5dswkXLUZJ1wOyue2EpgzTOpa2UK3shjWyv1aO8uVlINkAVQEv+EowrLFt+wzjnYBAaFyqaQVt1UPh9w4ZcoGxLmsoapvJ5w8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025399; 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=qp4raF0Mfzg6JUW83+3AtWfxlFuQypweonW8iJA9+E8=; b=UbUq/+ytdkAvaktAO2k/YfnbKmZ1AtHGNVuArmN/pAqC9ESlGwt7VRXo+KfO/TQSZUAVodGVguTYvZxHfz/hlNCAqnc6tcK6YRD9hrOi9PVe2KcFb0xrv6DMsLQkTN2RltAnYsaGrA6/fLebUoTb+zFPr3oZ0oJBQWlWo1rGJDs= 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 1725025399802547.3768297091476; Fri, 30 Aug 2024 06:43:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1t8-0005He-PH; Fri, 30 Aug 2024 09:42:06 -0400 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 1sk1t6-00056m-8I for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:42:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1t1-0005gU-7w for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:42:03 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-0G6DBDPYOkCIlM9epyGrfQ-1; Fri, 30 Aug 2024 09:41:54 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B8AA21955F3D; Fri, 30 Aug 2024 13:41:53 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E18C0300019C; Fri, 30 Aug 2024 13:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025318; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qp4raF0Mfzg6JUW83+3AtWfxlFuQypweonW8iJA9+E8=; b=W1hw62E8neDrwyZ5y4Mh1l6giaC52DPBdcvcF6dpLxFQ1+PMVHme/lWyYv16t0lCIdjSD8 I144vbZjQMgTh79VEtqQL8eVsKUOY7iAJtO3B/QJZ60AJ/2UQYASP+xHt1EUyN/XvmTIX2 6Zuj4eCGve6D6b4Gy+f7XfQez90opIA= X-MC-Unique: 0G6DBDPYOkCIlM9epyGrfQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 42/44] docs/devel/testing: Split the Avocado documentation into a separate file Date: Fri, 30 Aug 2024 15:38:36 +0200 Message-ID: <20240830133841.142644-43-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=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 @redhat.com) X-ZM-MESSAGEID: 1725025401416116600 The main testing documentation file got very overloaded already. Thus let's split the Avocado information into a separate file. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- docs/devel/testing/avocado.rst | 581 +++++++++++++++++++++++++++++++++ docs/devel/testing/index.rst | 1 + docs/devel/testing/main.rst | 565 +------------------------------- 3 files changed, 583 insertions(+), 564 deletions(-) create mode 100644 docs/devel/testing/avocado.rst diff --git a/docs/devel/testing/avocado.rst b/docs/devel/testing/avocado.rst new file mode 100644 index 0000000000..0d207a05c5 --- /dev/null +++ b/docs/devel/testing/avocado.rst @@ -0,0 +1,581 @@ +.. _checkavocado-ref: + + +Integration testing with Avocado +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D + +The ``tests/avocado`` directory hosts integration tests. They're usually +higher level tests, and may interact with external resources and with +various guest operating systems. + +These tests are written using the Avocado Testing Framework (which must +be installed separately) in conjunction with a the ``avocado_qemu.Test`` +class, implemented at ``tests/avocado/avocado_qemu``. + +Tests based on ``avocado_qemu.Test`` can easily: + + * Customize the command line arguments given to the convenience + ``self.vm`` attribute (a QEMUMachine instance) + + * Interact with the QEMU monitor, send QMP commands and check + their results + + * Interact with the guest OS, using the convenience console device + (which may be useful to assert the effectiveness and correctness of + command line arguments or QMP commands) + + * Interact with external data files that accompany the test itself + (see ``self.get_data()``) + + * Download (and cache) remote data files, such as firmware and kernel + images + + * Have access to a library of guest OS images (by means of the + ``avocado.utils.vmimage`` library) + + * Make use of various other test related utilities available at the + test class itself and at the utility library: + + - http://avocado-framework.readthedocs.io/en/latest/api/test/avocado.ht= ml#avocado.Test + - http://avocado-framework.readthedocs.io/en/latest/api/utils/avocado.u= tils.html + +Running tests +------------- + +You can run the avocado tests simply by executing: + +.. code:: + + make check-avocado + +This involves the automatic installation, from PyPI, of all the +necessary avocado-framework dependencies into the QEMU venv within the +build tree (at ``./pyvenv``). Test results are also saved within the +build tree (at ``tests/results``). + +Note: the build environment must be using a Python 3 stack, and have +the ``venv`` and ``pip`` packages installed. If necessary, make sure +``configure`` is called with ``--python=3D`` and that those modules are +available. On Debian and Ubuntu based systems, depending on the +specific version, they may be on packages named ``python3-venv`` and +``python3-pip``. + +It is also possible to run tests based on tags using the +``make check-avocado`` command and the ``AVOCADO_TAGS`` environment +variable: + +.. code:: + + make check-avocado AVOCADO_TAGS=3Dquick + +Note that tags separated with commas have an AND behavior, while tags +separated by spaces have an OR behavior. For more information on Avocado +tags, see: + + https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/t= ags.html + +To run a single test file, a couple of them, or a test within a file +using the ``make check-avocado`` command, set the ``AVOCADO_TESTS`` +environment variable with the test files or test names. To run all +tests from a single file, use: + + .. code:: + + make check-avocado AVOCADO_TESTS=3D$FILEPATH + +The same is valid to run tests from multiple test files: + + .. code:: + + make check-avocado AVOCADO_TESTS=3D'$FILEPATH1 $FILEPATH2' + +To run a single test within a file, use: + + .. code:: + + make check-avocado AVOCADO_TESTS=3D$FILEPATH:$TESTCLASS.$TESTNAME + +The same is valid to run single tests from multiple test files: + + .. code:: + + make check-avocado AVOCADO_TESTS=3D'$FILEPATH1:$TESTCLASS1.$TESTNAME1 $F= ILEPATH2:$TESTCLASS2.$TESTNAME2' + +The scripts installed inside the virtual environment may be used +without an "activation". For instance, the Avocado test runner +may be invoked by running: + + .. code:: + + pyvenv/bin/avocado run $OPTION1 $OPTION2 tests/avocado/ + +Note that if ``make check-avocado`` was not executed before, it is +possible to create the Python virtual environment with the dependencies +needed running: + + .. code:: + + make check-venv + +It is also possible to run tests from a single file or a single test within +a test file. To run tests from a single file within the build tree, use: + + .. code:: + + pyvenv/bin/avocado run tests/avocado/$TESTFILE + +To run a single test within a test file, use: + + .. code:: + + pyvenv/bin/avocado run tests/avocado/$TESTFILE:$TESTCLASS.$TESTNAME + +Valid test names are visible in the output from any previous execution +of Avocado or ``make check-avocado``, and can also be queried using: + + .. code:: + + pyvenv/bin/avocado list tests/avocado + +Manual Installation +------------------- + +To manually install Avocado and its dependencies, run: + +.. code:: + + pip install --user avocado-framework + +Alternatively, follow the instructions on this link: + + https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/= installing.html + +Overview +-------- + +The ``tests/avocado/avocado_qemu`` directory provides the +``avocado_qemu`` Python module, containing the ``avocado_qemu.Test`` +class. Here's a simple usage example: + +.. code:: + + from avocado_qemu import QemuSystemTest + + + class Version(QemuSystemTest): + """ + :avocado: tags=3Dquick + """ + def test_qmp_human_info_version(self): + self.vm.launch() + res =3D self.vm.cmd('human-monitor-command', + command_line=3D'info version') + self.assertRegex(res, r'^(\d+\.\d+\.\d)') + +To execute your test, run: + +.. code:: + + avocado run version.py + +Tests may be classified according to a convention by using docstring +directives such as ``:avocado: tags=3DTAG1,TAG2``. To run all tests +in the current directory, tagged as "quick", run: + +.. code:: + + avocado run -t quick . + +The ``avocado_qemu.Test`` base test class +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``avocado_qemu.Test`` class has a number of characteristics that +are worth being mentioned right away. + +First of all, it attempts to give each test a ready to use QEMUMachine +instance, available at ``self.vm``. Because many tests will tweak the +QEMU command line, launching the QEMUMachine (by using ``self.vm.launch()`= `) +is left to the test writer. + +The base test class has also support for tests with more than one +QEMUMachine. The way to get machines is through the ``self.get_vm()`` +method which will return a QEMUMachine instance. The ``self.get_vm()`` +method accepts arguments that will be passed to the QEMUMachine creation +and also an optional ``name`` attribute so you can identify a specific +machine and get it more than once through the tests methods. A simple +and hypothetical example follows: + +.. code:: + + from avocado_qemu import QemuSystemTest + + + class MultipleMachines(QemuSystemTest): + def test_multiple_machines(self): + first_machine =3D self.get_vm() + second_machine =3D self.get_vm() + self.get_vm(name=3D'third_machine').launch() + + first_machine.launch() + second_machine.launch() + + first_res =3D first_machine.cmd( + 'human-monitor-command', + command_line=3D'info version') + + second_res =3D second_machine.cmd( + 'human-monitor-command', + command_line=3D'info version') + + third_res =3D self.get_vm(name=3D'third_machine').cmd( + 'human-monitor-command', + command_line=3D'info version') + + self.assertEqual(first_res, second_res, third_res) + +At test "tear down", ``avocado_qemu.Test`` handles all the QEMUMachines +shutdown. + +The ``avocado_qemu.LinuxTest`` base test class +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``avocado_qemu.LinuxTest`` is further specialization of the +``avocado_qemu.Test`` class, so it contains all the characteristics of +the later plus some extra features. + +First of all, this base class is intended for tests that need to +interact with a fully booted and operational Linux guest. At this +time, it uses a Fedora 31 guest image. The most basic example looks +like this: + +.. code:: + + from avocado_qemu import LinuxTest + + + class SomeTest(LinuxTest): + + def test(self): + self.launch_and_wait() + self.ssh_command('some_command_to_be_run_in_the_guest') + +Please refer to tests that use ``avocado_qemu.LinuxTest`` under +``tests/avocado`` for more examples. + +QEMUMachine +----------- + +The QEMUMachine API is already widely used in the Python iotests, +device-crash-test and other Python scripts. It's a wrapper around the +execution of a QEMU binary, giving its users: + + * the ability to set command line arguments to be given to the QEMU + binary + + * a ready to use QMP connection and interface, which can be used to + send commands and inspect its results, as well as asynchronous + events + + * convenience methods to set commonly used command line arguments in + a more succinct and intuitive way + +QEMU binary selection +^^^^^^^^^^^^^^^^^^^^^ + +The QEMU binary used for the ``self.vm`` QEMUMachine instance will +primarily depend on the value of the ``qemu_bin`` parameter. If it's +not explicitly set, its default value will be the result of a dynamic +probe in the same source tree. A suitable binary will be one that +targets the architecture matching host machine. + +Based on this description, test writers will usually rely on one of +the following approaches: + +1) Set ``qemu_bin``, and use the given binary + +2) Do not set ``qemu_bin``, and use a QEMU binary named like + "qemu-system-${arch}", either in the current + working directory, or in the current source tree. + +The resulting ``qemu_bin`` value will be preserved in the +``avocado_qemu.Test`` as an attribute with the same name. + +Attribute reference +------------------- + +Test +^^^^ + +Besides the attributes and methods that are part of the base +``avocado.Test`` class, the following attributes are available on any +``avocado_qemu.Test`` instance. + +vm +"" + +A QEMUMachine instance, initially configured according to the given +``qemu_bin`` parameter. + +arch +"""" + +The architecture can be used on different levels of the stack, e.g. by +the framework or by the test itself. At the framework level, it will +currently influence the selection of a QEMU binary (when one is not +explicitly given). + +Tests are also free to use this attribute value, for their own needs. +A test may, for instance, use the same value when selecting the +architecture of a kernel or disk image to boot a VM with. + +The ``arch`` attribute will be set to the test parameter of the same +name. If one is not given explicitly, it will either be set to +``None``, or, if the test is tagged with one (and only one) +``:avocado: tags=3Darch:VALUE`` tag, it will be set to ``VALUE``. + +cpu +""" + +The cpu model that will be set to all QEMUMachine instances created +by the test. + +The ``cpu`` attribute will be set to the test parameter of the same +name. If one is not given explicitly, it will either be set to +``None ``, or, if the test is tagged with one (and only one) +``:avocado: tags=3Dcpu:VALUE`` tag, it will be set to ``VALUE``. + +machine +""""""" + +The machine type that will be set to all QEMUMachine instances created +by the test. + +The ``machine`` attribute will be set to the test parameter of the same +name. If one is not given explicitly, it will either be set to +``None``, or, if the test is tagged with one (and only one) +``:avocado: tags=3Dmachine:VALUE`` tag, it will be set to ``VALUE``. + +qemu_bin +"""""""" + +The preserved value of the ``qemu_bin`` parameter or the result of the +dynamic probe for a QEMU binary in the current working directory or +source tree. + +LinuxTest +^^^^^^^^^ + +Besides the attributes present on the ``avocado_qemu.Test`` base +class, the ``avocado_qemu.LinuxTest`` adds the following attributes: + +distro +"""""" + +The name of the Linux distribution used as the guest image for the +test. The name should match the **Provider** column on the list +of images supported by the avocado.utils.vmimage library: + +https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images + +distro_version +"""""""""""""" + +The version of the Linux distribution as the guest image for the +test. The name should match the **Version** column on the list +of images supported by the avocado.utils.vmimage library: + +https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images + +distro_checksum +""""""""""""""" + +The sha256 hash of the guest image file used for the test. + +If this value is not set in the code or by a test parameter (with the +same name), no validation on the integrity of the image will be +performed. + +Parameter reference +------------------- + +To understand how Avocado parameters are accessed by tests, and how +they can be passed to tests, please refer to:: + + https://avocado-framework.readthedocs.io/en/latest/guides/writer/chapter= s/writing.html#accessing-test-parameters + +Parameter values can be easily seen in the log files, and will look +like the following: + +.. code:: + + PARAMS (key=3Dqemu_bin, path=3D*, default=3D./qemu-system-x86_64) =3D> '= ./qemu-system-x86_64 + +Test +^^^^ + +arch +"""" + +The architecture that will influence the selection of a QEMU binary +(when one is not explicitly given). + +Tests are also free to use this parameter value, for their own needs. +A test may, for instance, use the same value when selecting the +architecture of a kernel or disk image to boot a VM with. + +This parameter has a direct relation with the ``arch`` attribute. If +not given, it will default to None. + +cpu +""" + +The cpu model that will be set to all QEMUMachine instances created +by the test. + +machine +""""""" + +The machine type that will be set to all QEMUMachine instances created +by the test. + +qemu_bin +"""""""" + +The exact QEMU binary to be used on QEMUMachine. + +LinuxTest +^^^^^^^^^ + +Besides the parameters present on the ``avocado_qemu.Test`` base +class, the ``avocado_qemu.LinuxTest`` adds the following parameters: + +distro +"""""" + +The name of the Linux distribution used as the guest image for the +test. The name should match the **Provider** column on the list +of images supported by the avocado.utils.vmimage library: + +https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images + +distro_version +"""""""""""""" + +The version of the Linux distribution as the guest image for the +test. The name should match the **Version** column on the list +of images supported by the avocado.utils.vmimage library: + +https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images + +distro_checksum +""""""""""""""" + +The sha256 hash of the guest image file used for the test. + +If this value is not set in the code or by this parameter no +validation on the integrity of the image will be performed. + +Skipping tests +-------------- + +The Avocado framework provides Python decorators which allow for easily sk= ip +tests running under certain conditions. For example, on the lack of a bina= ry +on the test system or when the running environment is a CI system. For fur= ther +information about those decorators, please refer to:: + + https://avocado-framework.readthedocs.io/en/latest/guides/writer/chapter= s/writing.html#skipping-tests + +While the conditions for skipping tests are often specifics of each one, t= here +are recurring scenarios identified by the QEMU developers and the use of +environment variables became a kind of standard way to enable/disable test= s. + +Here is a list of the most used variables: + +AVOCADO_ALLOW_LARGE_STORAGE +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Tests which are going to fetch or produce assets considered *large* are not +going to run unless that ``AVOCADO_ALLOW_LARGE_STORAGE=3D1`` is exported on +the environment. + +The definition of *large* is a bit arbitrary here, but it usually means an +asset which occupies at least 1GB of size on disk when uncompressed. + +SPEED +^^^^^ +Tests which have a long runtime will not be run unless ``SPEED=3Dslow`` is +exported on the environment. + +The definition of *long* is a bit arbitrary here, and it depends on the +usefulness of the test too. A unique test is worth spending more time on, +small variations on existing tests perhaps less so. As a rough guide, +a test or set of similar tests which take more than 100 seconds to +complete. + +AVOCADO_ALLOW_UNTRUSTED_CODE +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +There are tests which will boot a kernel image or firmware that can be +considered not safe to run on the developer's workstation, thus they are +skipped by default. The definition of *not safe* is also arbitrary but +usually it means a blob which either its source or build process aren't +public available. + +You should export ``AVOCADO_ALLOW_UNTRUSTED_CODE=3D1`` on the environment = in +order to allow tests which make use of those kind of assets. + +AVOCADO_TIMEOUT_EXPECTED +^^^^^^^^^^^^^^^^^^^^^^^^ +The Avocado framework has a timeout mechanism which interrupts tests to av= oid the +test suite of getting stuck. The timeout value can be set via test paramet= er or +property defined in the test class, for further details:: + + https://avocado-framework.readthedocs.io/en/latest/guides/writer/chapter= s/writing.html#setting-a-test-timeout + +Even though the timeout can be set by the test developer, there are some t= ests +that may not have a well-defined limit of time to finish under certain +conditions. For example, tests that take longer to execute when QEMU is +compiled with debug flags. Therefore, the ``AVOCADO_TIMEOUT_EXPECTED`` var= iable +has been used to determine whether those tests should run or not. + +QEMU_TEST_FLAKY_TESTS +^^^^^^^^^^^^^^^^^^^^^ +Some tests are not working reliably and thus are disabled by default. +This includes tests that don't run reliably on GitLab's CI which +usually expose real issues that are rarely seen on developer machines +due to the constraints of the CI environment. If you encounter a +similar situation then raise a bug and then mark the test as shown on +the code snippet below: + +.. code:: + + # See https://gitlab.com/qemu-project/qemu/-/issues/nnnn + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on Git= Lab') + def test(self): + do_something() + +You can also add ``:avocado: tags=3Dflaky`` to the test meta-data so +only the flaky tests can be run as a group: + +.. code:: + + env QEMU_TEST_FLAKY_TESTS=3D1 ./pyvenv/bin/avocado \ + run tests/avocado -filter-by-tags=3Dflaky + +Tests should not live in this state forever and should either be fixed +or eventually removed. + + +Uninstalling Avocado +-------------------- + +If you've followed the manual installation instructions above, you can +easily uninstall Avocado. Start by listing the packages you have +installed:: + + pip list --user + +And remove any package you want with:: + + pip uninstall + +If you've used ``make check-avocado``, the Python virtual environment where +Avocado is installed will be cleaned up as part of ``make check-clean``. diff --git a/docs/devel/testing/index.rst b/docs/devel/testing/index.rst index 2711fd78b7..cdf7ba1f8b 100644 --- a/docs/devel/testing/index.rst +++ b/docs/devel/testing/index.rst @@ -9,6 +9,7 @@ testing infrastructure. =20 main qtest + avocado acpi-bits ci fuzzing diff --git a/docs/devel/testing/main.rst b/docs/devel/testing/main.rst index af73d3d64f..39b965ecf6 100644 --- a/docs/devel/testing/main.rst +++ b/docs/devel/testing/main.rst @@ -869,577 +869,14 @@ The ``tests/avocado`` directory hosts integration te= sts. They're usually higher level tests, and may interact with external resources and with various guest operating systems. =20 -These tests are written using the Avocado Testing Framework (which must -be installed separately) in conjunction with a the ``avocado_qemu.Test`` -class, implemented at ``tests/avocado/avocado_qemu``. - -Tests based on ``avocado_qemu.Test`` can easily: - - * Customize the command line arguments given to the convenience - ``self.vm`` attribute (a QEMUMachine instance) - - * Interact with the QEMU monitor, send QMP commands and check - their results - - * Interact with the guest OS, using the convenience console device - (which may be useful to assert the effectiveness and correctness of - command line arguments or QMP commands) - - * Interact with external data files that accompany the test itself - (see ``self.get_data()``) - - * Download (and cache) remote data files, such as firmware and kernel - images - - * Have access to a library of guest OS images (by means of the - ``avocado.utils.vmimage`` library) - - * Make use of various other test related utilities available at the - test class itself and at the utility library: - - - http://avocado-framework.readthedocs.io/en/latest/api/test/avocado.ht= ml#avocado.Test - - http://avocado-framework.readthedocs.io/en/latest/api/utils/avocado.u= tils.html - -Running tests -~~~~~~~~~~~~~ - You can run the avocado tests simply by executing: =20 .. code:: =20 make check-avocado =20 -This involves the automatic installation, from PyPI, of all the -necessary avocado-framework dependencies into the QEMU venv within the -build tree (at ``./pyvenv``). Test results are also saved within the -build tree (at ``tests/results``). - -Note: the build environment must be using a Python 3 stack, and have -the ``venv`` and ``pip`` packages installed. If necessary, make sure -``configure`` is called with ``--python=3D`` and that those modules are -available. On Debian and Ubuntu based systems, depending on the -specific version, they may be on packages named ``python3-venv`` and -``python3-pip``. - -It is also possible to run tests based on tags using the -``make check-avocado`` command and the ``AVOCADO_TAGS`` environment -variable: - -.. code:: - - make check-avocado AVOCADO_TAGS=3Dquick - -Note that tags separated with commas have an AND behavior, while tags -separated by spaces have an OR behavior. For more information on Avocado -tags, see: - - https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/t= ags.html - -To run a single test file, a couple of them, or a test within a file -using the ``make check-avocado`` command, set the ``AVOCADO_TESTS`` -environment variable with the test files or test names. To run all -tests from a single file, use: - - .. code:: - - make check-avocado AVOCADO_TESTS=3D$FILEPATH - -The same is valid to run tests from multiple test files: - - .. code:: - - make check-avocado AVOCADO_TESTS=3D'$FILEPATH1 $FILEPATH2' - -To run a single test within a file, use: - - .. code:: - - make check-avocado AVOCADO_TESTS=3D$FILEPATH:$TESTCLASS.$TESTNAME - -The same is valid to run single tests from multiple test files: - - .. code:: - - make check-avocado AVOCADO_TESTS=3D'$FILEPATH1:$TESTCLASS1.$TESTNAME1 $F= ILEPATH2:$TESTCLASS2.$TESTNAME2' - -The scripts installed inside the virtual environment may be used -without an "activation". For instance, the Avocado test runner -may be invoked by running: - - .. code:: - - pyvenv/bin/avocado run $OPTION1 $OPTION2 tests/avocado/ - -Note that if ``make check-avocado`` was not executed before, it is -possible to create the Python virtual environment with the dependencies -needed running: - - .. code:: - - make check-venv - -It is also possible to run tests from a single file or a single test within -a test file. To run tests from a single file within the build tree, use: - - .. code:: - - pyvenv/bin/avocado run tests/avocado/$TESTFILE - -To run a single test within a test file, use: - - .. code:: - - pyvenv/bin/avocado run tests/avocado/$TESTFILE:$TESTCLASS.$TESTNAME - -Valid test names are visible in the output from any previous execution -of Avocado or ``make check-avocado``, and can also be queried using: - - .. code:: - - pyvenv/bin/avocado list tests/avocado - -Manual Installation -~~~~~~~~~~~~~~~~~~~ - -To manually install Avocado and its dependencies, run: - -.. code:: - - pip install --user avocado-framework - -Alternatively, follow the instructions on this link: - - https://avocado-framework.readthedocs.io/en/latest/guides/user/chapters/= installing.html - -Overview -~~~~~~~~ - -The ``tests/avocado/avocado_qemu`` directory provides the -``avocado_qemu`` Python module, containing the ``avocado_qemu.Test`` -class. Here's a simple usage example: - -.. code:: - - from avocado_qemu import QemuSystemTest - - - class Version(QemuSystemTest): - """ - :avocado: tags=3Dquick - """ - def test_qmp_human_info_version(self): - self.vm.launch() - res =3D self.vm.cmd('human-monitor-command', - command_line=3D'info version') - self.assertRegex(res, r'^(\d+\.\d+\.\d)') - -To execute your test, run: - -.. code:: - - avocado run version.py - -Tests may be classified according to a convention by using docstring -directives such as ``:avocado: tags=3DTAG1,TAG2``. To run all tests -in the current directory, tagged as "quick", run: - -.. code:: - - avocado run -t quick . - -The ``avocado_qemu.Test`` base test class -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The ``avocado_qemu.Test`` class has a number of characteristics that -are worth being mentioned right away. - -First of all, it attempts to give each test a ready to use QEMUMachine -instance, available at ``self.vm``. Because many tests will tweak the -QEMU command line, launching the QEMUMachine (by using ``self.vm.launch()`= `) -is left to the test writer. - -The base test class has also support for tests with more than one -QEMUMachine. The way to get machines is through the ``self.get_vm()`` -method which will return a QEMUMachine instance. The ``self.get_vm()`` -method accepts arguments that will be passed to the QEMUMachine creation -and also an optional ``name`` attribute so you can identify a specific -machine and get it more than once through the tests methods. A simple -and hypothetical example follows: - -.. code:: - - from avocado_qemu import QemuSystemTest - - - class MultipleMachines(QemuSystemTest): - def test_multiple_machines(self): - first_machine =3D self.get_vm() - second_machine =3D self.get_vm() - self.get_vm(name=3D'third_machine').launch() - - first_machine.launch() - second_machine.launch() - - first_res =3D first_machine.cmd( - 'human-monitor-command', - command_line=3D'info version') - - second_res =3D second_machine.cmd( - 'human-monitor-command', - command_line=3D'info version') - - third_res =3D self.get_vm(name=3D'third_machine').cmd( - 'human-monitor-command', - command_line=3D'info version') - - self.assertEqual(first_res, second_res, third_res) - -At test "tear down", ``avocado_qemu.Test`` handles all the QEMUMachines -shutdown. - -The ``avocado_qemu.LinuxTest`` base test class -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The ``avocado_qemu.LinuxTest`` is further specialization of the -``avocado_qemu.Test`` class, so it contains all the characteristics of -the later plus some extra features. - -First of all, this base class is intended for tests that need to -interact with a fully booted and operational Linux guest. At this -time, it uses a Fedora 31 guest image. The most basic example looks -like this: - -.. code:: - - from avocado_qemu import LinuxTest - - - class SomeTest(LinuxTest): - - def test(self): - self.launch_and_wait() - self.ssh_command('some_command_to_be_run_in_the_guest') - -Please refer to tests that use ``avocado_qemu.LinuxTest`` under -``tests/avocado`` for more examples. - -QEMUMachine -~~~~~~~~~~~ - -The QEMUMachine API is already widely used in the Python iotests, -device-crash-test and other Python scripts. It's a wrapper around the -execution of a QEMU binary, giving its users: - - * the ability to set command line arguments to be given to the QEMU - binary - - * a ready to use QMP connection and interface, which can be used to - send commands and inspect its results, as well as asynchronous - events - - * convenience methods to set commonly used command line arguments in - a more succinct and intuitive way - -QEMU binary selection -^^^^^^^^^^^^^^^^^^^^^ - -The QEMU binary used for the ``self.vm`` QEMUMachine instance will -primarily depend on the value of the ``qemu_bin`` parameter. If it's -not explicitly set, its default value will be the result of a dynamic -probe in the same source tree. A suitable binary will be one that -targets the architecture matching host machine. - -Based on this description, test writers will usually rely on one of -the following approaches: - -1) Set ``qemu_bin``, and use the given binary - -2) Do not set ``qemu_bin``, and use a QEMU binary named like - "qemu-system-${arch}", either in the current - working directory, or in the current source tree. - -The resulting ``qemu_bin`` value will be preserved in the -``avocado_qemu.Test`` as an attribute with the same name. - -Attribute reference -~~~~~~~~~~~~~~~~~~~ - -Test -^^^^ - -Besides the attributes and methods that are part of the base -``avocado.Test`` class, the following attributes are available on any -``avocado_qemu.Test`` instance. - -vm -'' - -A QEMUMachine instance, initially configured according to the given -``qemu_bin`` parameter. - -arch -'''' - -The architecture can be used on different levels of the stack, e.g. by -the framework or by the test itself. At the framework level, it will -currently influence the selection of a QEMU binary (when one is not -explicitly given). - -Tests are also free to use this attribute value, for their own needs. -A test may, for instance, use the same value when selecting the -architecture of a kernel or disk image to boot a VM with. - -The ``arch`` attribute will be set to the test parameter of the same -name. If one is not given explicitly, it will either be set to -``None``, or, if the test is tagged with one (and only one) -``:avocado: tags=3Darch:VALUE`` tag, it will be set to ``VALUE``. - -cpu -''' - -The cpu model that will be set to all QEMUMachine instances created -by the test. - -The ``cpu`` attribute will be set to the test parameter of the same -name. If one is not given explicitly, it will either be set to -``None ``, or, if the test is tagged with one (and only one) -``:avocado: tags=3Dcpu:VALUE`` tag, it will be set to ``VALUE``. - -machine -''''''' - -The machine type that will be set to all QEMUMachine instances created -by the test. - -The ``machine`` attribute will be set to the test parameter of the same -name. If one is not given explicitly, it will either be set to -``None``, or, if the test is tagged with one (and only one) -``:avocado: tags=3Dmachine:VALUE`` tag, it will be set to ``VALUE``. - -qemu_bin -'''''''' - -The preserved value of the ``qemu_bin`` parameter or the result of the -dynamic probe for a QEMU binary in the current working directory or -source tree. - -LinuxTest -^^^^^^^^^ - -Besides the attributes present on the ``avocado_qemu.Test`` base -class, the ``avocado_qemu.LinuxTest`` adds the following attributes: - -distro -'''''' - -The name of the Linux distribution used as the guest image for the -test. The name should match the **Provider** column on the list -of images supported by the avocado.utils.vmimage library: - -https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images - -distro_version -'''''''''''''' - -The version of the Linux distribution as the guest image for the -test. The name should match the **Version** column on the list -of images supported by the avocado.utils.vmimage library: - -https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images - -distro_checksum -''''''''''''''' - -The sha256 hash of the guest image file used for the test. - -If this value is not set in the code or by a test parameter (with the -same name), no validation on the integrity of the image will be -performed. - -Parameter reference -~~~~~~~~~~~~~~~~~~~ - -To understand how Avocado parameters are accessed by tests, and how -they can be passed to tests, please refer to:: - - https://avocado-framework.readthedocs.io/en/latest/guides/writer/chapter= s/writing.html#accessing-test-parameters - -Parameter values can be easily seen in the log files, and will look -like the following: - -.. code:: - - PARAMS (key=3Dqemu_bin, path=3D*, default=3D./qemu-system-x86_64) =3D> '= ./qemu-system-x86_64 - -Test -^^^^ - -arch -'''' - -The architecture that will influence the selection of a QEMU binary -(when one is not explicitly given). - -Tests are also free to use this parameter value, for their own needs. -A test may, for instance, use the same value when selecting the -architecture of a kernel or disk image to boot a VM with. - -This parameter has a direct relation with the ``arch`` attribute. If -not given, it will default to None. - -cpu -''' - -The cpu model that will be set to all QEMUMachine instances created -by the test. - -machine -''''''' - -The machine type that will be set to all QEMUMachine instances created -by the test. - -qemu_bin -'''''''' - -The exact QEMU binary to be used on QEMUMachine. - -LinuxTest -^^^^^^^^^ - -Besides the parameters present on the ``avocado_qemu.Test`` base -class, the ``avocado_qemu.LinuxTest`` adds the following parameters: - -distro -'''''' - -The name of the Linux distribution used as the guest image for the -test. The name should match the **Provider** column on the list -of images supported by the avocado.utils.vmimage library: - -https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images - -distro_version -'''''''''''''' - -The version of the Linux distribution as the guest image for the -test. The name should match the **Version** column on the list -of images supported by the avocado.utils.vmimage library: - -https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmim= age.html#supported-images - -distro_checksum -''''''''''''''' - -The sha256 hash of the guest image file used for the test. - -If this value is not set in the code or by this parameter no -validation on the integrity of the image will be performed. - -Skipping tests -~~~~~~~~~~~~~~ - -The Avocado framework provides Python decorators which allow for easily sk= ip -tests running under certain conditions. For example, on the lack of a bina= ry -on the test system or when the running environment is a CI system. For fur= ther -information about those decorators, please refer to:: - - https://avocado-framework.readthedocs.io/en/latest/guides/writer/chapter= s/writing.html#skipping-tests - -While the conditions for skipping tests are often specifics of each one, t= here -are recurring scenarios identified by the QEMU developers and the use of -environment variables became a kind of standard way to enable/disable test= s. - -Here is a list of the most used variables: - -AVOCADO_ALLOW_LARGE_STORAGE -^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Tests which are going to fetch or produce assets considered *large* are not -going to run unless that ``AVOCADO_ALLOW_LARGE_STORAGE=3D1`` is exported on -the environment. - -The definition of *large* is a bit arbitrary here, but it usually means an -asset which occupies at least 1GB of size on disk when uncompressed. - -SPEED -^^^^^ -Tests which have a long runtime will not be run unless ``SPEED=3Dslow`` is -exported on the environment. - -The definition of *long* is a bit arbitrary here, and it depends on the -usefulness of the test too. A unique test is worth spending more time on, -small variations on existing tests perhaps less so. As a rough guide, -a test or set of similar tests which take more than 100 seconds to -complete. - -AVOCADO_ALLOW_UNTRUSTED_CODE -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -There are tests which will boot a kernel image or firmware that can be -considered not safe to run on the developer's workstation, thus they are -skipped by default. The definition of *not safe* is also arbitrary but -usually it means a blob which either its source or build process aren't -public available. - -You should export ``AVOCADO_ALLOW_UNTRUSTED_CODE=3D1`` on the environment = in -order to allow tests which make use of those kind of assets. - -AVOCADO_TIMEOUT_EXPECTED -^^^^^^^^^^^^^^^^^^^^^^^^ -The Avocado framework has a timeout mechanism which interrupts tests to av= oid the -test suite of getting stuck. The timeout value can be set via test paramet= er or -property defined in the test class, for further details:: - - https://avocado-framework.readthedocs.io/en/latest/guides/writer/chapter= s/writing.html#setting-a-test-timeout - -Even though the timeout can be set by the test developer, there are some t= ests -that may not have a well-defined limit of time to finish under certain -conditions. For example, tests that take longer to execute when QEMU is -compiled with debug flags. Therefore, the ``AVOCADO_TIMEOUT_EXPECTED`` var= iable -has been used to determine whether those tests should run or not. - -QEMU_TEST_FLAKY_TESTS -^^^^^^^^^^^^^^^^^^^^^ -Some tests are not working reliably and thus are disabled by default. -This includes tests that don't run reliably on GitLab's CI which -usually expose real issues that are rarely seen on developer machines -due to the constraints of the CI environment. If you encounter a -similar situation then raise a bug and then mark the test as shown on -the code snippet below: - -.. code:: - - # See https://gitlab.com/qemu-project/qemu/-/issues/nnnn - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on Git= Lab') - def test(self): - do_something() - -You can also add ``:avocado: tags=3Dflaky`` to the test meta-data so -only the flaky tests can be run as a group: - -.. code:: - - env QEMU_TEST_FLAKY_TESTS=3D1 ./pyvenv/bin/avocado \ - run tests/avocado -filter-by-tags=3Dflaky - -Tests should not live in this state forever and should either be fixed -or eventually removed. - - -Uninstalling Avocado -~~~~~~~~~~~~~~~~~~~~ - -If you've followed the manual installation instructions above, you can -easily uninstall Avocado. Start by listing the packages you have -installed:: - - pip list --user - -And remove any package you want with:: - - pip uninstall +See :ref:`checkavocado-ref` for more details. =20 -If you've used ``make check-avocado``, the Python virtual environment where -Avocado is installed will be cleaned up as part of ``make check-clean``. =20 .. _checktcg-ref: =20 --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025474; cv=none; d=zohomail.com; s=zohoarc; b=AArWOUlHludXF/Gs0OlSPhVvcR8XwU2tlHKC3rW52nD6luGVhxyr8VB8RHCAaZAbCRXWcX+gQhPyQV2mQdjBhWTsDM6uvM40mjMJErD8fijI+anIUs2pCzBNuHPE9XvoxBruKnpGrpuJTJQEE0ym5ZqOHWs7xudWE1mqyUbpGQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025474; 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=QkhJavEe0X0q0yUh49xPwf3nJaS3G+VwicrY9S8SqGo=; b=cnwvKnk9Rb8rmIdL06K8ByvL7lV57x9QvHNqiZKbOQ4JtiHaKP/6l3XDpT9Q/O8Joh1Hb8wdKJfE1WSn5r2LG4kTbDJBg+7VzxTuwjSDXVX49bYHVxiXEAm/2urTdX4aFPr+uHgpUSZXVnOyEFPgzgMymTCttkd3/ITuJVWwuWg= 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 1725025474205992.1233279313317; Fri, 30 Aug 2024 06:44:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1t7-0005D5-6b; Fri, 30 Aug 2024 09:42:05 -0400 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 1sk1t5-0004zR-70 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:42:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1t3-0005gZ-4R for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:42:02 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-0vorLHPHOR-xvx6HduCGIg-1; Fri, 30 Aug 2024 09:41:59 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2B7341955F2D; Fri, 30 Aug 2024 13:41:58 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3EF0C300019C; Fri, 30 Aug 2024 13:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QkhJavEe0X0q0yUh49xPwf3nJaS3G+VwicrY9S8SqGo=; b=dxPTwxkVRTh3fiGoG/DyWoL5svGyus8KyF3R5eaEXbUO8jXaht/eWCKUKmuFopD0PlrquT a0uUJGsbA7KhtJPsFdhvTFVhDBj54+uGaN6JVszuRrUk0CeC6fFYKJR1XyPXNphQ052Jip 6gKwKz5AwjnelNQAlZ21GTv0/PhFeEQ= X-MC-Unique: 0vorLHPHOR-xvx6HduCGIg-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 43/44] docs/devel/testing: Rename avocado_qemu.Test class Date: Fri, 30 Aug 2024 15:38:37 +0200 Message-ID: <20240830133841.142644-44-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1725025475720116600 The avocado_qemu.Test class has been renamed a while back in commit 2283b627bc ("tests/avocado: Rename avocado_qemu.Test -> QemuSystemTest"), so we should reflect this now in the documentation, too. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- docs/devel/testing/avocado.rst | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/devel/testing/avocado.rst b/docs/devel/testing/avocado.rst index 0d207a05c5..eda76fe2db 100644 --- a/docs/devel/testing/avocado.rst +++ b/docs/devel/testing/avocado.rst @@ -8,11 +8,11 @@ The ``tests/avocado`` directory hosts integration tests. = They're usually higher level tests, and may interact with external resources and with various guest operating systems. =20 -These tests are written using the Avocado Testing Framework (which must -be installed separately) in conjunction with a the ``avocado_qemu.Test`` +These tests are written using the Avocado Testing Framework (which must be +installed separately) in conjunction with a the ``avocado_qemu.QemuSystemT= est`` class, implemented at ``tests/avocado/avocado_qemu``. =20 -Tests based on ``avocado_qemu.Test`` can easily: +Tests based on ``avocado_qemu.QemuSystemTest`` can easily: =20 * Customize the command line arguments given to the convenience ``self.vm`` attribute (a QEMUMachine instance) @@ -154,7 +154,7 @@ Overview -------- =20 The ``tests/avocado/avocado_qemu`` directory provides the -``avocado_qemu`` Python module, containing the ``avocado_qemu.Test`` +``avocado_qemu`` Python module, containing the ``avocado_qemu.QemuSystemTe= st`` class. Here's a simple usage example: =20 .. code:: @@ -186,11 +186,11 @@ in the current directory, tagged as "quick", run: =20 avocado run -t quick . =20 -The ``avocado_qemu.Test`` base test class -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The ``avocado_qemu.QemuSystemTest`` base test class +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ =20 -The ``avocado_qemu.Test`` class has a number of characteristics that -are worth being mentioned right away. +The ``avocado_qemu.QemuSystemTest`` class has a number of characteristics +that are worth being mentioned right away. =20 First of all, it attempts to give each test a ready to use QEMUMachine instance, available at ``self.vm``. Because many tests will tweak the @@ -233,15 +233,15 @@ and hypothetical example follows: =20 self.assertEqual(first_res, second_res, third_res) =20 -At test "tear down", ``avocado_qemu.Test`` handles all the QEMUMachines -shutdown. +At test "tear down", ``avocado_qemu.QemuSystemTest`` handles all the +QEMUMachines shutdown. =20 The ``avocado_qemu.LinuxTest`` base test class ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ =20 The ``avocado_qemu.LinuxTest`` is further specialization of the -``avocado_qemu.Test`` class, so it contains all the characteristics of -the later plus some extra features. +``avocado_qemu.QemuSystemTest`` class, so it contains all the characterist= ics +of the later plus some extra features. =20 First of all, this base class is intended for tests that need to interact with a fully booted and operational Linux guest. At this @@ -298,7 +298,7 @@ the following approaches: working directory, or in the current source tree. =20 The resulting ``qemu_bin`` value will be preserved in the -``avocado_qemu.Test`` as an attribute with the same name. +``avocado_qemu.QemuSystemTest`` as an attribute with the same name. =20 Attribute reference ------------------- @@ -308,7 +308,7 @@ Test =20 Besides the attributes and methods that are part of the base ``avocado.Test`` class, the following attributes are available on any -``avocado_qemu.Test`` instance. +``avocado_qemu.QemuSystemTest`` instance. =20 vm "" @@ -365,7 +365,7 @@ source tree. LinuxTest ^^^^^^^^^ =20 -Besides the attributes present on the ``avocado_qemu.Test`` base +Besides the attributes present on the ``avocado_qemu.QemuSystemTest`` base class, the ``avocado_qemu.LinuxTest`` adds the following attributes: =20 distro @@ -446,7 +446,7 @@ The exact QEMU binary to be used on QEMUMachine. LinuxTest ^^^^^^^^^ =20 -Besides the parameters present on the ``avocado_qemu.Test`` base +Besides the parameters present on the ``avocado_qemu.QemuSystemTest`` base class, the ``avocado_qemu.LinuxTest`` adds the following parameters: =20 distro --=20 2.46.0 From nobody Thu Sep 19 01:02:18 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725025496; cv=none; d=zohomail.com; s=zohoarc; b=ni2hyCxQAGOZ5KSNuEb5/HCUKHP29EZFVkxMK7oB1MWLOHzlM0MtnGInQdf9PIg76mSLuaGx1nH00oj1hZyhHaOK69g2lcX/MpJ/wNfmm59RodLZFPI6Bb1uA78L7Josh0ba5oiu0kkNntNoTcW1+U11+p+U6WgrTqEq6M37BkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725025496; h=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=GYfy8Nn2T/dx9u5gtuYchnP2ogVj6dzCQA8Fj00g+X4=; b=cpB7IrewkR6XkUb+P37aSXmwhR6zGVg9kKu18mlUFwkjw8/Ymene/ykK2gbMO25D33T251JRqPJ7qi1LXT0QWgpCh8l638TKX0pxEqKEOoqm+BDU0Xz9fG3Mn+QEbJMwkeF0D5RFOpMrFAAPFmH47mIaIrQYCPgu+9exBYw4aPM= 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 1725025496850256.162417136474; Fri, 30 Aug 2024 06:44:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk1tT-0007AS-Ns; Fri, 30 Aug 2024 09:42:27 -0400 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 1sk1tF-0006D4-Qo for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:42:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk1tA-0005h9-PM for qemu-devel@nongnu.org; Fri, 30 Aug 2024 09:42:13 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-pmC-BO1mPX66gLs99LhtGQ-1; Fri, 30 Aug 2024 09:42:04 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4796E1954B1C; Fri, 30 Aug 2024 13:42:03 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.7]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B36FA300019C; Fri, 30 Aug 2024 13:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725025327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GYfy8Nn2T/dx9u5gtuYchnP2ogVj6dzCQA8Fj00g+X4=; b=CweBMQNBoiXnHEcbfH1LU0dmMoOiBVNdOYrMRTlvPRqmZgbvkbJMurNDMwkbJxkUlJjdQ+ vddnZC5yoNIknVqmOQsRqhd2ZSpi+eW0FCKHAUaoU8+EYo8KlcKfXVqHN1w2onbqTpPl2O zbQPOW1hlHWnbKX+pjr2SgSbUcsviz4= X-MC-Unique: pmC-BO1mPX66gLs99LhtGQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Daniel P . Berrange" Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ani Sinha , Richard Henderson , John Snow , Fabiano Rosas Subject: [PATCH v5 44/44] docs/devel/testing: Add documentation for functional tests Date: Fri, 30 Aug 2024 15:38:38 +0200 Message-ID: <20240830133841.142644-45-thuth@redhat.com> In-Reply-To: <20240830133841.142644-1-thuth@redhat.com> References: <20240830133841.142644-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=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 @redhat.com) X-ZM-MESSAGEID: 1725025498010116600 Content-Type: text/plain; charset="utf-8" Document the new functional testing framework. The text is originally based on the Avocado documentation, but heavily modified to match the new framework. Signed-off-by: Thomas Huth --- docs/devel/testing/functional.rst | 338 ++++++++++++++++++++++++++++++ docs/devel/testing/index.rst | 1 + docs/devel/testing/main.rst | 12 ++ 3 files changed, 351 insertions(+) create mode 100644 docs/devel/testing/functional.rst diff --git a/docs/devel/testing/functional.rst b/docs/devel/testing/functio= nal.rst new file mode 100644 index 0000000000..bf6f1bb81e --- /dev/null +++ b/docs/devel/testing/functional.rst @@ -0,0 +1,338 @@ +.. _checkfunctional-ref: + +Functional testing with Python +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D + +The ``tests/functional`` directory hosts functional tests written in +Python. They are usually higher level tests, and may interact with +external resources and with various guest operating systems. +The functional tests have initially evolved from the Avocado tests, so the= re +is a lot of similarity to those tests here (see :ref:`checkavocado-ref` for +details about the Avocado tests). + +The tests should be written in the style of the Python `unittest`_ framewo= rk, +using stdio for the TAP protocol. The folder ``tests/functional/qemu_test`` +provides classes (e.g. the ``QemuBaseTest``, ``QemuUserTest`` and the +``QemuSystemTest`` classes) and utility functions that help to get your te= st +into the right shape, e.g. by replacing the 'stdout' python object to redi= rect +the normal output of your test to stderr instead. + +Note that if you don't use one of the QemuBaseTest based classes for your +test, or if you spawn subprocesses from your test, you have to make sure +that there is no TAP-incompatible output written to stdio, e.g. either by +prefixing every line with a "# " to mark the output as a TAP comment, or +e.g. by capturing the stdout output of subprocesses (redirecting it to +stderr is OK). + +Tests based on ``qemu_test.QemuSystemTest`` can easily: + + * Customize the command line arguments given to the convenience + ``self.vm`` attribute (a QEMUMachine instance) + + * Interact with the QEMU monitor, send QMP commands and check + their results + + * Interact with the guest OS, using the convenience console device + (which may be useful to assert the effectiveness and correctness of + command line arguments or QMP commands) + + * Download (and cache) remote data files, such as firmware and kernel + images + +Running tests +------------- + +You can run the functional tests simply by executing: + +.. code:: + + make check-functional + +It is also possible to run tests for a certain target only, for example +the following line will only run the tests for the x86_64 target: + +.. code:: + + make check-functional-x86_64 + +To run a single test file without the meson test runner, you can also +execute the file directly by specifying two environment variables first, +the PYTHONPATH that has to include the python folder and the tests/functio= nal +folder of the source tree, and QEMU_TEST_QEMU_BINARY that has to point +to the QEMU binary that should be used for the test, for example:: + + $ export PYTHONPATH=3D../python:../tests/functional + $ export QEMU_TEST_QEMU_BINARY=3D$PWD/qemu-system-x86_64 + $ python3 ../tests/functional/test_file.py + +Overview +-------- + +The ``tests/functional/qemu_test`` directory provides the ``qemu_test`` +Python module, containing the ``qemu_test.QemuSystemTest`` class. +Here is a simple usage example: + +.. code:: + + #!/usr/bin/env python3 + + from qemu_test import QemuSystemTest + + class Version(QemuSystemTest): + + def test_qmp_human_info_version(self): + self.vm.launch() + res =3D self.vm.cmd('human-monitor-command', + command_line=3D'info version') + self.assertRegex(res, r'^(\d+\.\d+\.\d)') + + if __name__ =3D=3D '__main__': + QemuSystemTest.main() + +By providing the "hash bang" line at the beginning of the script, marking +the file as executable and by calling into QemuSystemTest.main(), the test +can also be run stand-alone, without a test runner. OTOH when run via a te= st +runner, the QemuSystemTest.main() function takes care of running the test +functions in the right fassion (e.g. with TAP output that is required by t= he +meson test runner). + +The ``qemu_test.QemuSystemTest`` base test class +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``qemu_test.QemuSystemTest`` class has a number of characteristics +that are worth being mentioned. + +First of all, it attempts to give each test a ready to use QEMUMachine +instance, available at ``self.vm``. Because many tests will tweak the +QEMU command line, launching the QEMUMachine (by using ``self.vm.launch()`= `) +is left to the test writer. + +The base test class has also support for tests with more than one +QEMUMachine. The way to get machines is through the ``self.get_vm()`` +method which will return a QEMUMachine instance. The ``self.get_vm()`` +method accepts arguments that will be passed to the QEMUMachine creation +and also an optional ``name`` attribute so you can identify a specific +machine and get it more than once through the tests methods. A simple +and hypothetical example follows: + +.. code:: + + from qemu_test import QemuSystemTest + + class MultipleMachines(QemuSystemTest): + def test_multiple_machines(self): + first_machine =3D self.get_vm() + second_machine =3D self.get_vm() + self.get_vm(name=3D'third_machine').launch() + + first_machine.launch() + second_machine.launch() + + first_res =3D first_machine.cmd( + 'human-monitor-command', + command_line=3D'info version') + + second_res =3D second_machine.cmd( + 'human-monitor-command', + command_line=3D'info version') + + third_res =3D self.get_vm(name=3D'third_machine').cmd( + 'human-monitor-command', + command_line=3D'info version') + + self.assertEqual(first_res, second_res, third_res) + +At test "tear down", ``qemu_test.QemuSystemTest`` handles all the QEMUMach= ines +shutdown. + +QEMUMachine +----------- + +The QEMUMachine API is already widely used in the Python iotests, +device-crash-test and other Python scripts. It's a wrapper around the +execution of a QEMU binary, giving its users: + + * the ability to set command line arguments to be given to the QEMU + binary + + * a ready to use QMP connection and interface, which can be used to + send commands and inspect its results, as well as asynchronous + events + + * convenience methods to set commonly used command line arguments in + a more succinct and intuitive way + +QEMU binary selection +^^^^^^^^^^^^^^^^^^^^^ + +The QEMU binary used for the ``self.vm`` QEMUMachine instance will +primarily depend on the value of the ``qemu_bin`` class attribute. +If it is not explicitly set by the test code, its default value will +be the result the QEMU_TEST_QEMU_BINARY environment variable. + +Attribute reference +------------------- + +QemuBaseTest +^^^^^^^^^^^^ + +The following attributes are available on any ``qemu_test.QemuBaseTest`` +instance. + +arch +"""" + +The target architecture of the QEMU binary. + +Tests are also free to use this attribute value, for their own needs. +A test may, for instance, use this value when selecting the architecture +of a kernel or disk image to boot a VM with. + +qemu_bin +"""""""" + +The preserved value of the ``QEMU_TEST_QEMU_BINARY`` environment +variable. + +QemuUserTest +^^^^^^^^^^^^ + +The QemuUserTest class can be used for running an executable via the +usermode emulation binaries. + +QemuSystemTest +^^^^^^^^^^^^^^ + +The QemuSystemTest class can be used for running tests via one of the +qemu-system-* binaries. + +vm +"" + +A QEMUMachine instance, initially configured according to the given +``qemu_bin`` parameter. + +cpu +""" + +The cpu model that will be set to all QEMUMachine instances created +by the test. + +machine +""""""" + +The machine type that will be set to all QEMUMachine instances created +by the test. By using the set_machine() function of the QemuSystemTest +class to set this attribute, you can automatically check whether the +machine is available to skip the test in case it is not built into the +QEMU binary. + +Asset handling +-------------- + +Many functional tests download assets (e.g. Linux kernels, initrds, +firmware images, etc.) from the internet to be able to run tests with +them. This imposes additional challenges to the test framework. + +First there is the the problem that some people might not have an +unconstrained internet connection, so such tests should not be run by +default when running ``make check``. To accomplish this situation, +the tests that download files should only be added to the "thorough" +speed mode in the meson.build file, while the "quick" speed mode is +fine for functional tests that can be run without downloading files. +``make check`` then only runs the quick functional tests along with +the other quick tests from the other test suites. If you choose to +run only run ``make check-functional``, the "thorough" tests will be +executed, too. And to run all functional tests along with the others, +you can use something like:: + + make -j$(nproc) check SPEED=3Dthorough + +The second problem with downloading files from the internet are time +constraints. The time for downloading files should not be taken into +account when the test is running and the timeout of the test is ticking +(since downloading can be very slow, depending on the network bandwidth). +This problem is solved by downloading the assets ahead of time, before +the tests are run. This pre-caching is done with the qemu_test.Asset +class. To use it in your test, declare an asset in your test class with +its URL and SHA256 checksum like this:: + + ASSET_somename =3D ( + ('https://www.qemu.org/assets/images/qemu_head_200.png'), + '34b74cad46ea28a2966c1d04e102510daf1fd73e6582b6b74523940d5da029dd') + +In your test function, you can then get the file name of the cached +asset like this:: + + def test_function(self): + file_path =3D self.ASSET_somename.fetch() + +The pre-caching will be done automatically when running +``make check-functional`` (but not when running e.g. +``make check-functional-``). In case you just want to download +the assets without running the tests, you can do so by running:: + + make precache-functional + +The cache is populated in the ``~/.cache/qemu/download`` directory by +default, but the location can be changed by setting the +``QEMU_TEST_CACHE_DIR`` environment variable. + +Skipping tests +-------------- + +Since the test framework is based on the common Python unittest framework, +you can use the usual Python decorators which allow for easily skipping +tests running under certain conditions, for example, on the lack of a bina= ry +on the test system or when the running environment is a CI system. For fur= ther +information about those decorators, please refer to: + + https://docs.python.org/3/library/unittest.html#skipping-tests-and-expec= ted-failures + +While the conditions for skipping tests are often specifics of each one, t= here +are recurring scenarios identified by the QEMU developers and the use of +environment variables became a kind of standard way to enable/disable test= s. + +Here is a list of the most used variables: + +QEMU_TEST_ALLOW_LARGE_STORAGE +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Tests which are going to fetch or produce assets considered *large* are not +going to run unless that ``QEMU_TEST_ALLOW_LARGE_STORAGE=3D1`` is exported= on +the environment. + +The definition of *large* is a bit arbitrary here, but it usually means an +asset which occupies at least 1GB of size on disk when uncompressed. + +QEMU_TEST_ALLOW_UNTRUSTED_CODE +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +There are tests which will boot a kernel image or firmware that can be +considered not safe to run on the developer's workstation, thus they are +skipped by default. The definition of *not safe* is also arbitrary but +usually it means a blob which either its source or build process aren't +public available. + +You should export ``QEMU_TEST_ALLOW_UNTRUSTED_CODE=3D1`` on the environmen= t in +order to allow tests which make use of those kind of assets. + +QEMU_TEST_FLAKY_TESTS +^^^^^^^^^^^^^^^^^^^^^ +Some tests are not working reliably and thus are disabled by default. +This includes tests that don't run reliably on GitLab's CI which +usually expose real issues that are rarely seen on developer machines +due to the constraints of the CI environment. If you encounter a +similar situation then raise a bug and then mark the test as shown on +the code snippet below: + +.. code:: + + # See https://gitlab.com/qemu-project/qemu/-/issues/nnnn + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on Git= Lab') + def test(self): + do_something() + +Tests should not live in this state forever and should either be fixed +or eventually removed. + + +.. _unittest: https://docs.python.org/3/library/unittest.html diff --git a/docs/devel/testing/index.rst b/docs/devel/testing/index.rst index cdf7ba1f8b..45eb4a7181 100644 --- a/docs/devel/testing/index.rst +++ b/docs/devel/testing/index.rst @@ -9,6 +9,7 @@ testing infrastructure. =20 main qtest + functional avocado acpi-bits ci diff --git a/docs/devel/testing/main.rst b/docs/devel/testing/main.rst index 39b965ecf6..e9921a4b10 100644 --- a/docs/devel/testing/main.rst +++ b/docs/devel/testing/main.rst @@ -862,6 +862,18 @@ supported. To start the fuzzer, run Alternatively, some command different from ``qemu-img info`` can be tested= , by changing the ``-c`` option. =20 +Functional tests using Python +----------------------------- + +The ``tests/functional`` directory hosts functional tests written in +Python. You can run the functional tests simply by executing: + +.. code:: + + make check-functional + +See :ref:`checkfunctional-ref` for more details. + Integration tests using the Avocado Framework --------------------------------------------- =20 --=20 2.46.0