From nobody Thu Dec 26 11:50:36 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=1732901607; cv=none; d=zohomail.com; s=zohoarc; b=LIOKDIe81QvfiaBW5aQmw412ScF7+QZjIVYyLWTvVzq03eJh8Afbgo9YnQxcl1/nsEOGTHKfNsgYziBDXMz21dZXY7/C98MUH8G5nwTusCnfp5qr2xnMM7CZk1ptiMjQoyBNq4zQC24vtdTei+95rSnaA9IouPR/INzgPGIUyTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901607; 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=B0Di8ZAFCBGObr+wNkVuD3jewkVg90AD2fktAHWIvcM=; b=YvZMo05dhPPV33FQcnkSL4OH19jObdCRHJ+M+Uf16bg8cjLnahTgRPIEVh7lsACHbTDdv70ngIx9iLRzYpPkBVpsImG5+JFLo/1jaKu3gBfUQl8VF4PDPwHQU/xPNnBJeI9xh3i7al8Za5r9/QIQE9obP8/uxruW4dLHi3tS1ww= 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 1732901607409585.6109960937749; Fri, 29 Nov 2024 09:33:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qC-0003Vo-Go; Fri, 29 Nov 2024 12:31:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4q9-0003VI-Ut for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:38 -0500 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 1tH4q7-0000nn-MV for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:37 -0500 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-503-JF0OAD7WNuGU764ibqKGag-1; Fri, 29 Nov 2024 12:31:27 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 653631954197; Fri, 29 Nov 2024 17:31:26 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 79B251955F2D; Fri, 29 Nov 2024 17:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901494; 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=B0Di8ZAFCBGObr+wNkVuD3jewkVg90AD2fktAHWIvcM=; b=aAUVWFCljWkB1Xd4Sv2yKgN+x9qV7dg7oLCIHjt+C2dyJ89/UI97aU+nvOByIVP0JkcTBj L6ObuGAxHsgqsGLiE33VERzAqjskqHucFHFy4sT+CmTzjVNFb0GPMA+VX4QrX9HCXMT2r1 X47gD2aT4sDn+CxBut2eUZUAqKvyP5I= X-MC-Unique: JF0OAD7WNuGU764ibqKGag-1 X-Mimecast-MFC-AGG-ID: JF0OAD7WNuGU764ibqKGag From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 01/22] tests/functional: increase timeouts for arm sx1 test Date: Fri, 29 Nov 2024 17:30:59 +0000 Message-ID: <20241129173120.761728-2-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901608711019100 When under high load the test VM does not complete running in the default 30 second timeout. Double it to give more headroom. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/test_arm_sx1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/functional/test_arm_sx1.py b/tests/functional/test_arm_s= x1.py index 2d86405831..2292317946 100755 --- a/tests/functional/test_arm_sx1.py +++ b/tests/functional/test_arm_sx1.py @@ -44,7 +44,7 @@ def test_arm_sx1_initrd(self): self.vm.add_args('-no-reboot') self.launch_kernel(zimage_path, initrd=3Dinitrd_path) - self.vm.wait() + self.vm.wait(timeout=3D60) =20 def test_arm_sx1_sd(self): self.set_machine('sx1') @@ -55,7 +55,7 @@ def test_arm_sx1_sd(self): self.vm.add_args('-snapshot') self.vm.add_args('-drive', f'format=3Draw,if=3Dsd,file=3D{sd_fs_pa= th}') self.launch_kernel(zimage_path) - self.vm.wait() + self.vm.wait(timeout=3D60) =20 def test_arm_sx1_flash(self): self.set_machine('sx1') @@ -66,7 +66,7 @@ def test_arm_sx1_flash(self): self.vm.add_args('-snapshot') self.vm.add_args('-drive', f'format=3Draw,if=3Dpflash,file=3D{flas= h_path}') self.launch_kernel(zimage_path) - self.vm.wait() + self.vm.wait(timeout=3D60) =20 if __name__ =3D=3D '__main__': LinuxKernelTest.main() --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901638; cv=none; d=zohomail.com; s=zohoarc; b=FWoshFg6bwvpp2AunB+6RI0XqA6liwRz+v9W+APG56ueTQVBNeYdRTI2Wi+w2Vs/XaHqRk28n18QrbgwPnTYq1MsiCMS0XX7xGrNHdrYfasANNdaFmnLpyi9xrQJoimODam5UpV4Hqj/MYoUMGfbdqc0HH60BfWhLDUQYks9IVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901638; 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=ifXmOmdjbWBTIvEozeD9D+7JRzpwmcM0ewP4FejXQMM=; b=CGrF7tTIIuqaP1rCG1dfkFiQU0FrVyJ3WBYpV742jgqRe7bQnkqNnkox1OjRDxO5XqXBt3tsfw1TqZXh1J/7mf7MUh70YCTwuqvSiiFdd0uel2CPCE694QpQ0LgCcbe1Ezelj23GJGpr5hokoJ6QnZfdolAscjmZghNeEqByrHg= 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 1732901638218369.3841036208207; Fri, 29 Nov 2024 09:33:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qC-0003Vn-D2; Fri, 29 Nov 2024 12:31:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4q9-0003V9-67 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:38 -0500 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 1tH4q6-0000nc-SA for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:36 -0500 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-533-uU4rNS1AP1Kf_ZYIWxiDhA-1; Fri, 29 Nov 2024 12:31:29 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 EE724195419B; Fri, 29 Nov 2024 17:31:28 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1A79A1955F41; Fri, 29 Nov 2024 17:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901493; 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=ifXmOmdjbWBTIvEozeD9D+7JRzpwmcM0ewP4FejXQMM=; b=XGriXgQn26bVBOPSGOmw+k6MUK+14ueoGqopuYCCSE2BmGUtFkOi6eCgUyQoANM61oI+ci tRm5Dejt75g7XxbIwCuFekqEBwUx3yEVn8cY7+KNMTvuM2DNFZRPIkqU3Wa3AKJcSdq/Y6 Ts13qHR0ToXPC99zXrF/OHH9Nz5s3VI= X-MC-Unique: uU4rNS1AP1Kf_ZYIWxiDhA-1 X-Mimecast-MFC-AGG-ID: uU4rNS1AP1Kf_ZYIWxiDhA From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 02/22] tests/functional: remove unused system imports Date: Fri, 29 Nov 2024 17:31:00 +0000 Message-ID: <20241129173120.761728-3-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901638930019100 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/test_aarch64_sbsaref.py | 1 - tests/functional/test_acpi_bits.py | 1 - tests/functional/test_m68k_mcf5208evb.py | 2 -- tests/functional/test_microblaze_s3adsp1800.py | 1 - tests/functional/test_mips64el_loongson3v.py | 1 - tests/functional/test_or1k_sim.py | 2 -- tests/functional/test_s390x_topology.py | 1 - tests/functional/test_sh4_tuxrun.py | 4 ---- tests/functional/test_sh4eb_r2d.py | 1 - tests/functional/test_virtio_version.py | 2 -- 10 files changed, 16 deletions(-) diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/te= st_aarch64_sbsaref.py index 9fda396b3a..6db08da522 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -14,7 +14,6 @@ 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 def fetch_firmware(test): """ diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp= i_bits.py index 3498b96787..6fc49a30bc 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -39,7 +39,6 @@ import subprocess import tarfile import tempfile -import time import zipfile =20 from pathlib import Path diff --git a/tests/functional/test_m68k_mcf5208evb.py b/tests/functional/te= st_m68k_mcf5208evb.py index 00c59590c3..fb178fde1c 100755 --- a/tests/functional/test_m68k_mcf5208evb.py +++ b/tests/functional/test_m68k_mcf5208evb.py @@ -5,8 +5,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from qemu_test import LinuxKernelTest, Asset from qemu_test.utils import archive_extract =20 diff --git a/tests/functional/test_microblaze_s3adsp1800.py b/tests/functio= nal/test_microblaze_s3adsp1800.py index 4f692ffdb1..d2be3105a2 100755 --- a/tests/functional/test_microblaze_s3adsp1800.py +++ b/tests/functional/test_microblaze_s3adsp1800.py @@ -7,7 +7,6 @@ # 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 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 diff --git a/tests/functional/test_mips64el_loongson3v.py b/tests/functiona= l/test_mips64el_loongson3v.py index 55d62928c7..e57ec5499e 100755 --- a/tests/functional/test_mips64el_loongson3v.py +++ b/tests/functional/test_mips64el_loongson3v.py @@ -10,7 +10,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 import os -import time =20 from unittest import skipUnless from qemu_test import QemuSystemTest, Asset diff --git a/tests/functional/test_or1k_sim.py b/tests/functional/test_or1k= _sim.py index 10e0437c50..5b68b6b628 100755 --- a/tests/functional/test_or1k_sim.py +++ b/tests/functional/test_or1k_sim.py @@ -5,8 +5,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from qemu_test import LinuxKernelTest, Asset from qemu_test.utils import archive_extract =20 diff --git a/tests/functional/test_s390x_topology.py b/tests/functional/tes= t_s390x_topology.py index 20727f6bdf..c54c7a8177 100755 --- a/tests/functional/test_s390x_topology.py +++ b/tests/functional/test_s390x_topology.py @@ -11,7 +11,6 @@ # later. See the COPYING file in the top-level directory. =20 import os -import time =20 from qemu_test import QemuSystemTest, Asset from qemu_test import exec_command diff --git a/tests/functional/test_sh4_tuxrun.py b/tests/functional/test_sh= 4_tuxrun.py index b33533fc7e..1748f8c7ef 100755 --- a/tests/functional/test_sh4_tuxrun.py +++ b/tests/functional/test_sh4_tuxrun.py @@ -11,10 +11,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os -import time - -from unittest import skipUnless from qemu_test import Asset, exec_command_and_wait_for_pattern from qemu_test.tuxruntest import TuxRunBaselineTest =20 diff --git a/tests/functional/test_sh4eb_r2d.py b/tests/functional/test_sh4= eb_r2d.py index d9c022c8b8..cd46007942 100755 --- a/tests/functional/test_sh4eb_r2d.py +++ b/tests/functional/test_sh4eb_r2d.py @@ -10,7 +10,6 @@ from qemu_test import LinuxKernelTest, Asset from qemu_test import exec_command_and_wait_for_pattern from qemu_test.utils import archive_extract -from unittest import skipUnless =20 class R2dEBTest(LinuxKernelTest): =20 diff --git a/tests/functional/test_virtio_version.py b/tests/functional/tes= t_virtio_version.py index eb23060564..501e0e5397 100755 --- a/tests/functional/test_virtio_version.py +++ b/tests/functional/test_virtio_version.py @@ -9,8 +9,6 @@ # # 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 sys -import os =20 from qemu.machine import QEMUMachine from qemu_test import QemuSystemTest --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901538; cv=none; d=zohomail.com; s=zohoarc; b=VDLx6+z7lqOEtQhWo2xj2QBjmm3pBffYPnBmFsw9FaWKCztg6iMNXD+Sw7W8r3ZW/pj06vplr/w7eBHxiZsRZ9U0FqXf36yrsHWyzqMMz+5+3Tue6yVq4aGDWmz+6wLY6M5oBTpXvRfFwpJYZhSXYgeptMdPis7FpcCFCAhhVEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901538; 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=aNFHcHWOGgepYw99svZdEFAwAytxphNPjWVwME+fCwc=; b=fb4OIXWvbc8S8OVxIwt8fyV/49N0xK6u1fetM85zppyrcFk15ryCWwo2gaImRG9qPE9tGurpEmiS/mmEFcMDz42CVTxs80+4eEQL6JhyoR+NtR5qpRG3lL8WZt0Vp41ZZZ/lhzzIHLhcscmhY73Ni2HjMkfB+uhR/XIeDAs1LYo= 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 1732901538683816.4232350656994; Fri, 29 Nov 2024 09:32:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qF-0003Ww-VW; Fri, 29 Nov 2024 12:31:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qD-0003W6-3K for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:41 -0500 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 1tH4qA-0000qC-1p for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:40 -0500 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-690-V7QKmYQ0Pp6_wbcmcjovZA-1; Fri, 29 Nov 2024 12:31:33 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 A3B491955F40; Fri, 29 Nov 2024 17:31:32 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 895241955F41; Fri, 29 Nov 2024 17:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901497; 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=aNFHcHWOGgepYw99svZdEFAwAytxphNPjWVwME+fCwc=; b=aUptLIaojRIAVVMseisiikzqQq/HFCs0VjsYFQMZ5g0XwHNOl5RQ5/Ou0PzHs7t6144YV4 WE3G/eZg5GqFizciSQ9xJNQMJj8bNpZJ9C0tjlsteKC/ZFGV7vKRJbVTok7dMQ4bkHx0+I ggrVS3FU/WQ1bunKf32R4xS7hYunNEY= X-MC-Unique: V7QKmYQ0Pp6_wbcmcjovZA-1 X-Mimecast-MFC-AGG-ID: V7QKmYQ0Pp6_wbcmcjovZA From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 03/22] tests/functional: remove duplicated 'qemu_test' import statements Date: Fri, 29 Nov 2024 17:31:01 +0000 Message-ID: <20241129173120.761728-4-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901541345019100 Group all imports that originate in the 'qemu_test' package into one statement. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/tuxruntest.py | 9 +++++---- tests/functional/test_aarch64_raspi4.py | 4 ++-- tests/functional/test_aarch64_sbsaref.py | 5 ++--- tests/functional/test_aarch64_sbsaref_alpine.py | 5 ++--- tests/functional/test_aarch64_sbsaref_freebsd.py | 5 ++--- tests/functional/test_aarch64_virt.py | 6 ++---- tests/functional/test_arm_aspeed.py | 7 +++---- tests/functional/test_arm_bflt.py | 3 +-- tests/functional/test_arm_bpim2u.py | 8 ++++---- tests/functional/test_arm_canona1100.py | 3 +-- tests/functional/test_arm_integratorcp.py | 3 +-- tests/functional/test_arm_orangepi.py | 10 +++++----- tests/functional/test_arm_raspi2.py | 4 ++-- tests/functional/test_loongarch64_virt.py | 6 +++--- tests/functional/test_microblaze_s3adsp1800.py | 5 ++--- tests/functional/test_microblazeel_s3adsp1800.py | 5 ++--- tests/functional/test_mips64el_fuloong2e.py | 7 ++++--- tests/functional/test_mips64el_loongson3v.py | 3 +-- tests/functional/test_mips64el_malta.py | 4 ++-- tests/functional/test_mipsel_malta.py | 6 +++--- tests/functional/test_multiprocess.py | 4 ++-- tests/functional/test_netdev_ethtool.py | 3 +-- tests/functional/test_ppc64_hv.py | 4 ++-- tests/functional/test_ppc64_powernv.py | 3 +-- tests/functional/test_ppc64_pseries.py | 3 +-- tests/functional/test_ppc_405.py | 6 +++--- tests/functional/test_ppc_40p.py | 3 +-- tests/functional/test_ppc_74xx.py | 3 +-- tests/functional/test_ppc_amiga.py | 3 +-- tests/functional/test_ppc_bamboo.py | 6 +++--- tests/functional/test_ppc_mpc8544ds.py | 3 +-- tests/functional/test_ppc_virtex_ml507.py | 3 +-- tests/functional/test_riscv_opensbi.py | 4 ++-- tests/functional/test_rx_gdbsim.py | 6 +++--- tests/functional/test_s390x_ccw_virtio.py | 6 +++--- tests/functional/test_s390x_topology.py | 7 +++---- tests/functional/test_sh4eb_r2d.py | 4 ++-- tests/functional/test_sparc64_sun4u.py | 3 +-- tests/functional/test_virtio_gpu.py | 10 ++++------ 39 files changed, 85 insertions(+), 107 deletions(-) diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qe= mu_test/tuxruntest.py index ab3b27da43..7c0456923e 100644 --- a/tests/functional/qemu_test/tuxruntest.py +++ b/tests/functional/qemu_test/tuxruntest.py @@ -13,10 +13,11 @@ import stat import time =20 -from qemu_test import QemuSystemTest -from qemu_test import exec_command, exec_command_and_wait_for_pattern -from qemu_test import wait_for_console_pattern -from qemu_test import has_cmd, run_cmd, get_qemu_img +from qemu_test import (QemuSystemTest, exec_command, + exec_command_and_wait_for_pattern, + wait_for_console_pattern, + has_cmd, run_cmd, get_qemu_img) + =20 class TuxRunBaselineTest(QemuSystemTest): =20 diff --git a/tests/functional/test_aarch64_raspi4.py b/tests/functional/tes= t_aarch64_raspi4.py index e5c9f77479..95e9c8e643 100755 --- a/tests/functional/test_aarch64_raspi4.py +++ b/tests/functional/test_aarch64_raspi4.py @@ -7,8 +7,8 @@ =20 import os =20 -from qemu_test import LinuxKernelTest, Asset -from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import (LinuxKernelTest, Asset, + exec_command_and_wait_for_pattern) from qemu_test.utils import gzip_uncompress =20 =20 diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/te= st_aarch64_sbsaref.py index 6db08da522..8064b691c7 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -10,9 +10,8 @@ =20 import os =20 -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 import (QemuSystemTest, Asset, wait_for_console_pattern, + interrupt_interactive_console_until_pattern) from qemu_test.utils import lzma_uncompress =20 def fetch_firmware(test): diff --git a/tests/functional/test_aarch64_sbsaref_alpine.py b/tests/functi= onal/test_aarch64_sbsaref_alpine.py index ebc29b2fb5..6496418659 100755 --- a/tests/functional/test_aarch64_sbsaref_alpine.py +++ b/tests/functional/test_aarch64_sbsaref_alpine.py @@ -10,9 +10,8 @@ =20 import os =20 -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 import (QemuSystemTest, Asset, wait_for_console_pattern, + interrupt_interactive_console_until_pattern) from unittest import skipUnless from test_aarch64_sbsaref import fetch_firmware =20 diff --git a/tests/functional/test_aarch64_sbsaref_freebsd.py b/tests/funct= ional/test_aarch64_sbsaref_freebsd.py index 80298dd190..002da59ea2 100755 --- a/tests/functional/test_aarch64_sbsaref_freebsd.py +++ b/tests/functional/test_aarch64_sbsaref_freebsd.py @@ -10,9 +10,8 @@ =20 import os =20 -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 import (QemuSystemTest, Asset, wait_for_console_pattern, + interrupt_interactive_console_until_pattern) from unittest import skipUnless from test_aarch64_sbsaref import fetch_firmware =20 diff --git a/tests/functional/test_aarch64_virt.py b/tests/functional/test_= aarch64_virt.py index c967da41b4..07b78f6a84 100755 --- a/tests/functional/test_aarch64_virt.py +++ b/tests/functional/test_aarch64_virt.py @@ -14,10 +14,8 @@ import os import logging =20 -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 +from qemu_test import (BUILD_DIR, QemuSystemTest, Asset, exec_command, + wait_for_console_pattern, get_qemu_img, run_cmd) =20 =20 class Aarch64VirtMachine(QemuSystemTest): diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar= m_aspeed.py index d88170ac24..068740a813 100755 --- a/tests/functional/test_arm_aspeed.py +++ b/tests/functional/test_arm_aspeed.py @@ -11,10 +11,9 @@ import subprocess import tempfile =20 -from qemu_test import LinuxKernelTest, Asset -from qemu_test import exec_command_and_wait_for_pattern -from qemu_test import interrupt_interactive_console_until_pattern -from qemu_test import has_cmd +from qemu_test import (LinuxKernelTest, Asset, + exec_command_and_wait_for_pattern, + interrupt_interactive_console_until_pattern, has_cm= d) from qemu_test.utils import archive_extract from zipfile import ZipFile from unittest import skipUnless diff --git a/tests/functional/test_arm_bflt.py b/tests/functional/test_arm_= bflt.py index 281925d11a..cd417ebcfc 100755 --- a/tests/functional/test_arm_bflt.py +++ b/tests/functional/test_arm_bflt.py @@ -9,8 +9,7 @@ import os import bz2 =20 -from qemu_test import QemuUserTest, Asset -from qemu_test import has_cmd +from qemu_test import QemuUserTest, Asset, has_cmd from qemu_test.utils import cpio_extract from unittest import skipUnless =20 diff --git a/tests/functional/test_arm_bpim2u.py b/tests/functional/test_ar= m_bpim2u.py index 35ea58d46c..7b1b0a270f 100755 --- a/tests/functional/test_arm_bpim2u.py +++ b/tests/functional/test_arm_bpim2u.py @@ -7,10 +7,10 @@ =20 import os =20 -from qemu_test import LinuxKernelTest, exec_command_and_wait_for_pattern -from qemu_test import Asset, interrupt_interactive_console_until_pattern -from qemu_test.utils import archive_extract, gzip_uncompress, lzma_uncompr= ess -from qemu_test.utils import image_pow2ceil_expand +from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, + Asset, interrupt_interactive_console_until_pattern) +from qemu_test.utils import (archive_extract, gzip_uncompress, lzma_uncomp= ress, + image_pow2ceil_expand) from unittest import skipUnless =20 class BananaPiMachine(LinuxKernelTest): diff --git a/tests/functional/test_arm_canona1100.py b/tests/functional/tes= t_arm_canona1100.py index 65f1228296..41e78b7d1b 100755 --- a/tests/functional/test_arm_canona1100.py +++ b/tests/functional/test_arm_canona1100.py @@ -10,8 +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 qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern from qemu_test.utils import archive_extract =20 class CanonA1100Machine(QemuSystemTest): diff --git a/tests/functional/test_arm_integratorcp.py b/tests/functional/t= est_arm_integratorcp.py index 0fe083f661..c2c6ff6ac5 100755 --- a/tests/functional/test_arm_integratorcp.py +++ b/tests/functional/test_arm_integratorcp.py @@ -15,8 +15,7 @@ import os import logging =20 -from qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern from unittest import skipUnless =20 =20 diff --git a/tests/functional/test_arm_orangepi.py b/tests/functional/test_= arm_orangepi.py index 6d57223a03..676327e8ef 100755 --- a/tests/functional/test_arm_orangepi.py +++ b/tests/functional/test_arm_orangepi.py @@ -8,11 +8,11 @@ import os import shutil =20 -from qemu_test import LinuxKernelTest, exec_command_and_wait_for_pattern -from qemu_test import Asset, interrupt_interactive_console_until_pattern -from qemu_test import wait_for_console_pattern -from qemu_test.utils import archive_extract, gzip_uncompress, lzma_uncompr= ess -from qemu_test.utils import image_pow2ceil_expand +from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, + Asset, interrupt_interactive_console_until_pattern, + wait_for_console_pattern) +from qemu_test.utils import (archive_extract, gzip_uncompress, lzma_uncomp= ress, + image_pow2ceil_expand) from unittest import skipUnless =20 class BananaPiMachine(LinuxKernelTest): diff --git a/tests/functional/test_arm_raspi2.py b/tests/functional/test_ar= m_raspi2.py index 3bf079dc4d..4d31454f8f 100755 --- a/tests/functional/test_arm_raspi2.py +++ b/tests/functional/test_arm_raspi2.py @@ -9,8 +9,8 @@ =20 import os =20 -from qemu_test import LinuxKernelTest, Asset -from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import (LinuxKernelTest, Asset, + exec_command_and_wait_for_pattern) from qemu_test.utils import gzip_uncompress =20 =20 diff --git a/tests/functional/test_loongarch64_virt.py b/tests/functional/t= est_loongarch64_virt.py index b7d9abf933..38cdd85f97 100755 --- a/tests/functional/test_loongarch64_virt.py +++ b/tests/functional/test_loongarch64_virt.py @@ -7,9 +7,9 @@ # Copyright (c) 2023 Loongson Technology Corporation Limited # =20 -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 import (QemuSystemTest, Asset, + exec_command_and_wait_for_pattern, + wait_for_console_pattern) =20 class LoongArchMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' diff --git a/tests/functional/test_microblaze_s3adsp1800.py b/tests/functio= nal/test_microblaze_s3adsp1800.py index d2be3105a2..387feb5dcc 100755 --- a/tests/functional/test_microblaze_s3adsp1800.py +++ b/tests/functional/test_microblaze_s3adsp1800.py @@ -7,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 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 import (exec_command, exec_command_and_wait_for_pattern, + QemuSystemTest, Asset, wait_for_console_pattern) from qemu_test.utils import archive_extract =20 class MicroblazeMachine(QemuSystemTest): diff --git a/tests/functional/test_microblazeel_s3adsp1800.py b/tests/funct= ional/test_microblazeel_s3adsp1800.py index faa3927f2e..875e2ab14c 100755 --- a/tests/functional/test_microblazeel_s3adsp1800.py +++ b/tests/functional/test_microblazeel_s3adsp1800.py @@ -8,9 +8,8 @@ # later. See the COPYING file in the top-level directory. =20 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 import (exec_command, exec_command_and_wait_for_pattern, + QemuSystemTest, Asset, wait_for_console_pattern) from qemu_test.utils import archive_extract =20 class MicroblazeelMachine(QemuSystemTest): diff --git a/tests/functional/test_mips64el_fuloong2e.py b/tests/functional= /test_mips64el_fuloong2e.py index a32d5f9d08..8d0ae8d1d5 100755 --- a/tests/functional/test_mips64el_fuloong2e.py +++ b/tests/functional/test_mips64el_fuloong2e.py @@ -12,10 +12,11 @@ import os import subprocess =20 -from qemu_test import LinuxKernelTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import (LinuxKernelTest, Asset, wait_for_console_pattern, + skipUntrustedTest) from unittest import skipUnless =20 + class MipsFuloong2e(LinuxKernelTest): =20 timeout =3D 60 @@ -39,7 +40,7 @@ def test_linux_kernel_3_16(self): console_pattern =3D 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) =20 - @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + @skipUntrustedTest() @skipUnless(os.getenv('RESCUE_YL_PATH'), 'RESCUE_YL_PATH not available= ') def test_linux_kernel_2_6_27_isa_serial(self): # Recovery system for the Yeeloong laptop diff --git a/tests/functional/test_mips64el_loongson3v.py b/tests/functiona= l/test_mips64el_loongson3v.py index e57ec5499e..06032a3a6b 100755 --- a/tests/functional/test_mips64el_loongson3v.py +++ b/tests/functional/test_mips64el_loongson3v.py @@ -12,8 +12,7 @@ import os =20 from unittest import skipUnless -from qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern =20 class MipsLoongson3v(QemuSystemTest): timeout =3D 60 diff --git a/tests/functional/test_mips64el_malta.py b/tests/functional/tes= t_mips64el_malta.py index 6d1195d362..b5959d33ea 100755 --- a/tests/functional/test_mips64el_malta.py +++ b/tests/functional/test_mips64el_malta.py @@ -12,8 +12,8 @@ import os import logging =20 -from qemu_test import LinuxKernelTest, Asset -from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import (LinuxKernelTest, Asset, + exec_command_and_wait_for_pattern) from qemu_test.utils import gzip_uncompress from unittest import skipUnless =20 diff --git a/tests/functional/test_mipsel_malta.py b/tests/functional/test_= mipsel_malta.py index b8dfddd856..af6d280f99 100755 --- a/tests/functional/test_mipsel_malta.py +++ b/tests/functional/test_mipsel_malta.py @@ -11,9 +11,9 @@ =20 import os =20 -from qemu_test import QemuSystemTest, LinuxKernelTest, Asset -from qemu_test import interrupt_interactive_console_until_pattern -from qemu_test import wait_for_console_pattern +from qemu_test import (QemuSystemTest, LinuxKernelTest, Asset, + interrupt_interactive_console_until_pattern, + wait_for_console_pattern) from qemu_test.utils import lzma_uncompress from zipfile import ZipFile =20 diff --git a/tests/functional/test_multiprocess.py b/tests/functional/test_= multiprocess.py index 751cf10e63..33fcb26381 100755 --- a/tests/functional/test_multiprocess.py +++ b/tests/functional/test_multiprocess.py @@ -9,8 +9,8 @@ import os import socket =20 -from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern -from qemu_test import exec_command, exec_command_and_wait_for_pattern +from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, + exec_command, exec_command_and_wait_for_pattern) =20 class Multiprocess(QemuSystemTest): =20 diff --git a/tests/functional/test_netdev_ethtool.py b/tests/functional/tes= t_netdev_ethtool.py index ee1a397bd2..ca4d374de7 100755 --- a/tests/functional/test_netdev_ethtool.py +++ b/tests/functional/test_netdev_ethtool.py @@ -8,8 +8,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from unittest import skip -from qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern =20 class NetDevEthtool(QemuSystemTest): =20 diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc6= 4_hv.py index 312248bbfe..c31432d18d 100755 --- a/tests/functional/test_ppc64_hv.py +++ b/tests/functional/test_ppc64_hv.py @@ -10,8 +10,8 @@ # later. See the COPYING file in the top-level directory. =20 from unittest import skipIf, skipUnless -from qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern, exec_command +from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, + exec_command) import os import time import subprocess diff --git a/tests/functional/test_ppc64_powernv.py b/tests/functional/test= _ppc64_powernv.py index 685e2178ed..4d570a9867 100755 --- a/tests/functional/test_ppc64_powernv.py +++ b/tests/functional/test_ppc64_powernv.py @@ -7,8 +7,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 qemu_test import LinuxKernelTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import LinuxKernelTest, Asset, wait_for_console_pattern =20 class powernvMachine(LinuxKernelTest): =20 diff --git a/tests/functional/test_ppc64_pseries.py b/tests/functional/test= _ppc64_pseries.py index fdc404ed03..faca7f46f2 100755 --- a/tests/functional/test_ppc64_pseries.py +++ b/tests/functional/test_ppc64_pseries.py @@ -7,8 +7,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 qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern =20 class pseriesMachine(QemuSystemTest): =20 diff --git a/tests/functional/test_ppc_405.py b/tests/functional/test_ppc_4= 05.py index 9851c03ee9..04df038af7 100755 --- a/tests/functional/test_ppc_405.py +++ b/tests/functional/test_ppc_405.py @@ -7,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 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 (QemuSystemTest, Asset, wait_for_console_pattern, + exec_command_and_wait_for_pattern) + =20 class Ppc405Machine(QemuSystemTest): =20 diff --git a/tests/functional/test_ppc_40p.py b/tests/functional/test_ppc_4= 0p.py index 67bcdae53a..496282b164 100755 --- a/tests/functional/test_ppc_40p.py +++ b/tests/functional/test_ppc_40p.py @@ -10,8 +10,7 @@ import os =20 from unittest import skipUnless -from qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern =20 =20 class IbmPrep40pMachine(QemuSystemTest): diff --git a/tests/functional/test_ppc_74xx.py b/tests/functional/test_ppc_= 74xx.py index 5386016f26..1c3e6b2c94 100755 --- a/tests/functional/test_ppc_74xx.py +++ b/tests/functional/test_ppc_74xx.py @@ -7,8 +7,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 qemu_test import QemuSystemTest -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, wait_for_console_pattern =20 class ppc74xxCpu(QemuSystemTest): =20 diff --git a/tests/functional/test_ppc_amiga.py b/tests/functional/test_ppc= _amiga.py index b793b5c432..e92489fdb2 100755 --- a/tests/functional/test_ppc_amiga.py +++ b/tests/functional/test_ppc_amiga.py @@ -9,8 +9,7 @@ =20 import subprocess =20 -from qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern, run_cmd +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern, run= _cmd from zipfile import ZipFile =20 class AmigaOneMachine(QemuSystemTest): diff --git a/tests/functional/test_ppc_bamboo.py b/tests/functional/test_pp= c_bamboo.py index e72cbdee12..71b30781f1 100755 --- a/tests/functional/test_ppc_bamboo.py +++ b/tests/functional/test_ppc_bamboo.py @@ -8,9 +8,9 @@ # later. See the COPYING file in the top-level directory. =20 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 +from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, + exec_command_and_wait_for_pattern) + =20 class BambooMachine(QemuSystemTest): =20 diff --git a/tests/functional/test_ppc_mpc8544ds.py b/tests/functional/test= _ppc_mpc8544ds.py index 2b3f0894ae..746efda1ae 100755 --- a/tests/functional/test_ppc_mpc8544ds.py +++ b/tests/functional/test_ppc_mpc8544ds.py @@ -8,8 +8,7 @@ # later. See the COPYING file in the top-level directory. =20 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 QemuSystemTest, Asset, wait_for_console_pattern =20 class Mpc8544dsMachine(QemuSystemTest): =20 diff --git a/tests/functional/test_ppc_virtex_ml507.py b/tests/functional/t= est_ppc_virtex_ml507.py index ffa9a0633e..3c49d41341 100755 --- a/tests/functional/test_ppc_virtex_ml507.py +++ b/tests/functional/test_ppc_virtex_ml507.py @@ -8,8 +8,7 @@ # later. See the COPYING file in the top-level directory. =20 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 QemuSystemTest, Asset, wait_for_console_pattern =20 class VirtexMl507Machine(QemuSystemTest): =20 diff --git a/tests/functional/test_riscv_opensbi.py b/tests/functional/test= _riscv_opensbi.py index d077e40f42..bccc2b2fe1 100755 --- a/tests/functional/test_riscv_opensbi.py +++ b/tests/functional/test_riscv_opensbi.py @@ -7,8 +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 qemu_test import QemuSystemTest -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, wait_for_console_pattern + =20 class RiscvOpenSBI(QemuSystemTest): =20 diff --git a/tests/functional/test_rx_gdbsim.py b/tests/functional/test_rx_= gdbsim.py index 5687f756bb..6306863519 100755 --- a/tests/functional/test_rx_gdbsim.py +++ b/tests/functional/test_rx_gdbsim.py @@ -13,9 +13,9 @@ import os =20 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 import (QemuSystemTest, Asset, + exec_command_and_wait_for_pattern, + wait_for_console_pattern) from qemu_test.utils import gzip_uncompress =20 =20 diff --git a/tests/functional/test_s390x_ccw_virtio.py b/tests/functional/t= est_s390x_ccw_virtio.py index f7acd90a89..c9d4730856 100755 --- a/tests/functional/test_s390x_ccw_virtio.py +++ b/tests/functional/test_s390x_ccw_virtio.py @@ -14,9 +14,9 @@ import os import tempfile =20 -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 import (QemuSystemTest, Asset, + exec_command_and_wait_for_pattern, + wait_for_console_pattern) from qemu_test.utils import lzma_uncompress =20 class S390CCWVirtioMachine(QemuSystemTest): diff --git a/tests/functional/test_s390x_topology.py b/tests/functional/tes= t_s390x_topology.py index c54c7a8177..6bf64f09fe 100755 --- a/tests/functional/test_s390x_topology.py +++ b/tests/functional/test_s390x_topology.py @@ -12,10 +12,9 @@ =20 import os =20 -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 import (QemuSystemTest, Asset, exec_command, + exec_command_and_wait_for_pattern, + wait_for_console_pattern) from qemu_test.utils import lzma_uncompress =20 =20 diff --git a/tests/functional/test_sh4eb_r2d.py b/tests/functional/test_sh4= eb_r2d.py index cd46007942..66daf8add4 100755 --- a/tests/functional/test_sh4eb_r2d.py +++ b/tests/functional/test_sh4eb_r2d.py @@ -7,8 +7,8 @@ import os import shutil =20 -from qemu_test import LinuxKernelTest, Asset -from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import (LinuxKernelTest, Asset, + exec_command_and_wait_for_pattern) from qemu_test.utils import archive_extract =20 class R2dEBTest(LinuxKernelTest): diff --git a/tests/functional/test_sparc64_sun4u.py b/tests/functional/test= _sparc64_sun4u.py index 32e245f4ad..798d6c3fb5 100755 --- a/tests/functional/test_sparc64_sun4u.py +++ b/tests/functional/test_sparc64_sun4u.py @@ -12,8 +12,7 @@ =20 import os =20 -from qemu_test import QemuSystemTest, Asset -from qemu_test import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern from qemu_test.utils import archive_extract =20 class Sun4uMachine(QemuSystemTest): diff --git a/tests/functional/test_virtio_gpu.py b/tests/functional/test_vi= rtio_gpu.py index d5027487ac..bc3b00e497 100755 --- a/tests/functional/test_virtio_gpu.py +++ b/tests/functional/test_virtio_gpu.py @@ -6,12 +6,10 @@ # later. See the COPYING file in the top-level directory. =20 =20 -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 - +from qemu_test import (BUILD_DIR, QemuSystemTest, Asset, + wait_for_console_pattern, + exec_command_and_wait_for_pattern, + is_readable_executable_file) from qemu.utils import kvm_available =20 import os --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901612; cv=none; d=zohomail.com; s=zohoarc; b=Re+4My/gqOFgqCEJxB5lqWv1B0NGBgrw6y2KHJrdZFibenVJTfZwVl8sodQjkglL/b/y7kVRbBKiupGH7Vz4LoW8uQ3pqB70YanwzJ7cT9lowN9aSOdyFPqhLzePv2MzgvH/B/LWQzZkQuH4qPnOTsEEZDjrr/rF2pkXn/Hnmbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901612; 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=csgqNr2EgbBVnTTOQh6QCPlwoDSZHxd2hq45bB3+iSg=; b=UVueIZ79+F7D+wqSBPDTi7kNHuDXlqEmTTkwbHErvDuZPm3Q7VC9SmOLhE4D10//KWZvg5JetL0wIASEUTFimm4CzVCvb5zYN1Y2z11fmUN4R10FK23PfJVQGw+4DeJc/wU2NfrQeEb13O8zp7VEHDZ3e14IQkyG9mzxA7lUUkU= 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 1732901612813480.6499814769903; Fri, 29 Nov 2024 09:33:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qE-0003Wg-QJ; Fri, 29 Nov 2024 12:31:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qC-0003Vt-PD for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:40 -0500 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 1tH4qB-0000qP-Ax for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:40 -0500 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-136-xgOiPCsnMSqbX7fH5dDSAw-1; Fri, 29 Nov 2024 12:31:36 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 329C31955D42; Fri, 29 Nov 2024 17:31:35 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3CEEF1955F41; Fri, 29 Nov 2024 17:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901497; 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=csgqNr2EgbBVnTTOQh6QCPlwoDSZHxd2hq45bB3+iSg=; b=YwFcalXcaHlKLVIALhcLKNo85jpHwBM7Cn1aYj1JHmaUDWhW+lEQJ6XetYsRN27Pcf4+U6 MZQfhRwAcvT8lWmnyDUpfKNo8cZhr9mKxExw12pFmgQAQixkm4/qRfiuvGerEpFKCh5t2a G+f0F+Lv3s5TgNsffcnVd/Koq8jatMY= X-MC-Unique: xgOiPCsnMSqbX7fH5dDSAw-1 X-Mimecast-MFC-AGG-ID: xgOiPCsnMSqbX7fH5dDSAw From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 04/22] tests/functional: remove pointless with statement Date: Fri, 29 Nov 2024 17:31:02 +0000 Message-ID: <20241129173120.761728-5-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901614769019100 The xorriso command directly writes to 'filename', so the surrounding 'with' statement is pointless. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/test_ppc64_hv.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc6= 4_hv.py index c31432d18d..53bae90401 100755 --- a/tests/functional/test_ppc64_hv.py +++ b/tests/functional/test_ppc64_hv.py @@ -72,10 +72,9 @@ def extract_from_iso(self, iso, path): cwd =3D os.getcwd() os.chdir(self.workdir) =20 - with open(filename, "w") as outfile: - cmd =3D "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, pat= h, filename) - subprocess.run(cmd.split(), - stdout=3Dsubprocess.DEVNULL, stderr=3Dsubproces= s.DEVNULL) + cmd =3D "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, f= ilename) + subprocess.run(cmd.split(), + stdout=3Dsubprocess.DEVNULL, stderr=3Dsubprocess.DE= VNULL) =20 os.chmod(filename, 0o600) os.chdir(cwd) --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901748; cv=none; d=zohomail.com; s=zohoarc; b=Hr2ancHyiccPndyWm+M/nxgGjfdlV4eP2ATyYql9wsPET2qZR8EtIU12oH08XNG5xD3xT68cgQhysBxLWFPvO433T+k5I7fDizo7dqV3bNtFOnCVpjm+EdXxyp2kqN/vsGCQXFbSI/jcDfSZAycBHJOIPtK4Ts+FTYt99zdXJOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901748; 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=DpH98FjxHZ1UVnVesB0HAAW6c+0dIFSrTacLuFyVkfg=; b=hDJFDz1+pCfR+9ykYVwPJmXUKrmIPc7DzvB6sn3el5rKz3ywqCxlqUWrlUkvnawMNcSOlKSpO64vsrOakMkbDibzbv3xGH1lJj/PChP28HXhVSgoiHVQ1sP1ywHIAAVRduTPv+S9aJxMmmy1VYMHXyZn8+hbRt6//jI2GkqddZo= 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 1732901748490782.7038269365862; Fri, 29 Nov 2024 09:35:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qI-0003XV-RM; Fri, 29 Nov 2024 12:31:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qG-0003Wy-N8 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:44 -0500 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 1tH4qF-0000s0-2h for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:44 -0500 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-48-FtXx4xptOdO7FA-MwmeH2A-1; Fri, 29 Nov 2024 12:31:39 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 F192E1955EA9; Fri, 29 Nov 2024 17:31:37 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F1B371955F41; Fri, 29 Nov 2024 17:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901502; 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=DpH98FjxHZ1UVnVesB0HAAW6c+0dIFSrTacLuFyVkfg=; b=L7VPcpRcU/czl12HMekpXfhcYH9D05gt997jb0W+SRCLiMfUpZojOu3ns0vOo8YOv3XlbK 9jIL+hPKxqHMX7HSsHIZi4lCCg+LygRtDtxbbOGo/G0ZlrmWQkqCpGAqI91I4ZaH/LiSSs eVJM/M+1E2aLm4O075BFoFB9PucciMc= X-MC-Unique: FtXx4xptOdO7FA-MwmeH2A-1 X-Mimecast-MFC-AGG-ID: FtXx4xptOdO7FA-MwmeH2A From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 05/22] tests/functional: remove duplicated 'which' function impl Date: Fri, 29 Nov 2024 17:31:03 +0000 Message-ID: <20241129173120.761728-6-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901761572019100 Put the 'which' function into shared code. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Richard Henderson --- tests/functional/qemu_test/__init__.py | 2 +- tests/functional/qemu_test/cmd.py | 10 ++++++++++ tests/functional/test_acpi_bits.py | 13 +------------ tests/functional/test_ppc64_hv.py | 13 +------------ 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu= _test/__init__.py index 67f87be9c4..8fddddbe67 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -10,6 +10,6 @@ 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, get_qemu_img + exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest from .linuxkernel import LinuxKernelTest diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test= /cmd.py index 11c8334a7c..4106f1ee7c 100644 --- a/tests/functional/qemu_test/cmd.py +++ b/tests/functional/qemu_test/cmd.py @@ -18,6 +18,16 @@ =20 from .config import BUILD_DIR =20 +def which(tool): + """ looks up the full path for @tool, returns None if not found + or if @tool does not have executable permissions. + """ + paths=3Dos.getenv('PATH') + for p in paths.split(os.path.pathsep): + p =3D os.path.join(p, tool) + if os.path.exists(p) and os.access(p, os.X_OK): + return p + return None =20 def has_cmd(name, args=3DNone): """ diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp= i_bits.py index 6fc49a30bc..4162faf414 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -49,7 +49,7 @@ ) from qemu.machine import QEMUMachine from unittest import skipIf -from qemu_test import QemuBaseTest, Asset +from qemu_test import QemuBaseTest, Asset, which =20 deps =3D ["xorriso", "mformat"] # dependent tools needed in the test setup= /box. supported_platforms =3D ['x86_64'] # supported test platforms. @@ -57,17 +57,6 @@ # default timeout of 120 secs is sometimes not enough for bits test. BITS_TIMEOUT =3D 200 =20 -def which(tool): - """ looks up the full path for @tool, returns None if not found - or if @tool does not have executable permissions. - """ - paths=3Dos.getenv('PATH') - for p in paths.split(os.path.pathsep): - p =3D os.path.join(p, tool) - if os.path.exists(p) and os.access(p, os.X_OK): - return p - return None - def missing_deps(): """ returns True if any of the test dependent tools are absent. """ diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc6= 4_hv.py index 53bae90401..cc77cd22b1 100755 --- a/tests/functional/test_ppc64_hv.py +++ b/tests/functional/test_ppc64_hv.py @@ -11,7 +11,7 @@ =20 from unittest import skipIf, skipUnless from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, - exec_command) + exec_command, which) import os import time import subprocess @@ -19,17 +19,6 @@ =20 deps =3D ["xorriso"] # dependent tools needed in the test setup/box. =20 -def which(tool): - """ looks up the full path for @tool, returns None if not found - or if @tool does not have executable permissions. - """ - paths=3Dos.getenv('PATH') - for p in paths.split(os.path.pathsep): - p =3D os.path.join(p, tool) - if os.path.exists(p) and os.access(p, os.X_OK): - return p - return None - def missing_deps(): """ returns True if any of the test dependent tools are absent. """ --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901735; cv=none; d=zohomail.com; s=zohoarc; b=k1CgnywDtBbtL+/hLP6x0kVuOSBq9ChCUJx3HdfMJyHOPb4IQ6uVqb+iBPYxw5Lgp8fzNBO0Pg0QNS9FyL0Zhz5Hc/FqefVvp1fY+iNbioQcIS2+P1F3Lv7F+DbBPsY0nOkmsjWOVY+i8b3iNrsOgkljOChxZIC7vGk2jXZ3O1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901735; 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=41MScyuoH6TE7bbmCTMEw2wCRLMzaMVg00srWkvrbS0=; b=EGx+GbbXqiY86G1Uttkeltz6lgyoVgM58ogoNwbPBZtV/y2327iLBctQxfZW0aMEAuE3GcX9B1L9JtkiDkuLmN386bP/7Va3ELK1wZN5M+2qkOA9UwuVgTXCXA8Xo3M4Xa/YqDRQK3Cp2HU/ouPuOWpyAn5esxNjWARwApYRlWk= 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 1732901735132166.35168001555007; Fri, 29 Nov 2024 09:35:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qI-0003XU-SC; Fri, 29 Nov 2024 12:31:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qH-0003X7-Du for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:45 -0500 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 1tH4qF-0000sM-GB for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:45 -0500 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-617-79IKLt3LNnOVWUWdANY1sA-1; Fri, 29 Nov 2024 12:31:41 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 4FB261955EB1; Fri, 29 Nov 2024 17:31:40 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 746471955F2D; Fri, 29 Nov 2024 17:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901502; 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=41MScyuoH6TE7bbmCTMEw2wCRLMzaMVg00srWkvrbS0=; b=cBftoLBxxJCjtEO2Id9pmQvkiouNuJatnIIVIV2PQTioydM2vPPLGPV8y3JuzV5WzCm3Xv PfY03W2RzTUtoUAG2jVZSWCumQi36prRQkFm90tx1tZgjhbmlRJwAd140cLaGxYCrUqCLh JeSu1xNj5KiKMMZEHyhDpns8aV8P17Q= X-MC-Unique: 79IKLt3LNnOVWUWdANY1sA-1 X-Mimecast-MFC-AGG-ID: 79IKLt3LNnOVWUWdANY1sA From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 06/22] tests/functional: introduce some helpful decorators Date: Fri, 29 Nov 2024 17:31:04 +0000 Message-ID: <20241129173120.761728-7-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901744549019100 Reduce repeated boilerplate with some helper decorators: @skipIfNotPlatform("x86_64", "aarch64") =3D> Skip unless the build host platform matches @skipIfMissingCommands("mkisofs", "losetup") =3D> Skips unless all listed commands are found in $PATH @skipIfMissingImports("numpy", "cv2") =3D> Skips unless all listed modules can be imported @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/issues/NNN") =3D> Skips unless env var requests flaky tests with the reason documented in the referenced gitlab bug @skipBigData =3D> Skips unless env var permits tests creating big data files @skipUntrustedTest =3D> Skips unless env var permits tests which are potentially dangerous to the host Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/__init__.py | 3 + tests/functional/qemu_test/decorators.py | 105 +++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 tests/functional/qemu_test/decorators.py diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu= _test/__init__.py index 8fddddbe67..7dee3522f2 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -13,3 +13,6 @@ exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest from .linuxkernel import LinuxKernelTest +from .decorators import skipIfMissingCommands, skipIfNotMachine, \ + skipFlakyTest, skipUntrustedTest, skipBigDataTest, \ + skipIfMissingImports diff --git a/tests/functional/qemu_test/decorators.py b/tests/functional/qe= mu_test/decorators.py new file mode 100644 index 0000000000..d25fec7b2d --- /dev/null +++ b/tests/functional/qemu_test/decorators.py @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Decorators useful in functional tests + +import os +import platform +from unittest import skipUnless + +from .cmd import which + +''' +Decorator to skip execution of a test if the list +of command binaries is not available in $PATH. +Example: + + @skipIfMissingCommands("mkisofs", "losetup") +''' +def skipIfMissingCommands(*args): + def has_cmds(cmdlist): + for cmd in cmdlist: + if not which(cmd): + return False + return True + + return skipUnless(lambda: has_cmds(args), + 'required commands(s) "%s" not installed' % + ", ".join(args)) + +''' +Decorator to skip execution of a test if the current +host machine does not match one of the permitted +machines. +Example + + @skipIfNotMachine("x86_64", "aarch64") +''' +def skipIfNotMachine(*args): + return skipUnless(lambda: platform.machine() in args, + 'not running on required machine(s) "%s"' % + ", ".join(args)) + +''' +Decorator to skip execution of flaky tests, unless +the $QEMU_TEST_FLAKY_TESTS env var is set. A bug URL +must be provided that documents the observed failure +behaviour, so it can be tracked & re-evaluated in future. + +Historical tests may be providing "None" as the bug_url +but this should not be done for new test. + +Example: + + @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/issues/NNN") +''' +def skipFlakyTest(bug_url): + if bug_url is None: + bug_url =3D "FIXME: reproduce flaky test and file bug report or re= move" + return skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), + f'Test is unstable: {bug_url}') + +''' +Decorator to skip execution of tests which are likely +to execute untrusted commands on the host, or commands +which process untrusted code, unles the +$QEMU_TEST_ALLOW_UNTRUSTED_CODE env var is set. +Example: + + @skipUntrustedTest() +''' +def skipUntrustedTest(): + return skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), + 'Test runs untrusted code / processes untrusted data= ') + +''' +Decorator to skip execution of tests which need large +data storage on the host, unless the +$QEMU_TEST_ALLOW_LARGE_STORAGE env var is set + +Example: + + @skipBigDataTest() +''' +def skipBigDataTest(): + return skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), + 'Test required large host storage space') + +''' +Decorator to skip execution of a test if the list +of python imports is not available. +Example: + + @skipIfMissingImports("numpy", "cv2") +''' +def skipIfMissingImports(*args): + def has_imports(importlist): + for impname in importlist: + try: + import impname + except ImportError: + return False + return True + + return skipUnless(lambda: has_imports(args), + 'required imports(s) "%s" not installed' % + ", ".join(args)) --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901538; cv=none; d=zohomail.com; s=zohoarc; b=Ll4AzDyvizy5iZqvv/2CJsCwfMkucIfl/+Ny4whLPrwhI0y+l+riWy7UO/+ZzyMkoLTm2lM/KGFSzrIt5jqCSHP/YH9LJFzLgAaI/YizCCq4gccH0nScPvgNf2ta0+YZR1EgmljNiEEXdlAqOYtATbKJJLITDpaTw7Q2M4jCvIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901538; 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=JAK1NwpolBu4HfcXYebhJQgGNTwUecncidi+yuhM/+g=; b=Smp5W/Zg7NBWvz3rGBZF+1ckgSTUeQlCjFhXFbKTt023a2g8Ro8Npy//kZ8BBYoxWWsdJPCzIBCKTXiGLk7WeOXYIi3UADcnlic80cG6tKYdu4F2rZ8pi5AIfWZdvOsqvfchwIUlytpf2cn7ZB1+XoFN0yKjx/qeyRqzzL2fGFE= 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 1732901538834924.0460031761637; Fri, 29 Nov 2024 09:32:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qO-0003Ye-Oc; Fri, 29 Nov 2024 12:31:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qN-0003YJ-3p for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:51 -0500 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 1tH4qK-0000tS-IA for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:50 -0500 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-487-I3RFhJpZMhOGBOBQdHrslA-1; Fri, 29 Nov 2024 12:31:44 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 AF5FD1955F37; Fri, 29 Nov 2024 17:31:43 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A7E4F1955F41; Fri, 29 Nov 2024 17:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901507; 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=JAK1NwpolBu4HfcXYebhJQgGNTwUecncidi+yuhM/+g=; b=XvM58+TxDHaeRKTTyZvIuv6PFowMMmPQJkirZDClvnn3AA5WrljQo+8qEAAgxID1VrBcA6 uEklAWRMFTWuPfIMz2WJOp9bNWvbdFH/z9DXajsa+qTD9HvWk3/mwEw6f06/CzGiVuzpi1 ydvyO4KQfAipJ9itNaD7hoy5veOXUwU= X-MC-Unique: I3RFhJpZMhOGBOBQdHrslA-1 X-Mimecast-MFC-AGG-ID: I3RFhJpZMhOGBOBQdHrslA From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 07/22] tests/functional: switch to new test skip decorators Date: Fri, 29 Nov 2024 17:31:05 +0000 Message-ID: <20241129173120.761728-8-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901541278019100 This ensures consistency of behaviour across all the tests, and requires that we provide gitlab bug links when marking a test to be skipped due to unreliability. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/test_acpi_bits.py | 24 +++------------- tests/functional/test_arm_aspeed.py | 6 ++-- tests/functional/test_arm_bflt.py | 7 +++-- tests/functional/test_arm_bpim2u.py | 7 +++-- tests/functional/test_arm_integratorcp.py | 27 ++++++------------ tests/functional/test_arm_orangepi.py | 8 +++--- tests/functional/test_linux_initrd.py | 7 ++--- tests/functional/test_m68k_nextcube.py | 14 +++------ tests/functional/test_mips64el_loongson3v.py | 8 +++--- tests/functional/test_mips64el_malta.py | 30 +++++++------------- tests/functional/test_ppc64_hv.py | 17 ++--------- tests/functional/test_ppc_40p.py | 8 ++---- tests/functional/test_rx_gdbsim.py | 6 ++-- tests/functional/test_sh4_r2d.py | 8 ++---- 14 files changed, 62 insertions(+), 115 deletions(-) diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp= i_bits.py index 4162faf414..4de5fae37e 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -48,28 +48,13 @@ Sequence, ) from qemu.machine import QEMUMachine -from unittest import skipIf -from qemu_test import QemuBaseTest, Asset, which +from qemu_test import (QemuBaseTest, Asset, skipIfMissingCommands, + skipIfNotMachine) =20 -deps =3D ["xorriso", "mformat"] # dependent tools needed in the test setup= /box. -supported_platforms =3D ['x86_64'] # supported test platforms. =20 # default timeout of 120 secs is sometimes not enough for bits test. BITS_TIMEOUT =3D 200 =20 -def missing_deps(): - """ returns True if any of the test dependent tools are absent. - """ - for dep in deps: - if which(dep) is None: - return True - return False - -def supported_platform(): - """ checks if the test is running on a supported platform. - """ - return platform.machine() in supported_platforms - class QEMUBitsMachine(QEMUMachine): # pylint: disable=3Dtoo-few-public-met= hods """ A QEMU VM, with isa-debugcon enabled and bits iso passed @@ -112,9 +97,8 @@ def base_args(self): """return the base argument to QEMU binary""" return self._base_args =20 -@skipIf(not supported_platform() or missing_deps(), - 'unsupported platform or dependencies (%s) not installed' \ - % ','.join(deps)) +@skipIfMissingCommands("xorriso", "mformat") +@skipIfNotMachine("x86_64") class AcpiBitsTest(QemuBaseTest): #pylint: disable=3Dtoo-many-instance-att= ributes """ ACPI and SMBIOS tests using biosbits. diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar= m_aspeed.py index 068740a813..db872ff05e 100755 --- a/tests/functional/test_arm_aspeed.py +++ b/tests/functional/test_arm_aspeed.py @@ -13,7 +13,9 @@ =20 from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern, - interrupt_interactive_console_until_pattern, has_cm= d) + interrupt_interactive_console_until_pattern, + skipIfMissingCommands, +) from qemu_test.utils import archive_extract from zipfile import ZipFile from unittest import skipUnless @@ -218,7 +220,7 @@ def test_arm_ast2600_evb_buildroot(self): 'images/ast2600-evb/buildroot-2023.02-tpm/flash.img'), 'a46009ae8a5403a0826d607215e731a8c68d27c14c41e55331706b8f9c7bd997') =20 - @skipUnless(*has_cmd('swtpm')) + @skipIfMissingCommands('swtpm') def test_arm_ast2600_evb_buildroot_tpm(self): self.set_machine('ast2600-evb') =20 diff --git a/tests/functional/test_arm_bflt.py b/tests/functional/test_arm_= bflt.py index cd417ebcfc..74d04fd381 100755 --- a/tests/functional/test_arm_bflt.py +++ b/tests/functional/test_arm_bflt.py @@ -10,8 +10,9 @@ import bz2 =20 from qemu_test import QemuUserTest, Asset, has_cmd +from qemu_test import (QemuUserTest, Asset, skipIfMissingCommands, + skipUntrustedTest) from qemu_test.utils import cpio_extract -from unittest import skipUnless =20 =20 class LoadBFLT(QemuUserTest): @@ -20,8 +21,8 @@ class LoadBFLT(QemuUserTest): ('https://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2'), 'eefb788e4980c9e8d6c9d60ce7d15d4da6bf4fbc6a80f487673824600d5ba9cc= ') =20 - @skipUnless(*has_cmd('cpio')) - @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + @skipIfMissingCommands('cpio') + @skipUntrustedTest() def test_stm32(self): # See https://elinux.org/STM32#User_Space rootfs_path_bz2 =3D self.ASSET_ROOTFS.fetch() diff --git a/tests/functional/test_arm_bpim2u.py b/tests/functional/test_ar= m_bpim2u.py index 7b1b0a270f..d2108fd4ea 100755 --- a/tests/functional/test_arm_bpim2u.py +++ b/tests/functional/test_arm_bpim2u.py @@ -8,10 +8,11 @@ import os =20 from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, - Asset, interrupt_interactive_console_until_pattern) + Asset, interrupt_interactive_console_until_pattern, + skipBigDataTest) from qemu_test.utils import (archive_extract, gzip_uncompress, lzma_uncomp= ress, image_pow2ceil_expand) -from unittest import skipUnless + =20 class BananaPiMachine(LinuxKernelTest): =20 @@ -143,7 +144,7 @@ def test_arm_bpim2u_gmac(self): os.remove(dtb_path) os.remove(rootfs_path) =20 - @skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limit= ed') + @skipBigDataTest() def test_arm_bpim2u_openwrt_22_03_3(self): self.set_machine('bpim2u') # This test download a 8.9 MiB compressed image and expand it diff --git a/tests/functional/test_arm_integratorcp.py b/tests/functional/t= est_arm_integratorcp.py index c2c6ff6ac5..a13e82bd31 100755 --- a/tests/functional/test_arm_integratorcp.py +++ b/tests/functional/test_arm_integratorcp.py @@ -15,21 +15,8 @@ import os import logging =20 -from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern -from unittest import skipUnless - - -NUMPY_AVAILABLE =3D True -try: - import numpy as np -except ImportError: - NUMPY_AVAILABLE =3D False - -CV2_AVAILABLE =3D True -try: - import cv2 -except ImportError: - CV2_AVAILABLE =3D False +from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, + skipIfMissingImports, skipUntrustedTest) =20 =20 class IntegratorMachine(QemuSystemTest): @@ -62,7 +49,7 @@ def boot_integratorcp(self): '-append', 'printk.time=3D0 console=3DttyAMA0') self.vm.launch() =20 - @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + @skipUntrustedTest() def test_integratorcp_console(self): """ Boots the Linux kernel and checks that the console is operational @@ -70,13 +57,15 @@ def test_integratorcp_console(self): 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('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + @skipIfMissingImports("numpy", "cv2") + @skipUntrustedTest() def test_framebuffer_tux_logo(self): """ Boot Linux and verify the Tux logo is displayed on the framebuffer. """ + import numpy as np + import cv2 + screendump_path =3D os.path.join(self.workdir, "screendump.pbm") tuxlogo_path =3D self.ASSET_TUXLOGO.fetch() =20 diff --git a/tests/functional/test_arm_orangepi.py b/tests/functional/test_= arm_orangepi.py index 676327e8ef..7974010320 100755 --- a/tests/functional/test_arm_orangepi.py +++ b/tests/functional/test_arm_orangepi.py @@ -10,10 +10,10 @@ =20 from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, Asset, interrupt_interactive_console_until_pattern, - wait_for_console_pattern) + wait_for_console_pattern, skipBigDataTest) from qemu_test.utils import (archive_extract, gzip_uncompress, lzma_uncomp= ress, image_pow2ceil_expand) -from unittest import skipUnless + =20 class BananaPiMachine(LinuxKernelTest): =20 @@ -149,7 +149,7 @@ def test_arm_orangepi_sd(self): os.remove(dtb_path) os.remove(rootfs_path) =20 - @skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limit= ed') + @skipBigDataTest() def test_arm_orangepi_armbian(self): self.set_machine('orangepi-pc') # This test download a 275 MiB compressed image and expand it @@ -185,7 +185,7 @@ def test_arm_orangepi_armbian(self): 'to ') self.wait_for_console_pattern('Starting Load Kernel Modules...') =20 - @skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limit= ed') + @skipBigDataTest() def test_arm_orangepi_uboot_netbsd9(self): self.set_machine('orangepi-pc') # This test download a 304MB compressed image and expand it to 2GB diff --git a/tests/functional/test_linux_initrd.py b/tests/functional/test_= linux_initrd.py index c71a59d4c9..2207f83fbf 100755 --- a/tests/functional/test_linux_initrd.py +++ b/tests/functional/test_linux_initrd.py @@ -10,12 +10,10 @@ # 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 os import logging import tempfile =20 -from qemu_test import QemuSystemTest, Asset -from unittest import skipUnless +from qemu_test import QemuSystemTest, Asset, skipFlakyTest =20 =20 class LinuxInitrd(QemuSystemTest): @@ -60,7 +58,8 @@ def test_with_2gib_file_should_exit_error_msg_with_linux_= v3_6(self): max_size + 1) self.assertRegex(self.vm.get_log(), expected_msg) =20 - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') + # XXX file tracking bug + @skipFlakyTest(bug_url=3DNone) def test_with_2gib_file_should_work_with_linux_v4_16(self): """ QEMU has supported up to 4 GiB initrd for recent kernel diff --git a/tests/functional/test_m68k_nextcube.py b/tests/functional/test= _m68k_nextcube.py index 0124622c40..82d3d335d0 100755 --- a/tests/functional/test_m68k_nextcube.py +++ b/tests/functional/test_m68k_nextcube.py @@ -10,16 +10,9 @@ import os import time =20 -from qemu_test import QemuSystemTest, Asset -from unittest import skipUnless - +from qemu_test import QemuSystemTest, Asset, skipIfMissingImports from qemu_test.tesseract import tesseract_available, tesseract_ocr - -PIL_AVAILABLE =3D True -try: - from PIL import Image -except ImportError: - PIL_AVAILABLE =3D False +from unittest import skipUnless =20 =20 class NextCubeMachine(QemuSystemTest): @@ -43,12 +36,13 @@ def check_bootrom_framebuffer(self, screenshot_path): self.vm.cmd('human-monitor-command', command_line=3D'screendump %s' % screenshot_path) =20 - @skipUnless(PIL_AVAILABLE, 'Python PIL not installed') + @skipIfMissingImports("PIL") 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 + from PIL import Image width, height =3D Image.open(screenshot_path).size self.assertEqual(width, 1120) self.assertEqual(height, 832) diff --git a/tests/functional/test_mips64el_loongson3v.py b/tests/functiona= l/test_mips64el_loongson3v.py index 06032a3a6b..2d1a94e517 100755 --- a/tests/functional/test_mips64el_loongson3v.py +++ b/tests/functional/test_mips64el_loongson3v.py @@ -9,10 +9,10 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from unittest import skipUnless -from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern +from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, + skipUntrustedTest) + =20 class MipsLoongson3v(QemuSystemTest): timeout =3D 60 @@ -22,7 +22,7 @@ class MipsLoongson3v(QemuSystemTest): 'releases/download/20210112/pmon-3avirt.bin'), 'fcdf6bb2cb7885a4a62f31fcb0d5e368bac7b6cea28f40c6dfa678af22fea20a') =20 - @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + @skipUntrustedTest() def test_pmon_serial_console(self): self.set_machine('loongson3-virt') =20 diff --git a/tests/functional/test_mips64el_malta.py b/tests/functional/tes= t_mips64el_malta.py index b5959d33ea..ccb9616f68 100755 --- a/tests/functional/test_mips64el_malta.py +++ b/tests/functional/test_mips64el_malta.py @@ -13,21 +13,9 @@ import logging =20 from qemu_test import (LinuxKernelTest, Asset, - exec_command_and_wait_for_pattern) + exec_command_and_wait_for_pattern, + skipIfMissingImports, skipFlakyTest, skipUntrustedT= est) from qemu_test.utils import gzip_uncompress -from unittest import skipUnless - -NUMPY_AVAILABLE =3D True -try: - import numpy as np -except ImportError: - NUMPY_AVAILABLE =3D False - -CV2_AVAILABLE =3D True -try: - import cv2 -except ImportError: - CV2_AVAILABLE =3D False =20 =20 class MaltaMachineConsole(LinuxKernelTest): @@ -76,7 +64,7 @@ def test_mips64el_malta(self): 'rootfs.mipsel64r1.cpio.gz'), '75ba10cd35fb44e32948eeb26974f061b703c81c4ba2fab1ebcacf1d1bec3b61') =20 - @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + @skipUntrustedTest() def test_mips64el_malta_5KEc_cpio(self): kernel_path =3D self.ASSET_KERNEL_3_19_3.fetch() initrd_path_gz =3D self.ASSET_CPIO_R1.fetch() @@ -106,8 +94,7 @@ def test_mips64el_malta_5KEc_cpio(self): self.vm.wait() =20 =20 -@skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') -@skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') +@skipIfMissingImports('numpy', 'cv2') class MaltaMachineFramebuffer(LinuxKernelTest): =20 timeout =3D 30 @@ -126,6 +113,10 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_cou= nt): """ Boot Linux kernel and check Tux logo is displayed on the framebuff= er. """ + + import numpy as np + import cv2 + screendump_path =3D os.path.join(self.workdir, 'screendump.pbm') =20 kernel_path_gz =3D self.ASSET_KERNEL_4_7_0.fetch() @@ -171,11 +162,12 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_co= unt): def test_mips_malta_i6400_framebuffer_logo_1core(self): self.do_test_i6400_framebuffer_logo(1) =20 - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') + # XXX file tracking bug + @skipFlakyTest(bug_url=3DNone) def test_mips_malta_i6400_framebuffer_logo_7cores(self): self.do_test_i6400_framebuffer_logo(7) =20 - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') + @skipFlakyTest(bug_url=3DNone) def test_mips_malta_i6400_framebuffer_logo_8cores(self): self.do_test_i6400_framebuffer_logo(8) =20 diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc6= 4_hv.py index cc77cd22b1..9ad69b4a15 100755 --- a/tests/functional/test_ppc64_hv.py +++ b/tests/functional/test_ppc64_hv.py @@ -9,24 +9,13 @@ # 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 unittest import skipIf, skipUnless from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, - exec_command, which) + exec_command, skipIfMissingCommands, skipBigDataTes= t) import os import time import subprocess from datetime import datetime =20 -deps =3D ["xorriso"] # dependent tools needed in the test setup/box. - -def missing_deps(): - """ returns True if any of the test dependent tools are absent. - """ - for dep in deps: - if which(dep) is None: - return True - return False - # Alpine is a light weight distro that supports QEMU. These tests boot # that on the machine then run a QEMU guest inside it in KVM mode, # that runs the same Alpine distro image. @@ -34,8 +23,8 @@ def missing_deps(): # large download, but it may be more polite to create qcow2 image with # 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('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limited') +@skipIfMissingCommands("xorriso") +@skipBigDataTest() class HypervisorTest(QemuSystemTest): =20 timeout =3D 1000 diff --git a/tests/functional/test_ppc_40p.py b/tests/functional/test_ppc_4= 0p.py index 496282b164..885b8e4ba2 100755 --- a/tests/functional/test_ppc_40p.py +++ b/tests/functional/test_ppc_40p.py @@ -7,10 +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 -import os - -from unittest import skipUnless -from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern +from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, + skipUntrustedTest) =20 =20 class IbmPrep40pMachine(QemuSystemTest): @@ -36,7 +34,7 @@ class IbmPrep40pMachine(QemuSystemTest): # 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('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted co= de') + @skipUntrustedTest() def test_factory_firmware_and_netbsd(self): self.set_machine('40p') self.require_accelerator("tcg") diff --git a/tests/functional/test_rx_gdbsim.py b/tests/functional/test_rx_= gdbsim.py index 6306863519..7461be0b46 100755 --- a/tests/functional/test_rx_gdbsim.py +++ b/tests/functional/test_rx_gdbsim.py @@ -12,10 +12,9 @@ =20 import os =20 -from unittest import skipUnless from qemu_test import (QemuSystemTest, Asset, exec_command_and_wait_for_pattern, - wait_for_console_pattern) + wait_for_console_pattern, skipFlakyTest) from qemu_test.utils import gzip_uncompress =20 =20 @@ -54,7 +53,8 @@ def test_uboot(self): # FIXME limit baudrate on chardev, else we type too fast #exec_command_and_wait_for_pattern(self, 'version', gcc_version) =20 - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') + # XXX file tracking bug + @skipFlakyTest(bug_url=3DNone) def test_linux_sash(self): """ Boots a Linux kernel and checks that the console is operational. diff --git a/tests/functional/test_sh4_r2d.py b/tests/functional/test_sh4_r= 2d.py index c3cfff79ad..e2fcde2d6b 100755 --- a/tests/functional/test_sh4_r2d.py +++ b/tests/functional/test_sh4_r2d.py @@ -4,11 +4,8 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - -from qemu_test import LinuxKernelTest, Asset +from qemu_test import LinuxKernelTest, Asset, skipFlakyTest from qemu_test.utils import archive_extract -from unittest import skipUnless =20 class R2dTest(LinuxKernelTest): =20 @@ -18,7 +15,8 @@ class R2dTest(LinuxKernelTest): =20 # This test has a 6-10% failure rate on various hosts that look # like issues with a buggy kernel. - @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable') + # XXX file tracking bug + @skipFlakyTest(bug_url=3DNone) def test_r2d(self): self.set_machine('r2d') file_path =3D self.ASSET_DAY09.fetch() --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901681; cv=none; d=zohomail.com; s=zohoarc; b=oEKWNUwvld6V7pShGPtQaDk1LoqwUtkMI/z254Cc88pj3dyMqShDbYSXYv7X+gXTk/gRHReRohHtBrPlJ23haf70GhcVVuW3Qzs+Ls2jozV6GBsXGHxrnE4pdIJtjwWnyvMk3y/eFcsAoElGRTVC74wx5FTlhl0p8IpQcL6e82Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901681; 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=IEBCRp8R1crKHkbALhGxflpLWO/EX7699lt8TYrhwA8=; b=jWuj47CAUOLhTVgfwM9X5d8zKZp4lkdDEVN6Bpffz/noCLf4nROM9x3QYL4Iu/AXhesealo0cwYCfNAXNP3CEhQ9+VHghnT3ztqDPDeOyFZMAcT63hvP/wCEGZWTTZGzJ+WjDOVSlvNla9+/MPgxKy5nJg4N5ZR3HBKuKloqf1k= 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 1732901681104689.6952398167805; Fri, 29 Nov 2024 09:34:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qW-0003dR-PA; Fri, 29 Nov 2024 12:32:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qT-0003Yz-Pj for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:58 -0500 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 1tH4qN-0000u6-E6 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:57 -0500 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-43-ScLcTQlCM0GOUlYoTZE2yQ-1; Fri, 29 Nov 2024 12:31:47 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 ED4EC1955DCA; Fri, 29 Nov 2024 17:31:45 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 325DE1955F41; Fri, 29 Nov 2024 17:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901510; 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=IEBCRp8R1crKHkbALhGxflpLWO/EX7699lt8TYrhwA8=; b=hXHQdvRy9qygNqsKDP4jVpnWInDyjUJFSgc2N3mWzn+Wh1/EzgmCZyFmi5GgWSL5ilNBRl mZV97Aiohh/zMSB41n7/RTIrwjuAozy1V+GCqyvnZbQ+lgtp7BiqnwbIm+AV8LgnDYvef+ 9kEueTxyF9wZu5LxXn/19DU2hFia3yU= X-MC-Unique: ScLcTQlCM0GOUlYoTZE2yQ-1 X-Mimecast-MFC-AGG-ID: ScLcTQlCM0GOUlYoTZE2yQ From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 08/22] tests/functional: add helpers for building file paths Date: Fri, 29 Nov 2024 17:31:06 +0000 Message-ID: <20241129173120.761728-9-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901683236019100 Add helper methods that construct paths for * log files - to be preserved at the end of a test * scratch files - to be purged at the end of a test * build files - anything relative to the build root * data files - anything relative to the functional test source root * socket files - a short temporary dir to avoid UNIX socket limits These are to be used instead of direct access to the self.workdir, or self.logdir variables, or any other place where paths are built manually. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/testcase.py | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index 90ae59eb54..fb62052817 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -13,10 +13,12 @@ =20 import logging import os +from pathlib import Path import pycotap import shutil import subprocess import sys +import tempfile import unittest import uuid =20 @@ -37,9 +39,93 @@ class QemuBaseTest(unittest.TestCase): log =3D None logdir =3D None =20 + def socket_dir(self): + if self.socketdir is None: + self.socketdir =3D tempfile.TemporaryDirectory( + prefix=3D"qemu_func_test_sock_") + return self.socketdir + + ''' + @params args list of zero or more subdirectories or file + + Construct a path for accessing a data file located + relative to the source directory that is the root for + functional tests. + + @args may be an empty list to reference the root dir + itself, may be a single element to reference a file in + the root directory, or may be multiple elements to + reference a file nested below. The path components + will be joined using the platform appropriate path + separator. + + Returns: a qualified path + ''' + def data_file(self, *args): + return str(Path(Path(__file__).parent.parent, *args)) + + ''' + @params args list of zero or more subdirectories or file + + Construct a path for accessing a data file located + relative to the build directory root. + + @args may be an empty list to reference the build dir + itself, may be a single element to reference a file in + the build directory, or may be multiple elements to + reference a file nested below. The path components + will be joined using the platform appropriate path + separator. + + Returns: a qualified path + ''' + def build_file(self, *args): + return str(Path(BUILD_DIR, *args)) + + ''' + @params args list of zero or more subdirectories or file + + Construct a path for accessing/creating a scratch file + located relative to a temporary directory dedicated to + this test case. The directory and its contents will be + purged upon completion of the test. + + @args may be an empty list to reference the scratch dir + itself, may be a single element to reference a file in + the scratch directory, or may be multiple elements to + reference a file nested below. The path components + will be joined using the platform appropriate path + separator. + + Returns: a qualified path + ''' + def scratch_file(self, *args): + return str(Path(self.workdir, *args)) + + ''' + @params args list of zero or more subdirectories or file + + Construct a path for accessing/creating a log file + located relative to a temporary directory dedicated to + this test case. The directory and its log files will be + preserved upon completion of the test. + + @args may be an empty list to reference the log dir + itself, may be a single element to reference a file in + the log directory, or may be multiple elements to + reference a file nested below. The path components + will be joined using the platform appropriate path + separator. + + Returns: a pathlib.Path object + ''' + def log_file(self, *args): + return str(Path(self.logdir, *args)) + 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.socketdir =3D None =20 self.outputdir =3D os.path.join(BUILD_DIR, 'tests', 'functional', self.arch, self.id()) --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901600; cv=none; d=zohomail.com; s=zohoarc; b=DNCMxIMTBKNvGcya8DIED4pvNKOJIjmJlbcpBAPXdyER265pwNJguYzypCV4l1AZKUmglyFlzZpPJHrvND7PpmCXMkinsgUVHIo+oj1ntelndgxAFfb8GHD7GzLLgBGv/5oTdiTCzUXlIMZ6XdjDcyLbfQkenqP5zxXYvHQBapQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901600; 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=60fXAkGpbatDaN18bfppjwiT4/neS/7FX3pQu/qDvgY=; b=TG8OJ3Qw+4FIkWkBGnDkeFIDxwQwwJ9f1bstelFrU3Cy91mTliNdmkNpzHCf4I9jeUpoQo2IHvT3iQfv2y3buVvxAasyxbiTavZOOLfXbYOEyF7H30bIFj5BnbQsOWYVXrqmALhRa65F7BKxKu6BQ/5upYO6z33K+YW069CUaIg= 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 1732901600881454.99884926635025; Fri, 29 Nov 2024 09:33:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qb-0003gR-4S; Fri, 29 Nov 2024 12:32:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qV-0003ZI-4A for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:59 -0500 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 1tH4qS-0000vC-ML for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:58 -0500 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-230-V5OQ-KfJNxW9oLOJLQLV8g-1; Fri, 29 Nov 2024 12:31:49 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 B3772195419B; Fri, 29 Nov 2024 17:31:48 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8BB401955F41; Fri, 29 Nov 2024 17:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901516; 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=60fXAkGpbatDaN18bfppjwiT4/neS/7FX3pQu/qDvgY=; b=i2/37XpCOAeVrhBEk70YP4LZdWZE8SwzgrzCJe9/hJ/QbjRTuLE3R+P3mX1uPRbTKyy4kA XvOzh3euOrOrPsraCM1gymBVcN/Qs9JfJKw4f4PGpsJWO1TUbgpDh3nlziCL+Nu6MGIWYy MdIhNbUafqLUPPT5nG7IzMvtT17Lu10= X-MC-Unique: V5OQ-KfJNxW9oLOJLQLV8g-1 X-Mimecast-MFC-AGG-ID: V5OQ-KfJNxW9oLOJLQLV8g From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 09/22] tests/functional: switch over to using self.log_file(...) Date: Fri, 29 Nov 2024 17:31:07 +0000 Message-ID: <20241129173120.761728-10-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901602660019100 This removes direct access of the 'self.logdir' variable. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/qemu_test/testcase.py | 9 ++++----- tests/functional/test_virtio_gpu.py | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index fb62052817..5b1e6ba04f 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -120,7 +120,7 @@ def scratch_file(self, *args): Returns: a pathlib.Path object ''' def log_file(self, *args): - return str(Path(self.logdir, *args)) + return str(Path(self.outputdir, *args)) =20 def setUp(self, bin_prefix): self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be= set') @@ -132,8 +132,7 @@ def setUp(self, bin_prefix): self.workdir =3D os.path.join(self.outputdir, 'scratch') os.makedirs(self.workdir, exist_ok=3DTrue) =20 - self.logdir =3D self.outputdir - self.log_filename =3D os.path.join(self.logdir, 'base.log') + self.log_filename =3D self.log_file('base.log') self.log =3D logging.getLogger('qemu-test') self.log.setLevel(logging.DEBUG) self._log_fh =3D logging.FileHandler(self.log_filename, mode=3D'w') @@ -206,7 +205,7 @@ def setUp(self): =20 console_log =3D logging.getLogger('console') console_log.setLevel(logging.DEBUG) - self.console_log_name =3D os.path.join(self.logdir, 'console.log') + self.console_log_name =3D self.log_file('console.log') self._console_log_fh =3D logging.FileHandler(self.console_log_name, mode=3D'w') self._console_log_fh.setLevel(logging.DEBUG) @@ -260,7 +259,7 @@ def _new_vm(self, name, *args): vm =3D QEMUMachine(self.qemu_bin, name=3Dname, base_temp_dir=3Dself.workdir, - log_dir=3Dself.logdir) + log_dir=3Dself.log_file()) self.log.debug('QEMUMachine "%s" created', name) self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir) =20 diff --git a/tests/functional/test_virtio_gpu.py b/tests/functional/test_vi= rtio_gpu.py index bc3b00e497..c4562618d9 100755 --- a/tests/functional/test_virtio_gpu.py +++ b/tests/functional/test_virtio_gpu.py @@ -99,9 +99,7 @@ def test_vhost_user_vga_virgl(self): os.set_inheritable(qemu_sock.fileno(), True) os.set_inheritable(vug_sock.fileno(), True) =20 - self._vug_log_path =3D os.path.join( - self.logdir, "vhost-user-gpu.log" - ) + self._vug_log_path =3D self.log_file("vhost-user-gpu.log") self._vug_log_file =3D open(self._vug_log_path, "wb") self.log.info('Complete vhost-user-gpu.log file can be ' 'found at %s', self._vug_log_path) --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901579; cv=none; d=zohomail.com; s=zohoarc; b=TznHPZ0rYtC+Frbw4WhG16FGk2kKQcnclBFY2S+yiVRp+ZY59KOTRCDfLJq7oRz4inofgu0NuW6ba+v7sKEzmaE28jpgnut8QEnXnpw5cXUNW3Ds7vrG3URBpegv/DvR/th7377iIZRs36iS3eweq7ae4F7xJ6p5P2T8cZ2quk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901579; 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=1BUYSjvolfDFV0ebffP6TEYi5KdSjqHPy0TkERoTTJE=; b=IRkkHJMxNy5HybULSFeoxG31LCnSSkSorrVoNcJgVD379nx6clq/b6+s14KEM9BVR7zW7eu0VE/aKyX745RdGMEiPT/G+vRhyiRp2gDPo4ndXULXup9i+5mWVWeiUpTnSlX8MFIKQj4kT0VzWEwC3QKzqAwKEfxy7zkhzdH4Y2k= 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 1732901579473537.7492012960145; Fri, 29 Nov 2024 09:32:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qb-0003gY-5I; Fri, 29 Nov 2024 12:32:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qU-0003Z6-CF for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:58 -0500 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 1tH4qS-0000vA-Jl for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:31:58 -0500 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-298-58q73RILOVulhGZ_XZbtUg-1; Fri, 29 Nov 2024 12:31:52 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 359BF1955F68; Fri, 29 Nov 2024 17:31:51 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 35DA61955F41; Fri, 29 Nov 2024 17:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901515; 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=1BUYSjvolfDFV0ebffP6TEYi5KdSjqHPy0TkERoTTJE=; b=fZ6zzuUjTWorin3FmIuNhrcSiCkNExQjddOFJhbO2L2xwELHJttW+dCriGIKl39EYFQree iQF2hnHUj/8aTZ4pcXOafD1ZciM8oCDBPiKsKHKeUYZb5kHhwKIxXW+MCFydBUKEfE3B65 Ss44qTbb//EtAbp2bOfwJR8awOsLejU= X-MC-Unique: 58q73RILOVulhGZ_XZbtUg-1 X-Mimecast-MFC-AGG-ID: 58q73RILOVulhGZ_XZbtUg From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 10/22] tests/functional: switch over to using self.build_file(...) Date: Fri, 29 Nov 2024 17:31:08 +0000 Message-ID: <20241129173120.761728-11-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901581229019100 This removes direct access of the 'BUILD_DIR' variable. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/qemu_test/testcase.py | 4 ++-- tests/functional/test_aarch64_virt.py | 6 +++--- tests/functional/test_virtio_gpu.py | 9 ++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index 5b1e6ba04f..2f32742387 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -127,8 +127,8 @@ def setUp(self, bin_prefix): self.arch =3D self.qemu_bin.split('-')[-1] self.socketdir =3D None =20 - self.outputdir =3D os.path.join(BUILD_DIR, 'tests', 'functional', - self.arch, self.id()) + self.outputdir =3D self.build_file('tests', 'functional', + self.arch, self.id()) self.workdir =3D os.path.join(self.outputdir, 'scratch') os.makedirs(self.workdir, exist_ok=3DTrue) =20 diff --git a/tests/functional/test_aarch64_virt.py b/tests/functional/test_= aarch64_virt.py index 07b78f6a84..29eeb8e32d 100755 --- a/tests/functional/test_aarch64_virt.py +++ b/tests/functional/test_aarch64_virt.py @@ -14,7 +14,7 @@ import os import logging =20 -from qemu_test import (BUILD_DIR, QemuSystemTest, Asset, exec_command, +from qemu_test import (QemuSystemTest, Asset, exec_command, wait_for_console_pattern, get_qemu_img, run_cmd) =20 =20 @@ -52,8 +52,8 @@ def test_alpine_virt_tcg_gic_max(self): "mte=3Don," "gic-version=3Dmax,iommu=3Dsmmuv3") 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('-bios', self.build_file('pc-bios', + 'edk2-aarch64-code.fd')) 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') diff --git a/tests/functional/test_virtio_gpu.py b/tests/functional/test_vi= rtio_gpu.py index c4562618d9..39dcf376dd 100755 --- a/tests/functional/test_virtio_gpu.py +++ b/tests/functional/test_virtio_gpu.py @@ -6,8 +6,7 @@ # later. See the COPYING file in the top-level directory. =20 =20 -from qemu_test import (BUILD_DIR, QemuSystemTest, Asset, - wait_for_console_pattern, +from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, exec_command_and_wait_for_pattern, is_readable_executable_file) from qemu.utils import kvm_available @@ -17,12 +16,12 @@ import subprocess =20 =20 -def pick_default_vug_bin(): +def pick_default_vug_bin(test): relative_path =3D "./contrib/vhost-user-gpu/vhost-user-gpu" if is_readable_executable_file(relative_path): return relative_path =20 - bld_dir_path =3D os.path.join(BUILD_DIR, relative_path) + bld_dir_path =3D test.build_file(relative_path) if is_readable_executable_file(bld_dir_path): return bld_dir_path =20 @@ -85,7 +84,7 @@ def test_vhost_user_vga_virgl(self): # FIXME: should check presence of vhost-user-gpu, virgl, memfd etc self.require_accelerator('kvm') =20 - vug =3D pick_default_vug_bin() + vug =3D pick_default_vug_bin(self) if not vug: self.skipTest("Could not find vhost-user-gpu") =20 --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901549; cv=none; d=zohomail.com; s=zohoarc; b=YHNXbF2I0W1VOK8RS9D5W145RV/OaJ6oiEylkf+khcmrH0s18Qe6cJNQDowO39Y2BbfiYjWuoAQ1B4RhnM8Dkx8SX1boQryxlTvhahP+AMfzekwepGPo3pELgxB5moRkhfpQ0ERZjEAyBF05maKSxc7wbAwav/HhPOLlTcWlD8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901549; 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=MjGCMqsjW1B5YuxiEfV5ODv2USRNF4jZygU4xmpzmEw=; b=RGz3RZZm1QFiFYmHUhXtoXC2ryw5MKHODTaZBUTmJSH/WBcbOMv4/hLU5H7T7C3JJpFRkoxxAAJ3F/CAstaeFkM2YKNa8zRern6n6bumE1GP/yf8acbDCQD4dNY+OKtM2Pejxw97vw5s13Ji1g0I6cNA9qDknfaLrkgvLT5sYMk= 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 17329015496311020.5321461102346; Fri, 29 Nov 2024 09:32:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4ql-0003mC-Ib; Fri, 29 Nov 2024 12:32:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qY-0003gq-Hq for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:05 -0500 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 1tH4qW-0000wL-UD for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:02 -0500 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-657-Cj5iyRtPO46FzfE8GZEg6w-1; Fri, 29 Nov 2024 12:31:55 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 2D4121955DD2; Fri, 29 Nov 2024 17:31:54 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BF8B71955F41; Fri, 29 Nov 2024 17:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901520; 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=MjGCMqsjW1B5YuxiEfV5ODv2USRNF4jZygU4xmpzmEw=; b=Kyq8Q33e9Yry7iaYpSEd579ETaOgKs5iV1l+z2NtK3JmUnzjIrTSYAJozo7K32PvlK2uPM gNwDG7yaxPFTzkGWmXpgFDm05AT+tuOb17rrZ4hNAj+XwG6U1YGvbWtMYPAL1tipqxsR8e PpIIrRfDuoGvZ/0Io6RoYRB/Urife88= X-MC-Unique: Cj5iyRtPO46FzfE8GZEg6w-1 X-Mimecast-MFC-AGG-ID: Cj5iyRtPO46FzfE8GZEg6w From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 11/22] tests/functional: switch over to using self.data_file(...) Date: Fri, 29 Nov 2024 17:31:09 +0000 Message-ID: <20241129173120.761728-12-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901550966019100 This removes direct path manipulation to figure out the source dir Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/test_acpi_bits.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp= i_bits.py index 4de5fae37e..948b134b16 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -41,7 +41,6 @@ import tempfile import zipfile =20 -from pathlib import Path from typing import ( List, Optional, @@ -122,7 +121,6 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=3Dto= o-many-instance-attributes def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._vm =3D None - self._baseDir =3D None =20 self._debugcon_addr =3D '0x403' self._debugcon_log =3D 'debugcon-log.txt' @@ -137,26 +135,22 @@ def _print_log(self, log): def copy_bits_config(self): """ copies the bios bits config file into bits. """ - config_file =3D 'bits-cfg.txt' - bits_config_dir =3D os.path.join(self._baseDir, 'acpi-bits', - 'bits-config') + bits_config_file =3D self.data_file('acpi-bits', + 'bits-config', + 'bits-cfg.txt') target_config_dir =3D os.path.join(self.workdir, 'bits-%d' %self.BITS_INTERNAL_VER, 'boot') - self.assertTrue(os.path.exists(bits_config_dir)) + self.assertTrue(os.path.exists(bits_config_file)) self.assertTrue(os.path.exists(target_config_dir)) - self.assertTrue(os.access(os.path.join(bits_config_dir, - config_file), os.R_OK)) - shutil.copy2(os.path.join(bits_config_dir, config_file), - target_config_dir) + shutil.copy2(bits_config_file, target_config_dir) self.logger.info('copied config file %s to %s', - config_file, target_config_dir) + bits_config_file, target_config_dir) =20 def copy_test_scripts(self): """copies the python test scripts into bits. """ =20 - bits_test_dir =3D os.path.join(self._baseDir, 'acpi-bits', - 'bits-tests') + bits_test_dir =3D self.data_file('acpi-bits', 'bits-tests') target_test_dir =3D os.path.join(self.workdir, 'bits-%d' %self.BITS_INTERNAL_VER, 'boot', 'python') @@ -259,8 +253,6 @@ def setUp(self): # pylint: disable=3Darguments-differ super().setUp('qemu-system-') self.logger =3D self.log =20 - self._baseDir =3D Path(__file__).parent - prebuiltDir =3D os.path.join(self.workdir, 'prebuilt') if not os.path.isdir(prebuiltDir): os.mkdir(prebuiltDir, mode=3D0o775) --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901663; cv=none; d=zohomail.com; s=zohoarc; b=Lvt45AxlQjzy3YySXT0FZmuGfHYu8LJrHR+GcDK0CFcuG70tHslyAoPnO50CkW2UlguITmcGbuT3MGaeAiAK2JxywUeZuL4pbjvXrbGGpQGgJZ2UT+PJFwoffEkxcQ9tUYk3ji0t1W3yFvyUMSFTT4JAzOfx9VqA3BEnfNIel38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901663; 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=jososI463aRMJGRjR532tVAnmsaH6v76nru73bGqRFM=; b=SRHxV6sOmmKeA5FwHFoi0au+UdL7kDFXtwYdV8Z5COHJLwnpkUFqw6f/qi/cc0vWDOQZvY4N4VwrTC1QIUSPXnlR+u1m3Y+GylMhv/sm+YsvpU71jHtm4F4AYtrsAvUyeXY9Z6EyRNXVWyJgJsCAWTBG4czf4Sl+0P3im8Sj2dY= 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 1732901663548991.1255633571812; Fri, 29 Nov 2024 09:34:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qx-00044c-SC; Fri, 29 Nov 2024 12:32:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qa-0003gt-LI for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:05 -0500 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 1tH4qW-0000wE-9v for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:04 -0500 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-615-MkwxN6U0MJCbbY43dm4VZg-1; Fri, 29 Nov 2024 12:31:57 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 CC94619560B7; Fri, 29 Nov 2024 17:31:56 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9E6FD1955F41; Fri, 29 Nov 2024 17:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901519; 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=jososI463aRMJGRjR532tVAnmsaH6v76nru73bGqRFM=; b=XnOFAKrxUez7WCVv8mkoXEM7DRRH8S8VIRWZQJh2KX+OW0bX2LEUBxIQcJZKSTGzF1RaJZ fPmfuoADXaALw4soPCAh1P8DOyW4zbX46umhbeJuRdtMxsIS9MuSFQLMY8yaQUCfPFGGAG krRiOd4Acd4Qx/yXiyqzKx4eZSpItGk= X-MC-Unique: MkwxN6U0MJCbbY43dm4VZg-1 X-Mimecast-MFC-AGG-ID: MkwxN6U0MJCbbY43dm4VZg From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 12/22] tests/functional: switch over to using self.scratch_file() Date: Fri, 29 Nov 2024 17:31:10 +0000 Message-ID: <20241129173120.761728-13-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901665243019100 Replace any instances of os.path.join(self.workdir, ".../...") self.workdir + "/.../..." with self.scratch_file("...", "...") which is more compact and portable Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/linuxkernel.py | 7 ++- tests/functional/qemu_test/tuxruntest.py | 2 +- tests/functional/test_aarch64_aspeed.py | 17 ++++--- tests/functional/test_aarch64_raspi3.py | 3 +- tests/functional/test_aarch64_raspi4.py | 4 +- tests/functional/test_aarch64_sbsaref.py | 7 ++- tests/functional/test_aarch64_virt.py | 2 +- tests/functional/test_acpi_bits.py | 48 +++++++++---------- tests/functional/test_alpha_clipper.py | 4 +- tests/functional/test_arm_aspeed.py | 14 +++--- tests/functional/test_arm_bflt.py | 3 +- tests/functional/test_arm_bpim2u.py | 6 +-- tests/functional/test_arm_canona1100.py | 3 +- tests/functional/test_arm_integratorcp.py | 3 +- tests/functional/test_arm_orangepi.py | 8 ++-- tests/functional/test_arm_raspi2.py | 4 +- tests/functional/test_arm_vexpress.py | 5 +- tests/functional/test_m68k_mcf5208evb.py | 3 +- tests/functional/test_m68k_nextcube.py | 5 +- .../functional/test_microblaze_s3adsp1800.py | 3 +- .../test_microblazeel_s3adsp1800.py | 5 +- tests/functional/test_mips64el_malta.py | 6 +-- tests/functional/test_mips_malta.py | 4 +- tests/functional/test_mipsel_malta.py | 4 +- tests/functional/test_or1k_sim.py | 2 +- tests/functional/test_ppc64_e500.py | 2 +- tests/functional/test_ppc64_hv.py | 12 +---- tests/functional/test_ppc_amiga.py | 12 +++-- tests/functional/test_ppc_bamboo.py | 10 ++-- tests/functional/test_ppc_mac.py | 2 +- tests/functional/test_ppc_mpc8544ds.py | 2 +- tests/functional/test_ppc_virtex_ml507.py | 5 +- tests/functional/test_rx_gdbsim.py | 4 +- tests/functional/test_s390x_ccw_virtio.py | 2 +- tests/functional/test_s390x_topology.py | 4 +- tests/functional/test_sh4_r2d.py | 3 +- tests/functional/test_sh4eb_r2d.py | 7 ++- tests/functional/test_sparc64_sun4u.py | 5 +- tests/functional/test_sparc_sun4m.py | 2 +- tests/functional/test_xtensa_lx60.py | 3 +- 40 files changed, 116 insertions(+), 131 deletions(-) diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/q= emu_test/linuxkernel.py index 2b5b9a5fda..a6525f9dd6 100644 --- a/tests/functional/qemu_test/linuxkernel.py +++ b/tests/functional/qemu_test/linuxkernel.py @@ -46,8 +46,7 @@ def extract_from_deb(self, deb_path, path): os.chdir(cwd) # Return complete path to extracted file. Because callers to # extract_from_deb() specify 'path' with a leading slash, it is - # necessary to use os.path.relpath() as otherwise os.path.join() - # interprets it as an absolute path and drops the self.workdir par= t. - return os.path.normpath(os.path.join(self.workdir, - os.path.relpath(path, '/'))) + # necessary to use 'relative_to()' to turn it into a relative + # path for joining to the scratch dir + return os.path.normpath(self.scratch_file(os.path.relpath(path, '/= '))) =20 diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qe= mu_test/tuxruntest.py index 7c0456923e..e9a26380be 100644 --- a/tests/functional/qemu_test/tuxruntest.py +++ b/tests/functional/qemu_test/tuxruntest.py @@ -78,7 +78,7 @@ def fetch_tuxrun_assets(self, kernel_asset, rootfs_asset,= dtb_asset=3DNone): kernel_image =3D kernel_asset.fetch() disk_image_zst =3D rootfs_asset.fetch() =20 - disk_image =3D self.workdir + "/rootfs.ext4" + disk_image =3D self.scratch_file("rootfs.ext4") =20 run_cmd([self.zstd, "-f", "-d", disk_image_zst, "-o", disk_image]) diff --git a/tests/functional/test_aarch64_aspeed.py b/tests/functional/tes= t_aarch64_aspeed.py index 59916efd71..c6c6b74acc 100644 --- a/tests/functional/test_aarch64_aspeed.py +++ b/tests/functional/test_aarch64_aspeed.py @@ -39,26 +39,28 @@ def test_aarch64_ast2700_evb_sdk_v09_02(self): archive_extract(image_path, self.workdir) =20 num_cpu =3D 4 - image_dir =3D self.workdir + '/ast2700-default/' - uboot_size =3D os.path.getsize(image_dir + 'u-boot-nodtb.bin') + uboot_size =3D os.path.getsize(self.scratch_file('ast2700-default', + 'u-boot-nodtb.bin')) uboot_dtb_load_addr =3D hex(0x400000000 + uboot_size) =20 load_images_list =3D [ { 'addr': '0x400000000', - 'file': image_dir + 'u-boot-nodtb.bin' + 'file': self.scratch_file('ast2700-default', + 'u-boot-nodtb.bin') }, { 'addr': str(uboot_dtb_load_addr), - 'file': image_dir + 'u-boot.dtb' + 'file': self.scratch_file('ast2700-default', 'u-boot.dtb') }, { 'addr': '0x430000000', - 'file': image_dir + 'bl31.bin' + 'file': self.scratch_file('ast2700-default', 'bl31.bin') }, { 'addr': '0x430080000', - 'file': image_dir + 'optee/tee-raw.bin' + 'file': self.scratch_file('ast2700-default', 'optee', + 'tee-raw.bin') } ] =20 @@ -75,7 +77,8 @@ def test_aarch64_ast2700_evb_sdk_v09_02(self): self.vm.add_args('-smp', str(num_cpu)) self.vm.add_args('-device', 'tmp105,bus=3Daspeed.i2c.bus.1,address=3D0x4d,id= =3Dtmp-test') - self.do_test_aarch64_aspeed_sdk_start(image_dir + 'image-bmc') + self.do_test_aarch64_aspeed_sdk_start( + self.scratch_file('ast2700-default', 'image-bmc')) =20 wait_for_console_pattern(self, 'ast2700-default login:') =20 diff --git a/tests/functional/test_aarch64_raspi3.py b/tests/functional/tes= t_aarch64_raspi3.py index 369f95a3d9..98ed6f9d56 100755 --- a/tests/functional/test_aarch64_raspi3.py +++ b/tests/functional/test_aarch64_raspi3.py @@ -7,7 +7,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os from zipfile import ZipFile =20 from qemu_test import LinuxKernelTest, Asset @@ -26,7 +25,7 @@ def test_aarch64_raspi3_atf(self): =20 with ZipFile(zip_path, 'r') as zf: zf.extract(efi_name, path=3Dself.workdir) - efi_fd =3D os.path.join(self.workdir, efi_name) + efi_fd =3D self.scratch_file(efi_name) =20 self.set_machine('raspi3b') self.vm.set_console(console_index=3D1) diff --git a/tests/functional/test_aarch64_raspi4.py b/tests/functional/tes= t_aarch64_raspi4.py index 95e9c8e643..6d68411528 100755 --- a/tests/functional/test_aarch64_raspi4.py +++ b/tests/functional/test_aarch64_raspi4.py @@ -5,8 +5,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern) from qemu_test.utils import gzip_uncompress @@ -64,7 +62,7 @@ def test_arm_raspi4_initrd(self): kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel8.img= ') dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-= b.dtb') initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') + initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) =20 self.set_machine('raspi4b') diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/te= st_aarch64_sbsaref.py index 8064b691c7..4c173a0303 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -8,12 +8,11 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, interrupt_interactive_console_until_pattern) from qemu_test.utils import lzma_uncompress =20 + def fetch_firmware(test): """ Flash volumes generated using: @@ -31,12 +30,12 @@ def fetch_firmware(test): =20 # Secure BootRom (TF-A code) fs0_xz_path =3D Aarch64SbsarefMachine.ASSET_FLASH0.fetch() - fs0_path =3D os.path.join(test.workdir, "SBSA_FLASH0.fd") + fs0_path =3D test.scratch_file("SBSA_FLASH0.fd") lzma_uncompress(fs0_xz_path, fs0_path) =20 # Non-secure rom (UEFI and EFI variables) fs1_xz_path =3D Aarch64SbsarefMachine.ASSET_FLASH1.fetch() - fs1_path =3D os.path.join(test.workdir, "SBSA_FLASH1.fd") + fs1_path =3D test.scratch_file("SBSA_FLASH1.fd") lzma_uncompress(fs1_xz_path, fs1_path) =20 for path in [fs0_path, fs1_path]: diff --git a/tests/functional/test_aarch64_virt.py b/tests/functional/test_= aarch64_virt.py index 29eeb8e32d..66166c0fb0 100755 --- a/tests/functional/test_aarch64_virt.py +++ b/tests/functional/test_aarch64_virt.py @@ -94,7 +94,7 @@ def common_aarch64_virt(self, machine): =20 # Also add a scratch block device logger.info('creating scratch qcow2 image') - image_path =3D os.path.join(self.workdir, 'scratch.qcow2') + image_path =3D self.scratch_file('scratch.qcow2') qemu_img =3D get_qemu_img(self) run_cmd([qemu_img, 'create', '-f', 'qcow2', image_path, '8M']) =20 diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp= i_bits.py index 948b134b16..a2872d2ddf 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -138,9 +138,8 @@ def copy_bits_config(self): bits_config_file =3D self.data_file('acpi-bits', 'bits-config', 'bits-cfg.txt') - target_config_dir =3D os.path.join(self.workdir, - 'bits-%d' %self.BITS_INTERNAL_VER, - 'boot') + target_config_dir =3D self.scratch_file('bits-%d' % self.BITS_INTE= RNAL_VER, + 'boot') self.assertTrue(os.path.exists(bits_config_file)) self.assertTrue(os.path.exists(target_config_dir)) shutil.copy2(bits_config_file, target_config_dir) @@ -151,9 +150,8 @@ def copy_test_scripts(self): """copies the python test scripts into bits. """ =20 bits_test_dir =3D self.data_file('acpi-bits', 'bits-tests') - target_test_dir =3D os.path.join(self.workdir, - 'bits-%d' %self.BITS_INTERNAL_VER, - 'boot', 'python') + target_test_dir =3D self.scratch_file('bits-%d' % self.BITS_INTERN= AL_VER, + 'boot', 'python') =20 self.assertTrue(os.path.exists(bits_test_dir)) self.assertTrue(os.path.exists(target_test_dir)) @@ -190,8 +188,8 @@ def fix_mkrescue(self, mkrescue): the directory where we have extracted our pre-built bits grub tarball. """ - grub_x86_64_mods =3D os.path.join(self.workdir, 'grub-inst-x86_64-= efi') - grub_i386_mods =3D os.path.join(self.workdir, 'grub-inst') + grub_x86_64_mods =3D self.scratch_file('grub-inst-x86_64-efi') + grub_i386_mods =3D self.scratch_file('grub-inst') =20 self.assertTrue(os.path.exists(grub_x86_64_mods)) self.assertTrue(os.path.exists(grub_i386_mods)) @@ -212,13 +210,11 @@ def generate_bits_iso(self): """ Uses grub-mkrescue to generate a fresh bits iso with the python test scripts """ - bits_dir =3D os.path.join(self.workdir, - 'bits-%d' %self.BITS_INTERNAL_VER) - iso_file =3D os.path.join(self.workdir, - 'bits-%d.iso' %self.BITS_INTERNAL_VER) - mkrescue_script =3D os.path.join(self.workdir, - 'grub-inst-x86_64-efi', 'bin', - 'grub-mkrescue') + bits_dir =3D self.scratch_file('bits-%d' % self.BITS_INTERNAL_VER) + iso_file =3D self.scratch_file('bits-%d.iso' % self.BITS_INTERNAL_= VER) + mkrescue_script =3D self.scratch_file('grub-inst-x86_64-efi', + 'bin', + 'grub-mkrescue') =20 self.assertTrue(os.access(mkrescue_script, os.R_OK | os.W_OK | os.X_OK)) @@ -253,17 +249,18 @@ def setUp(self): # pylint: disable=3Darguments-differ super().setUp('qemu-system-') self.logger =3D self.log =20 - prebuiltDir =3D os.path.join(self.workdir, 'prebuilt') + prebuiltDir =3D self.scratch_file('prebuilt') if not os.path.isdir(prebuiltDir): os.mkdir(prebuiltDir, mode=3D0o775) =20 - bits_zip_file =3D os.path.join(prebuiltDir, 'bits-%d-%s.zip' - %(self.BITS_INTERNAL_VER, - self.BITS_COMMIT_HASH)) - grub_tar_file =3D os.path.join(prebuiltDir, - 'bits-%d-%s-grub.tar.gz' - %(self.BITS_INTERNAL_VER, - self.BITS_COMMIT_HASH)) + bits_zip_file =3D self.scratch_file('prebuilt', + 'bits-%d-%s.zip' + %(self.BITS_INTERNAL_VER, + self.BITS_COMMIT_HASH)) + grub_tar_file =3D self.scratch_file('prebuilt', + 'bits-%d-%s-grub.tar.gz' + %(self.BITS_INTERNAL_VER, + self.BITS_COMMIT_HASH)) =20 bitsLocalArtLoc =3D self.ASSET_BITS.fetch() self.logger.info("downloaded bits artifacts to %s", bitsLocalArtLo= c) @@ -287,7 +284,7 @@ def parse_log(self): """parse the log generated by running bits tests and check for failures. """ - debugconf =3D os.path.join(self.workdir, self._debugcon_log) + debugconf =3D self.scratch_file(self._debugcon_log) log =3D "" with open(debugconf, 'r', encoding=3D'utf-8') as filehandle: log =3D filehandle.read() @@ -318,8 +315,7 @@ def tearDown(self): def test_acpi_smbios_bits(self): """The main test case implementation.""" =20 - iso_file =3D os.path.join(self.workdir, - 'bits-%d.iso' %self.BITS_INTERNAL_VER) + iso_file =3D self.scratch_file('bits-%d.iso' % self.BITS_INTERNAL_= VER) =20 self.assertTrue(os.access(iso_file, os.R_OK)) =20 diff --git a/tests/functional/test_alpha_clipper.py b/tests/functional/test= _alpha_clipper.py index c1fbf0e395..72cd7b57e6 100755 --- a/tests/functional/test_alpha_clipper.py +++ b/tests/functional/test_alpha_clipper.py @@ -5,8 +5,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from qemu_test import LinuxKernelTest, Asset from qemu_test.utils import gzip_uncompress =20 @@ -22,7 +20,7 @@ def test_alpha_clipper(self): self.set_machine('clipper') kernel_path =3D self.ASSET_KERNEL.fetch() =20 - uncompressed_kernel =3D os.path.join(self.workdir, 'vmlinux') + uncompressed_kernel =3D self.scratch_file('vmlinux') gzip_uncompress(kernel_path, uncompressed_kernel) =20 self.vm.set_console() diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar= m_aspeed.py index db872ff05e..c4869011db 100755 --- a/tests/functional/test_arm_aspeed.py +++ b/tests/functional/test_arm_aspeed.py @@ -35,7 +35,7 @@ def test_ast1030_zephyros_1_04(self): kernel_name =3D "ast1030-evb-demo/zephyr.elf" with ZipFile(zip_file, 'r') as zf: zf.extract(kernel_name, path=3Dself.workdir) - kernel_file =3D os.path.join(self.workdir, kernel_name) + kernel_file =3D self.scratch_file(kernel_name) =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic') @@ -57,7 +57,7 @@ def test_ast1030_zephyros_1_07(self): kernel_name =3D "ast1030-evb-demo/zephyr.bin" with ZipFile(zip_file, 'r') as zf: zf.extract(kernel_name, path=3Dself.workdir) - kernel_file =3D os.path.join(self.workdir, kernel_name) + kernel_file =3D self.scratch_file(kernel_name) =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic') @@ -226,14 +226,16 @@ def test_arm_ast2600_evb_buildroot_tpm(self): =20 image_path =3D self.ASSET_BR2_202302_AST2600_TPM_FLASH.fetch() =20 - tpmstate_dir =3D tempfile.TemporaryDirectory(prefix=3D"qemu_") + tpmstate_dir =3D self.scratch_file('swtpmstate') + os.mkdir(tpmstate_dir) + socket_dir =3D tempfile.TemporaryDirectory(prefix=3D"qemu_") socket =3D os.path.join(tpmstate_dir.name, 'swtpm-socket') =20 # We must put the TPM state dir in /tmp/, not the build dir, # because some distros use AppArmor to lock down swtpm and # restrict the set of locations it can access files in. subprocess.run(['swtpm', 'socket', '-d', '--tpm2', - '--tpmstate', f'dir=3D{tpmstate_dir.name}', + '--tpmstate', f'dir=3D{tpmstate_dir}', '--ctrl', f'type=3Dunixio,path=3D{socket}']) =20 self.vm.add_args('-chardev', f'socket,id=3Dchrtpm,path=3D{socket}') @@ -274,7 +276,7 @@ def test_arm_ast2500_evb_sdk(self): archive_extract(image_path, self.workdir) =20 self.do_test_arm_aspeed_sdk_start( - self.workdir + '/ast2500-default/image-bmc') + self.scratch_file('ast2500-default', 'image-bmc')) =20 self.wait_for_console_pattern('ast2500-default login:') =20 @@ -294,7 +296,7 @@ def test_arm_ast2600_evb_sdk(self): self.vm.add_args('-device', 'ds1338,bus=3Daspeed.i2c.bus.5,address=3D0x32'); self.do_test_arm_aspeed_sdk_start( - self.workdir + '/ast2600-a2/image-bmc') + self.scratch_file('ast2600-a2', 'image-bmc')) =20 self.wait_for_console_pattern('ast2600-a2 login:') =20 diff --git a/tests/functional/test_arm_bflt.py b/tests/functional/test_arm_= bflt.py index 74d04fd381..c73e0bfa8c 100755 --- a/tests/functional/test_arm_bflt.py +++ b/tests/functional/test_arm_bflt.py @@ -6,7 +6,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os import bz2 =20 from qemu_test import QemuUserTest, Asset, has_cmd @@ -26,7 +25,7 @@ class LoadBFLT(QemuUserTest): 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") + busybox_path =3D self.scratch_file("bin", "busybox") =20 with bz2.open(rootfs_path_bz2, 'rb') as cpio_handle: cpio_extract(cpio_handle, self.workdir) diff --git a/tests/functional/test_arm_bpim2u.py b/tests/functional/test_ar= m_bpim2u.py index d2108fd4ea..69f6cdaf68 100755 --- a/tests/functional/test_arm_bpim2u.py +++ b/tests/functional/test_arm_bpim2u.py @@ -68,7 +68,7 @@ def test_arm_bpim2u_initrd(self): 'sun8i-r40-bananapi-m2-ultra.dtb') dtb_path =3D self.extract_from_deb(deb_path, dtb_path) initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') + initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) =20 self.vm.set_console() @@ -106,7 +106,7 @@ def test_arm_bpim2u_gmac(self): 'sun8i-r40-bananapi-m2-ultra.dtb') dtb_path =3D self.extract_from_deb(deb_path, dtb_path) rootfs_path_xz =3D self.ASSET_ROOTFS.fetch() - rootfs_path =3D os.path.join(self.workdir, 'rootfs.cpio') + rootfs_path =3D self.scratch_file('rootfs.cpio') lzma_uncompress(rootfs_path_xz, rootfs_path) image_pow2ceil_expand(rootfs_path) =20 @@ -150,7 +150,7 @@ def test_arm_bpim2u_openwrt_22_03_3(self): # This test download a 8.9 MiB compressed image and expand it # to 127 MiB. image_path_gz =3D self.ASSET_SD_IMAGE.fetch() - image_path =3D os.path.join(self.workdir, 'sdcard.img') + image_path =3D self.scratch_file('sdcard.img') gzip_uncompress(image_path_gz, image_path) image_pow2ceil_expand(image_path) =20 diff --git a/tests/functional/test_arm_canona1100.py b/tests/functional/tes= t_arm_canona1100.py index 41e78b7d1b..cee6a23ed1 100755 --- a/tests/functional/test_arm_canona1100.py +++ b/tests/functional/test_arm_canona1100.py @@ -30,7 +30,8 @@ def test_arm_canona1100(self): member=3D"day18/barebox.canon-a1100.bin") self.vm.set_console() self.vm.add_args('-bios', - self.workdir + '/day18/barebox.canon-a1100.bin') + self.scratch_file('day18', + 'barebox.canon-a1100.bin')) self.vm.launch() wait_for_console_pattern(self, 'running /env/bin/init') =20 diff --git a/tests/functional/test_arm_integratorcp.py b/tests/functional/t= est_arm_integratorcp.py index a13e82bd31..e829b6beac 100755 --- a/tests/functional/test_arm_integratorcp.py +++ b/tests/functional/test_arm_integratorcp.py @@ -12,7 +12,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os import logging =20 from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, @@ -66,7 +65,7 @@ def test_framebuffer_tux_logo(self): import numpy as np import cv2 =20 - screendump_path =3D os.path.join(self.workdir, "screendump.pbm") + screendump_path =3D self.scratch_file("screendump.pbm") tuxlogo_path =3D self.ASSET_TUXLOGO.fetch() =20 self.boot_integratorcp() diff --git a/tests/functional/test_arm_orangepi.py b/tests/functional/test_= arm_orangepi.py index 7974010320..7b5e7b6ae1 100755 --- a/tests/functional/test_arm_orangepi.py +++ b/tests/functional/test_arm_orangepi.py @@ -77,7 +77,7 @@ def test_arm_orangepi_initrd(self): dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-o= rangepi-pc.dtb' dtb_path =3D self.extract_from_deb(deb_path, dtb_path) initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') + initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) =20 self.vm.set_console() @@ -113,7 +113,7 @@ def test_arm_orangepi_sd(self): dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-o= rangepi-pc.dtb' dtb_path =3D self.extract_from_deb(deb_path, dtb_path) rootfs_path_xz =3D self.ASSET_ROOTFS.fetch() - rootfs_path =3D os.path.join(self.workdir, 'rootfs.cpio') + rootfs_path =3D self.scratch_file('rootfs.cpio') lzma_uncompress(rootfs_path_xz, rootfs_path) image_pow2ceil_expand(rootfs_path) =20 @@ -156,7 +156,7 @@ def test_arm_orangepi_armbian(self): # to 1036 MiB, but the underlying filesystem is 1552 MiB... # As we expand it to 2 GiB we are safe. image_path_xz =3D self.ASSET_ARMBIAN.fetch() - image_path =3D os.path.join(self.workdir, 'armbian.img') + image_path =3D self.scratch_file('armbian.img') lzma_uncompress(image_path_xz, image_path) image_pow2ceil_expand(image_path) =20 @@ -197,7 +197,7 @@ def test_arm_orangepi_uboot_netbsd9(self): uboot_path =3D '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-sp= l.bin' uboot_path =3D self.extract_from_deb(deb_path, uboot_path) image_path_gz =3D self.ASSET_NETBSD.fetch() - image_path =3D os.path.join(self.workdir, 'armv7.img') + image_path =3D self.scratch_file('armv7.img') gzip_uncompress(image_path_gz, image_path) image_pow2ceil_expand(image_path) image_drive_args =3D 'if=3Dsd,format=3Draw,snapshot=3Don,file=3D' = + image_path diff --git a/tests/functional/test_arm_raspi2.py b/tests/functional/test_ar= m_raspi2.py index 4d31454f8f..c59dd6c066 100755 --- a/tests/functional/test_arm_raspi2.py +++ b/tests/functional/test_arm_raspi2.py @@ -7,8 +7,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern) from qemu_test.utils import gzip_uncompress @@ -65,7 +63,7 @@ def test_arm_raspi2_initrd(self): kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel7.img= ') dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-= b.dtb') initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') + initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) =20 self.set_machine('raspi2b') diff --git a/tests/functional/test_arm_vexpress.py b/tests/functional/test_= arm_vexpress.py index 6bd6290030..b1ac63ac36 100755 --- a/tests/functional/test_arm_vexpress.py +++ b/tests/functional/test_arm_vexpress.py @@ -18,8 +18,9 @@ def test_arm_vexpressa9(self): self.set_machine('vexpress-a9') file_path =3D self.ASSET_DAY16.fetch() archive_extract(file_path, self.workdir) - self.launch_kernel(self.workdir + '/day16/winter.zImage', - dtb=3Dself.workdir + '/day16/vexpress-v2p-ca9.d= tb', + self.launch_kernel(self.scratch_file('day16', 'winter.zImage'), + dtb=3Dself.scratch_file('day16', + 'vexpress-v2p-ca9.dtb'), wait_for=3D'QEMU advent calendar') =20 if __name__ =3D=3D '__main__': diff --git a/tests/functional/test_m68k_mcf5208evb.py b/tests/functional/te= st_m68k_mcf5208evb.py index fb178fde1c..449248c3e8 100755 --- a/tests/functional/test_m68k_mcf5208evb.py +++ b/tests/functional/test_m68k_mcf5208evb.py @@ -19,7 +19,8 @@ def test_m68k_mcf5208evb(self): file_path =3D self.ASSET_DAY07.fetch() archive_extract(file_path, self.workdir) self.vm.set_console() - self.vm.add_args('-kernel', self.workdir + '/day07/sanity-clause.e= lf') + self.vm.add_args('-kernel', + self.scratch_file('day07', 'sanity-clause.elf')) self.vm.launch() self.wait_for_console_pattern('QEMU advent calendar') =20 diff --git a/tests/functional/test_m68k_nextcube.py b/tests/functional/test= _m68k_nextcube.py index 82d3d335d0..4003fff584 100755 --- a/tests/functional/test_m68k_nextcube.py +++ b/tests/functional/test_m68k_nextcube.py @@ -7,7 +7,6 @@ # 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 os import time =20 from qemu_test import QemuSystemTest, Asset, skipIfMissingImports @@ -39,7 +38,7 @@ def check_bootrom_framebuffer(self, screenshot_path): @skipIfMissingImports("PIL") def test_bootrom_framebuffer_size(self): self.set_machine('next-cube') - screenshot_path =3D os.path.join(self.workdir, "dump.ppm") + screenshot_path =3D self.scratch_file("dump.ppm") self.check_bootrom_framebuffer(screenshot_path) =20 from PIL import Image @@ -53,7 +52,7 @@ def test_bootrom_framebuffer_size(self): @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") + screenshot_path =3D self.scratch_file("dump.ppm") self.check_bootrom_framebuffer(screenshot_path) lines =3D tesseract_ocr(screenshot_path) text =3D '\n'.join(lines) diff --git a/tests/functional/test_microblaze_s3adsp1800.py b/tests/functio= nal/test_microblaze_s3adsp1800.py index 387feb5dcc..aafc375d3c 100755 --- a/tests/functional/test_microblaze_s3adsp1800.py +++ b/tests/functional/test_microblaze_s3adsp1800.py @@ -25,7 +25,8 @@ def test_microblaze_s3adsp1800(self): 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.add_args('-kernel', + self.scratch_file('day17', 'ballerina.bin')) self.vm.launch() wait_for_console_pattern(self, 'This architecture does not have ' 'kernel memory protection') diff --git a/tests/functional/test_microblazeel_s3adsp1800.py b/tests/funct= ional/test_microblazeel_s3adsp1800.py index 875e2ab14c..9ea9182f42 100755 --- a/tests/functional/test_microblazeel_s3adsp1800.py +++ b/tests/functional/test_microblazeel_s3adsp1800.py @@ -26,8 +26,9 @@ def test_microblazeel_s3adsp1800(self): 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.add_args('-kernel', self.scratch_file('day13', 'xmaton.bin= ')) + tftproot =3D self.scratch_file('day13') + self.vm.add_args('-nic', f'user,tftp=3D{tftproot}') self.vm.launch() wait_for_console_pattern(self, 'QEMU Advent Calendar 2023') time.sleep(0.1) diff --git a/tests/functional/test_mips64el_malta.py b/tests/functional/tes= t_mips64el_malta.py index ccb9616f68..cc17f8af1f 100755 --- a/tests/functional/test_mips64el_malta.py +++ b/tests/functional/test_mips64el_malta.py @@ -68,7 +68,7 @@ def test_mips64el_malta(self): def test_mips64el_malta_5KEc_cpio(self): kernel_path =3D self.ASSET_KERNEL_3_19_3.fetch() initrd_path_gz =3D self.ASSET_CPIO_R1.fetch() - initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') + initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) =20 self.set_machine('malta') @@ -117,10 +117,10 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_co= unt): import numpy as np import cv2 =20 - screendump_path =3D os.path.join(self.workdir, 'screendump.pbm') + screendump_path =3D self.scratch_file('screendump.pbm') =20 kernel_path_gz =3D self.ASSET_KERNEL_4_7_0.fetch() - kernel_path =3D self.workdir + "/vmlinux" + kernel_path =3D self.scratch_file("vmlinux") gzip_uncompress(kernel_path_gz, kernel_path) =20 tuxlogo_path =3D self.ASSET_TUXLOGO.fetch() diff --git a/tests/functional/test_mips_malta.py b/tests/functional/test_mi= ps_malta.py index a012081382..a6d80d0012 100755 --- a/tests/functional/test_mips_malta.py +++ b/tests/functional/test_mips_malta.py @@ -6,8 +6,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os - from qemu_test import LinuxKernelTest, Asset from qemu_test import exec_command_and_wait_for_pattern from qemu_test.utils import gzip_uncompress @@ -52,7 +50,7 @@ def test_mips_malta_cpio(self): kernel_path =3D self.extract_from_deb(deb_path, '/boot/vmlinux-4.5.0-2-4kc-mal= ta') initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') + initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) =20 self.set_machine('malta') diff --git a/tests/functional/test_mipsel_malta.py b/tests/functional/test_= mipsel_malta.py index af6d280f99..c5bb4f73c8 100755 --- a/tests/functional/test_mipsel_malta.py +++ b/tests/functional/test_mipsel_malta.py @@ -37,7 +37,7 @@ class MaltaMachineConsole(LinuxKernelTest): 'ce21ff4b07a981ecb8a39db2876616f5a2473eb2ab459c6f67465b9914b0c6b6') =20 def do_test_mips_malta32el_nanomips(self, kernel_path_xz): - kernel_path =3D os.path.join(self.workdir, 'kernel') + kernel_path =3D self.scratch_file('kernel') lzma_uncompress(kernel_path_xz, kernel_path) =20 self.set_machine('malta') @@ -78,7 +78,7 @@ def test_mipsel_malta_yamon(self): zip_path =3D self.ASSET_YAMON_ROM.fetch() with ZipFile(zip_path, 'r') as zf: zf.extract(yamon_bin, path=3Dself.workdir) - yamon_path =3D os.path.join(self.workdir, yamon_bin) + yamon_path =3D self.scratch_file(yamon_bin) =20 self.set_machine('malta') self.vm.set_console() diff --git a/tests/functional/test_or1k_sim.py b/tests/functional/test_or1k= _sim.py index 5b68b6b628..a5b2b5b1e5 100755 --- a/tests/functional/test_or1k_sim.py +++ b/tests/functional/test_or1k_sim.py @@ -19,7 +19,7 @@ def test_or1k_sim(self): file_path =3D self.ASSET_DAY20.fetch() archive_extract(file_path, self.workdir) self.vm.set_console() - self.vm.add_args('-kernel', self.workdir + '/day20/vmlinux') + self.vm.add_args('-kernel', self.scratch_file('day20', 'vmlinux')) self.vm.launch() self.wait_for_console_pattern('QEMU advent calendar') =20 diff --git a/tests/functional/test_ppc64_e500.py b/tests/functional/test_pp= c64_e500.py index f1af92373e..bf4a6af9d4 100755 --- a/tests/functional/test_ppc64_e500.py +++ b/tests/functional/test_ppc64_e500.py @@ -18,7 +18,7 @@ def test_ppc64_e500(self): self.cpu =3D 'e5500' file_path =3D self.ASSET_DAY19.fetch() archive_extract(file_path, self.workdir) - self.launch_kernel(self.workdir + '/day19/uImage', + self.launch_kernel(self.scratch_file('day19', 'uImage'), wait_for=3D'QEMU advent calendar') =20 if __name__ =3D=3D '__main__': diff --git a/tests/functional/test_ppc64_hv.py b/tests/functional/test_ppc6= 4_hv.py index 9ad69b4a15..9cd86bcdf9 100755 --- a/tests/functional/test_ppc64_hv.py +++ b/tests/functional/test_ppc64_hv.py @@ -45,23 +45,15 @@ def extract_from_iso(self, iso, path): :param path: path within the iso file of the file to be extracted :returns: path of the extracted file """ - filename =3D os.path.basename(path) - - cwd =3D os.getcwd() - os.chdir(self.workdir) + filename =3D self.scratch_file(os.path.basename(path)) =20 cmd =3D "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, f= ilename) subprocess.run(cmd.split(), stdout=3Dsubprocess.DEVNULL, stderr=3Dsubprocess.DE= VNULL) =20 os.chmod(filename, 0o600) - os.chdir(cwd) =20 - # Return complete path to extracted file. Because callers to - # extract_from_iso() specify 'path' with a leading slash, it is - # necessary to use os.path.relpath() as otherwise os.path.join() - # interprets it as an absolute path and drops the self.workdir par= t. - return os.path.normpath(os.path.join(self.workdir, filename)) + return filename =20 def setUp(self): super().setUp() diff --git a/tests/functional/test_ppc_amiga.py b/tests/functional/test_ppc= _amiga.py index e92489fdb2..3e1a666c45 100755 --- a/tests/functional/test_ppc_amiga.py +++ b/tests/functional/test_ppc_amiga.py @@ -28,13 +28,15 @@ def test_ppc_amigaone(self): 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) + bios =3D self.scratch_file("u-boot-amigaone.bin") + with open(bios, "wb") as bios_fh: + subprocess.run(['tail', '-c', '524288', + self.scratch_file("floppy_edition", + "updater.image")], + stdout=3Dbios_fh) =20 self.vm.set_console() - self.vm.add_args('-bios', self.workdir + '/u-boot-amigaone.bin') + self.vm.add_args('-bios', bios) self.vm.launch() wait_for_console_pattern(self, 'FLASH:') =20 diff --git a/tests/functional/test_ppc_bamboo.py b/tests/functional/test_pp= c_bamboo.py index 71b30781f1..7ec173cbcd 100755 --- a/tests/functional/test_ppc_bamboo.py +++ b/tests/functional/test_ppc_bamboo.py @@ -28,10 +28,12 @@ def test_ppc_bamboo(self): 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', - '-initrd', self.workdir + - '/system-image-powerpc-440fp/rootfs.cpi= o.gz', + self.vm.add_args('-kernel', + self.scratch_file('system-image-powerpc-440fp', + 'linux'), + '-initrd', + self.scratch_file('system-image-powerpc-440fp', + 'rootfs.cpio.gz'), '-nic', 'user,model=3Drtl8139,restrict=3Don') self.vm.launch() wait_for_console_pattern(self, 'Type exit when done') diff --git a/tests/functional/test_ppc_mac.py b/tests/functional/test_ppc_m= ac.py index 3f45e37a45..10812824bd 100755 --- a/tests/functional/test_ppc_mac.py +++ b/tests/functional/test_ppc_mac.py @@ -23,7 +23,7 @@ def do_day15_test(self): file_path =3D self.ASSET_DAY15.fetch() archive_extract(file_path, self.workdir) self.vm.add_args('-M', 'graphics=3Doff') - self.launch_kernel(self.workdir + '/day15/invaders.elf', + self.launch_kernel(self.scratch_file('day15', 'invaders.elf'), wait_for=3D'QEMU advent calendar') =20 def test_ppc_g3beige(self): diff --git a/tests/functional/test_ppc_mpc8544ds.py b/tests/functional/test= _ppc_mpc8544ds.py index 746efda1ae..1089d5ff5b 100755 --- a/tests/functional/test_ppc_mpc8544ds.py +++ b/tests/functional/test_ppc_mpc8544ds.py @@ -27,7 +27,7 @@ def test_ppc_mpc8544ds(self): 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.add_args('-kernel', self.scratch_file('creek', 'creek.bin'= )) self.vm.launch() wait_for_console_pattern(self, 'QEMU advent calendar 2020', self.panic_message) diff --git a/tests/functional/test_ppc_virtex_ml507.py b/tests/functional/t= est_ppc_virtex_ml507.py index 3c49d41341..f39dfa5ae4 100755 --- a/tests/functional/test_ppc_virtex_ml507.py +++ b/tests/functional/test_ppc_virtex_ml507.py @@ -27,8 +27,9 @@ def test_ppc_virtex_ml507(self): 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', + self.vm.add_args('-kernel', self.scratch_file('hippo', 'hippo.linu= x'), + '-dtb', self.scratch_file('hippo', + 'virtex440-ml507.dtb'), '-m', '512') self.vm.launch() wait_for_console_pattern(self, 'QEMU advent calendar 2020', diff --git a/tests/functional/test_rx_gdbsim.py b/tests/functional/test_rx_= gdbsim.py index 7461be0b46..b7d5d7d062 100755 --- a/tests/functional/test_rx_gdbsim.py +++ b/tests/functional/test_rx_gdbsim.py @@ -10,8 +10,6 @@ # 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 os - from qemu_test import (QemuSystemTest, Asset, exec_command_and_wait_for_pattern, wait_for_console_pattern, skipFlakyTest) @@ -40,7 +38,7 @@ def test_uboot(self): self.set_machine('gdbsim-r5f562n8') =20 uboot_path_gz =3D self.ASSET_UBOOT.fetch() - uboot_path =3D os.path.join(self.workdir, 'u-boot.bin') + uboot_path =3D self.scratch_file('u-boot.bin') gzip_uncompress(uboot_path_gz, uboot_path) =20 self.vm.set_console() diff --git a/tests/functional/test_s390x_ccw_virtio.py b/tests/functional/t= est_s390x_ccw_virtio.py index c9d4730856..e70fffa290 100755 --- a/tests/functional/test_s390x_ccw_virtio.py +++ b/tests/functional/test_s390x_ccw_virtio.py @@ -175,7 +175,7 @@ def test_s390x_fedora(self): kernel_path =3D self.ASSET_F31_KERNEL.fetch() =20 initrd_path_xz =3D self.ASSET_F31_INITRD.fetch() - initrd_path =3D os.path.join(self.workdir, 'initrd-raw.img') + initrd_path =3D self.scratch_file('initrd-raw.img') lzma_uncompress(initrd_path_xz, initrd_path) =20 self.vm.set_console() diff --git a/tests/functional/test_s390x_topology.py b/tests/functional/tes= t_s390x_topology.py index 6bf64f09fe..64276e4f7e 100755 --- a/tests/functional/test_s390x_topology.py +++ b/tests/functional/test_s390x_topology.py @@ -10,8 +10,6 @@ # 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 os - from qemu_test import (QemuSystemTest, Asset, exec_command, exec_command_and_wait_for_pattern, wait_for_console_pattern) @@ -88,7 +86,7 @@ def kernel_init(self): self.require_accelerator("kvm") 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') + initrd_path =3D self.scratch_file('initrd-raw.img') lzma_uncompress(initrd_path_xz, initrd_path) =20 self.vm.set_console() diff --git a/tests/functional/test_sh4_r2d.py b/tests/functional/test_sh4_r= 2d.py index e2fcde2d6b..dca4601392 100755 --- a/tests/functional/test_sh4_r2d.py +++ b/tests/functional/test_sh4_r2d.py @@ -22,7 +22,8 @@ def test_r2d(self): file_path =3D self.ASSET_DAY09.fetch() archive_extract(file_path, self.workdir) self.vm.add_args('-append', 'console=3DttySC1') - self.launch_kernel(self.workdir + '/day09/zImage', console_index= =3D1, + self.launch_kernel(self.scratch_file('day09', 'zImage'), + console_index=3D1, wait_for=3D'QEMU advent calendar') =20 if __name__ =3D=3D '__main__': diff --git a/tests/functional/test_sh4eb_r2d.py b/tests/functional/test_sh4= eb_r2d.py index 66daf8add4..dd2500dc33 100755 --- a/tests/functional/test_sh4eb_r2d.py +++ b/tests/functional/test_sh4eb_r2d.py @@ -4,7 +4,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import os import shutil =20 from qemu_test import (LinuxKernelTest, Asset, @@ -22,11 +21,11 @@ def test_sh4eb_r2d(self): file_path =3D self.ASSET_TGZ.fetch() archive_extract(file_path, self.workdir) self.vm.add_args('-append', 'console=3DttySC1 noiotrap') - self.launch_kernel(os.path.join(self.workdir, 'sh4eb/linux-kernel'= ), - initrd=3Dos.path.join(self.workdir, 'sh4eb/init= ramfs.cpio.gz'), + self.launch_kernel(self.scratch_file('sh4eb', 'linux-kernel'), + initrd=3Dself.scratch_file('sh4eb', 'initramfs.= cpio.gz'), console_index=3D1, wait_for=3D'Type exit when d= one') exec_command_and_wait_for_pattern(self, 'exit', 'Restarting system= ') - shutil.rmtree(os.path.join(self.workdir, 'sh4eb')) + shutil.rmtree(self.scratch_file('sh4eb')) =20 if __name__ =3D=3D '__main__': LinuxKernelTest.main() diff --git a/tests/functional/test_sparc64_sun4u.py b/tests/functional/test= _sparc64_sun4u.py index 798d6c3fb5..43617f1aaf 100755 --- a/tests/functional/test_sparc64_sun4u.py +++ b/tests/functional/test_sparc64_sun4u.py @@ -10,11 +10,10 @@ # 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 os - from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern from qemu_test.utils import archive_extract =20 + class Sun4uMachine(QemuSystemTest): """Boots the Linux kernel and checks that the console is operational""" =20 @@ -31,7 +30,7 @@ def test_sparc64_sun4u(self): 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= ), + self.vm.add_args('-kernel', self.scratch_file(kernel_name), '-append', 'printk.time=3D0') self.vm.launch() wait_for_console_pattern(self, 'Starting logging: OK') diff --git a/tests/functional/test_sparc_sun4m.py b/tests/functional/test_s= parc_sun4m.py index 573f85222a..619c03d36a 100755 --- a/tests/functional/test_sparc_sun4m.py +++ b/tests/functional/test_sparc_sun4m.py @@ -18,7 +18,7 @@ def test_sparc_ss20(self): self.set_machine('SS-20') file_path =3D self.ASSET_DAY11.fetch() archive_extract(file_path, self.workdir) - self.launch_kernel(self.workdir + '/day11/zImage.elf', + self.launch_kernel(self.scratch_file('day11', 'zImage.elf'), wait_for=3D'QEMU advent calendar') =20 if __name__ =3D=3D '__main__': diff --git a/tests/functional/test_xtensa_lx60.py b/tests/functional/test_x= tensa_lx60.py index d4ad92dc6c..5048e4c69e 100755 --- a/tests/functional/test_xtensa_lx60.py +++ b/tests/functional/test_xtensa_lx60.py @@ -19,7 +19,8 @@ def test_xtensa_lx60(self): self.cpu =3D 'dc233c' file_path =3D self.ASSET_DAY02.fetch() archive_extract(file_path, self.workdir) - self.launch_kernel(self.workdir + '/day02/santas-sleigh-ride.elf', + self.launch_kernel(self.scratch_file('day02', + 'santas-sleigh-ride.elf'), wait_for=3D'QEMU advent calendar') =20 if __name__ =3D=3D '__main__': --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901781; cv=none; d=zohomail.com; s=zohoarc; b=mjBkaYAZEemvJa5/CE5u1Is5u8AtTPOcO/s4/mTD3S/O0Nlp0zz5oagLQ1i6SX/ybGrm9F7lpFY3w1mX/1DosgdgDG10uT8a1TsLhvjdBDHcdkozSKOBTmFuDKXWBsldhgb/G6b5D3pIuVDZaXPQq5o8+L+rCqWCaaH2XbZBrQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901781; 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=dnJ+lYLaMza6tRgAJE0L1DHXO/QbfU3aKuloURpEffM=; b=IM0zAD974Apk+IdLtewm/H5x7Y9nZfiV4KFAD4XhtQpCS10tlpe64OFxSBTa0mxIVigXenI+CJ7LT7bDoRxKSzwQq0vgp7j5bPvOj+bkvhTYpQChR38o0BHvmOU0jccT5IlUWLMtvax3L00AXRU5wAp8h0dtpmA/pAuwo3F4DXI= 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 1732901781330600.7583353843297; Fri, 29 Nov 2024 09:36:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4ql-0003mJ-IF; Fri, 29 Nov 2024 12:32:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qa-0003gu-LT for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:05 -0500 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 1tH4qY-0000zl-TN for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:04 -0500 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-208-CFegBAP7MfGi21H4-MC30w-1; Fri, 29 Nov 2024 12:31:59 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 E5A011955EB3; Fri, 29 Nov 2024 17:31:58 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4E2F41955F41; Fri, 29 Nov 2024 17:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901521; 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=dnJ+lYLaMza6tRgAJE0L1DHXO/QbfU3aKuloURpEffM=; b=L1voWmTMaaFFhFhhbfuMchyPYGaDsXLGA7soXJC1FgYYXTjvB2QTFT5L4CiJHZPEHg8Uxu WHQiZgr46XtCo7HWpKh1EqYezUReXrpS6G6ulf3ZSiqznEGP7rwsAaa8ZsI/Qt8Zxg5NEJ YZgog+Fabvxku7cb2+/Kf8VD91gEOb8= X-MC-Unique: CFegBAP7MfGi21H4-MC30w-1 X-Mimecast-MFC-AGG-ID: CFegBAP7MfGi21H4-MC30w From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 13/22] tests/functional: switch over to using self.socket_dir(...) Date: Fri, 29 Nov 2024 17:31:11 +0000 Message-ID: <20241129173120.761728-14-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901781523019100 This removes direct creation of temporary dirs Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/test_arm_aspeed.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar= m_aspeed.py index c4869011db..ca223ac8f0 100755 --- a/tests/functional/test_arm_aspeed.py +++ b/tests/functional/test_arm_aspeed.py @@ -9,7 +9,6 @@ import os import time import subprocess -import tempfile =20 from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern, @@ -228,8 +227,8 @@ def test_arm_ast2600_evb_buildroot_tpm(self): =20 tpmstate_dir =3D self.scratch_file('swtpmstate') os.mkdir(tpmstate_dir) - socket_dir =3D tempfile.TemporaryDirectory(prefix=3D"qemu_") - socket =3D os.path.join(tpmstate_dir.name, 'swtpm-socket') + socket_dir =3D self.socket_dir() + socket =3D os.path.join(socket_dir.name, 'swtpm-socket') =20 # We must put the TPM state dir in /tmp/, not the build dir, # because some distros use AppArmor to lock down swtpm and --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901595; cv=none; d=zohomail.com; s=zohoarc; b=iCMgasXAETKkJwnHNcKvEurSf119y+wYZj0Ks6ptsoKb/nmkSNs7G0LljMA+7hV2yBmTltihjfVPgIb0ps280NtunWdc3JKEWVUB+TQTWh7GH9YC0CbzD57A6noaohbe4NVgIBixSy6qEpVAtUvKYxtLkTCho1G9VZ0AXF28yUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901595; 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=Li5Ma72cOfyCzTPgc4s4kUBfAEfpLqF381GGDwOHw+s=; b=RBukbvRXmdPpNeF7ddkvSjVIxnWCHQEFTX3UMQJB9gUZWmi8yHc7OFpMGPYtksZq8RBArEfOA3AvNQXwRT73pnRwQeS4Ki78IGISM/IKu+AMjNA3PcVfiRC3OnO9deuvarepRf7XMj6f7ET3czvvSwGzUfS8ULhN0BR7aQQrK68= 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 1732901595679702.9969097623388; Fri, 29 Nov 2024 09:33:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rF-0004Ro-Nr; Fri, 29 Nov 2024 12:32:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qg-0003mX-Ta for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:15 -0500 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 1tH4qd-000149-Lr for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:09 -0500 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-352-isbLp-fcNKWSxuCXsIumFw-1; Fri, 29 Nov 2024 12:32:02 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 2010D195608C; Fri, 29 Nov 2024 17:32:01 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 32F231955F41; Fri, 29 Nov 2024 17:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901527; 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=Li5Ma72cOfyCzTPgc4s4kUBfAEfpLqF381GGDwOHw+s=; b=MzS5EkoQ1sbFMfBp8xzGN0Snrg6hQ8kVo2Sl7unyU/JLeSgTjxJ1QLiGoHTP9t3kRbCnaM qD41s2/2Q/zde6Jl2lPyEHV/DZM4nv6Ae+mQKdK97s0BL3QrQHIeF69jL/fjaSM+S/hChO NGzd0miB+HYtogI6nB3FPgNKlyYbTRE= X-MC-Unique: isbLp-fcNKWSxuCXsIumFw-1 X-Mimecast-MFC-AGG-ID: isbLp-fcNKWSxuCXsIumFw From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 14/22] tests/functional: remove redundant 'rmtree' call Date: Fri, 29 Nov 2024 17:31:12 +0000 Message-ID: <20241129173120.761728-15-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901597175019100 Everything in the scratch directory is automatically purged. Calling 'rmtree' again breaks the ability to optionally preserve the scratch directory contents. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/functional/test_sh4eb_r2d.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/functional/test_sh4eb_r2d.py b/tests/functional/test_sh4= eb_r2d.py index dd2500dc33..38ee55cf4c 100755 --- a/tests/functional/test_sh4eb_r2d.py +++ b/tests/functional/test_sh4eb_r2d.py @@ -4,8 +4,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -import shutil - from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern) from qemu_test.utils import archive_extract @@ -25,7 +23,6 @@ def test_sh4eb_r2d(self): initrd=3Dself.scratch_file('sh4eb', 'initramfs.= cpio.gz'), console_index=3D1, wait_for=3D'Type exit when d= one') exec_command_and_wait_for_pattern(self, 'exit', 'Restarting system= ') - shutil.rmtree(self.scratch_file('sh4eb')) =20 if __name__ =3D=3D '__main__': LinuxKernelTest.main() --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901675; cv=none; d=zohomail.com; s=zohoarc; b=gkwh6skzyM8pokrsTN5DPOnIHL1ND+3ek0Ub4lVi78K9mTZUXXQ8HzfEz4tJQ2FHIDRc47rou2w5sYu8Q4Msnc5E/wvcNyh3cHdByEC0+h4/EEf1joEiFV5s/RsXVlNCBi2NMNPCJuNLBJVQo41DfDyLyodwLUNI9f2bfplrtJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901675; 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=TiL9pH5cIq3jBdyWCkXQVTmhwDXpS93CWDVMG70rST8=; b=GmNkNNonFA4D6sDiMXqLhcby4Nizyyh2d6rrgxM+enQsziD+RLP3ats61VPhQccWsydWxJonP33xOd9rywHhuUfWSTUPrKmP4fkBxcdR+GCqLjcw+tt61yuqTFH6m3M2G2L/Shk0OUzMo3+5O5NVrQkgi6tSmFUcqjORUluBOuE= 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 1732901675899339.95620445944587; Fri, 29 Nov 2024 09:34:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4qx-00044h-RT; Fri, 29 Nov 2024 12:32:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qe-0003mV-E7 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:15 -0500 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 1tH4qc-00013x-Gv for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:07 -0500 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-652-vRCoqlfTNPaSdNjJ3NJaaQ-1; Fri, 29 Nov 2024 12:32:04 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 7E4B71955D9E; Fri, 29 Nov 2024 17:32:03 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7DF7D1955F41; Fri, 29 Nov 2024 17:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901525; 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=TiL9pH5cIq3jBdyWCkXQVTmhwDXpS93CWDVMG70rST8=; b=hlEQ835zvtWwUYv7c9ZKN/8QITLaDMBh6zgDR6Ff0MtxCaEFVsi6u5v3EBMo54oCMYCEL7 mfaG/hS4qFYu0E1UIi9pMcJQxCtuqGJbndiMGlsz+dBmRng6wEACvKwTXCNVV7yOb9UoFf XvFmsgOZQ2RazP2gGP+wy+WAmcuDkuw= X-MC-Unique: vRCoqlfTNPaSdNjJ3NJaaQ-1 X-Mimecast-MFC-AGG-ID: vRCoqlfTNPaSdNjJ3NJaaQ From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 15/22] tests/functional: add common zip_extract helper Date: Fri, 29 Nov 2024 17:31:13 +0000 Message-ID: <20241129173120.761728-16-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901676969019100 This mirrors the existing archive_extract and cpio_extract helpers Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 1bf1c410d5..41bd1df666 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -46,6 +46,13 @@ def archive_extract(archive, dest_dir, member=3DNone): else: tf.extractall(path=3Ddest_dir) =20 +def zip_extract(archive, dest_dir, member=3DNone): + with zipfile.ZipFile(archive, 'r') as zf: + if member: + zf.extract(member=3Dmember, path=3Ddest_dir) + else: + zf.extractall(path=3Ddest_dir) + def gzip_uncompress(gz_path, output_path): if os.path.exists(output_path): return --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901655; cv=none; d=zohomail.com; s=zohoarc; b=f6D8UjoSl1h4WtPjDd+tPaE7C/UfMroUB91LFFYxQe8MdJh3NgSpckoTmIc+ij26mY3PSPMZeiXxDPkqt9kRHuETox22/gBnhjRN+6b15mnTTczrSEXlqe0d2FOmjG7ukVCUx7jgV5ehZ3rUFvzlSpO91ZzHmlm9IEHNZPB5ZWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901655; 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=Sux808zrkHdt32pEDIjc5mJX+mxJhiB1+QIujRoog80=; b=RKY9lo9ATG/4CbQIN5b+YI5I66rR7FFufFt9EyHgAKrjmJVrKw40saoKfXT3gwLxxEcbF0b2i/LWGMjHQHZivrKsUu1B7mPDxDWkLV+Np/SEdevKKVuysyXTd0n9ziwBRA97NwgP9HX09zbCYvtIC2OaNgO7ei+z2bflawhS340= 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 1732901655591190.39815602812575; Fri, 29 Nov 2024 09:34:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rF-0004Qx-7D; Fri, 29 Nov 2024 12:32:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qk-0003n0-10 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:15 -0500 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 1tH4qi-00014z-7V for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:13 -0500 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-682-T67vVfZUPj-UE3jTXE-vMw-1; Fri, 29 Nov 2024 12:32:07 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 22C481956095; Fri, 29 Nov 2024 17:32:06 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 112FB1955F2D; Fri, 29 Nov 2024 17:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901530; 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=Sux808zrkHdt32pEDIjc5mJX+mxJhiB1+QIujRoog80=; b=amMR0dIDeZkyuHmFaXBPj1Xd5KTBCVxhdL/7WFCf+k4ilCtkeo8imoRuscl4CLx8r8DdVB o3uKI/KG9n5W8GOURDthNgxfJDHeAs5atYVmaZhtAmb933zd2WZ16wsp6cljfaZ/8XyBv9 nyOy00FkQrlRdhv5ifxiM2ZoicbqIf8= X-MC-Unique: T67vVfZUPj-UE3jTXE-vMw-1 X-Mimecast-MFC-AGG-ID: T67vVfZUPj-UE3jTXE-vMw From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 16/22] tests/functional: add common deb_extract helper Date: Fri, 29 Nov 2024 17:31:14 +0000 Message-ID: <20241129173120.761728-17-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901656989019100 This mirrors the existing archive_extract, cpio_extract and zip_extract helpers Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/linuxkernel.py | 15 +++++---------- tests/functional/qemu_test/utils.py | 13 +++++++++++++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/q= emu_test/linuxkernel.py index a6525f9dd6..fb6a158d36 100644 --- a/tests/functional/qemu_test/linuxkernel.py +++ b/tests/functional/qemu_test/linuxkernel.py @@ -6,8 +6,8 @@ import os =20 from .testcase import QemuSystemTest -from .cmd import run_cmd, wait_for_console_pattern -from .utils import archive_extract +from .cmd import wait_for_console_pattern +from .utils import deb_extract =20 class LinuxKernelTest(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' @@ -37,16 +37,11 @@ def extract_from_deb(self, deb_path, path): :param path: path within the deb archive of the file to be extract= ed :returns: path of the extracted file """ - cwd =3D os.getcwd() - os.chdir(self.workdir) - (stdout, stderr, ret) =3D run_cmd(['ar', 't', deb_path]) - file_path =3D stdout.split()[2] - run_cmd(['ar', 'x', deb_path, file_path]) - archive_extract(file_path, self.workdir) - os.chdir(cwd) + relpath =3D os.path.relpath(path, '/') + deb_extract(deb_path, self.workdir, member=3D"." + path) # Return complete path to extracted file. Because callers to # extract_from_deb() specify 'path' with a leading slash, it is # necessary to use 'relative_to()' to turn it into a relative # path for joining to the scratch dir - return os.path.normpath(self.scratch_file(os.path.relpath(path, '/= '))) + return os.path.normpath(self.scratch_file(relpath)) =20 diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 41bd1df666..bafe7fb80e 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -15,6 +15,8 @@ import subprocess import tarfile =20 +from .cmd import run_cmd + """ Round up to next power of 2 """ @@ -53,6 +55,17 @@ def zip_extract(archive, dest_dir, member=3DNone): else: zf.extractall(path=3Ddest_dir) =20 +def deb_extract(archive, dest_dir, member=3DNone): + cwd =3D os.getcwd() + os.chdir(dest_dir) + try: + (stdout, stderr, ret) =3D run_cmd(['ar', 't', archive]) + file_path =3D stdout.split()[2] + run_cmd(['ar', 'x', archive, file_path]) + archive_extract(file_path, dest_dir, member) + finally: + os.chdir(cwd) + def gzip_uncompress(gz_path, output_path): if os.path.exists(output_path): return --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901640; cv=none; d=zohomail.com; s=zohoarc; b=iZ0O3469Z9305gmrcmacjPdPnoCKKk7AbXhTmcnEfXMEa/6I4CKTbVt3OfEUEqr/Ydm1B5gRPSrdEpGxspoV61Zcm11aYxdFvH6Ywos0V5V+GXGi/71kzAevTsUTfOtdsczLJP8mR2Jaa52NMo5Mlq7KNiWtJv+OltgL7Z+1BAk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901640; 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=od46fyFHGQSX2N+7OwKJhq2uBvXEJxe08brTaemqLHY=; b=Sjr+xPHxzoIVWolHWpZPihPI1FXP+XqTgna0H6T3ODvuyjLyp8bU3+oGGpSaLX+FjyTmtEOGmz8LHX7z5kTrX233Uz9hGGDoSGOOPBsSX9cuYTSJYbaupIZ/MGn4mFxPIT+855Mo7ivHZ/4/4qvamNspG2MCsY8zzxPc3yua+B4= 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 1732901640682891.83340403652; Fri, 29 Nov 2024 09:34:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rr-0007MT-He; Fri, 29 Nov 2024 12:33:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4rp-00076R-3j for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:33:21 -0500 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 1tH4rn-0001pS-9D for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:33:20 -0500 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-76-OvL5WP_HP1yKahp_l6qOPQ-1; Fri, 29 Nov 2024 12:32:09 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 48A0719560A5; Fri, 29 Nov 2024 17:32:08 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9B51B1955F41; Fri, 29 Nov 2024 17:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901598; 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=od46fyFHGQSX2N+7OwKJhq2uBvXEJxe08brTaemqLHY=; b=f5R1woGaZdDGGMaQQZ35UJh+/SjxuNiCK1YpQuNtnl2PpdczgXZLqOTY8mr6Zi8CTa4z99 iQZipSrPsij2GvOalkv20XQXTN1pE7zjRH4Aq5LGu5BaEFyTFTKtRZXGrWHleyGkIuoSlI Ep8xoame6RRnrqFvQW+kEetLCDMu3Ns= X-MC-Unique: OvL5WP_HP1yKahp_l6qOPQ-1 X-Mimecast-MFC-AGG-ID: OvL5WP_HP1yKahp_l6qOPQ From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 17/22] tests/functional: generalize archive_extract Date: Fri, 29 Nov 2024 17:31:15 +0000 Message-ID: <20241129173120.761728-18-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901642853019100 There are many types of archives that the tests deal with, and 'archive_extract' suggests it can cope with any, rather than only tar files. Rename the existing method to 'tar_extract' and add a new method that can dynamically extract any zip, tar or cpio file based on file extension. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/utils.py | 31 +++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index bafe7fb80e..8c1df8f8c2 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -14,6 +14,7 @@ import shutil import subprocess import tarfile +import zipfile =20 from .cmd import run_cmd =20 @@ -38,7 +39,33 @@ def image_pow2ceil_expand(path): with open(path, 'ab+') as fd: fd.truncate(size_aligned) =20 -def archive_extract(archive, dest_dir, member=3DNone): +def archive_extract(archive, dest_dir, format=3DNone, member=3DNone): + if format =3D=3D "tar": + tar_extract(archive, dest_dir, member) + elif format =3D=3D "zip": + zip_extract(archive, dest_dir, member) + elif format =3D=3D "cpio": + if member is not None: + raise Exception("Unable to filter cpio extraction") + cpio_extract(archive, dest_dir) + elif format =3D=3D "deb": + deb_extract(archive, dest_dir, "./" + member) + else: + raise Exception(f"Unknown archive format {format}") + +def guess_archive_format(path): + if ".tar." in path or path.endswith("tgz"): + return "tar" + elif path.endswith(".zip"): + return "zip" + elif path.endswith(".cpio"): + return "cpio" + elif path.endswith(".deb") or path.endswith(".udeb"): + return "deb" + else: + raise Exception(f"Unknown archive format for {path}") + +def tar_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', @@ -62,7 +89,7 @@ def deb_extract(archive, dest_dir, member=3DNone): (stdout, stderr, ret) =3D run_cmd(['ar', 't', archive]) file_path =3D stdout.split()[2] run_cmd(['ar', 'x', archive, file_path]) - archive_extract(file_path, dest_dir, member) + archive_extract(file_path, dest_dir, format=3D"tar", member=3Dmemb= er) finally: os.chdir(cwd) =20 --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901707; cv=none; d=zohomail.com; s=zohoarc; b=jX+/zACrlIdrwIohxBd91jSnWZA+8d3GH6iy9itmxQwc3/HEjoT2Ypww9cjwiTdDShUPo1miqEFB4CDqEIaZBTwR2OteHPGnkmxt+g+H+nxGP7g8hmqwssZMe7DH/vEJImgG1rG4WfFywGM1Ptk/7effUk9+3uO7ciwTmJStXs0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901707; 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=FCyAAhK263iWl5BFLtlHla09sTGKZa2FAEZ0CUv+p+s=; b=ZmxSSxPkamziolxdhxurVZ7mgT+nlSSNLBacbxCndGhhKw3o1kXpk+W+TxcRBHh7fvmTXs2mJliZPAaoP9Xol4p4qWVUnYd+Ekei1V8MIZ7jFVLzseKaPV7KuVWzImRtJjwlLn71xFAmsqpBDYYiBbmZfZmBw+hTa44K2vsf1wc= 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 1732901707114161.66148586682255; Fri, 29 Nov 2024 09:35:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rL-0004bR-4H; Fri, 29 Nov 2024 12:32:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4ql-0003o6-O1 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:18 -0500 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 1tH4qk-00015E-3b for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:15 -0500 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-497-nKYGnbAdPb-pUqxjuLqY7w-1; Fri, 29 Nov 2024 12:32:11 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 E9F1D1955D93; Fri, 29 Nov 2024 17:32:10 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D78FF1955F41; Fri, 29 Nov 2024 17:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901533; 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=FCyAAhK263iWl5BFLtlHla09sTGKZa2FAEZ0CUv+p+s=; b=cdBwVf7CM03NphSMDNHM3DOngWYr/syMaZeC0MDizgCvA995ELDTC+PhJK3iBx1x/kE7Jp In8ved1fKvA+N6aPi9B3s6Dvzem9vcIxhcu4ynsT89Zzx1HtihQvYq7TRH1lg9DaCENxul 3PqI4pPMXw1N94aZJT0kw1o4D0fN0zw= X-MC-Unique: nKYGnbAdPb-pUqxjuLqY7w-1 X-Mimecast-MFC-AGG-ID: nKYGnbAdPb-pUqxjuLqY7w From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 18/22] tests/functional: add 'archive_extract' to QemuBaseTest Date: Fri, 29 Nov 2024 17:31:16 +0000 Message-ID: <20241129173120.761728-19-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901709160019100 This helper wrappers utils.archive_extract, forcing the use of the scratch directory, to ensure any extracted files are cleaned at test termination. If a specific member is requested, then the path to the extracted file is also returned. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/testcase.py | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index 2f32742387..31d06f0172 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -28,6 +28,8 @@ from .asset import Asset from .cmd import run_cmd from .config import BUILD_DIR +from .utils import (archive_extract as utils_archive_extract, + guess_archive_format) =20 =20 class QemuBaseTest(unittest.TestCase): @@ -39,6 +41,40 @@ class QemuBaseTest(unittest.TestCase): log =3D None logdir =3D None =20 + ''' + @params archive: filename, Asset, or file-like object to extract + @params sub_dir: optional sub-directory to extract into + @params member: optional member file to limit extraction to + + Extracts @archive into the scratch directory, or a + directory beneath named by @sub_dir. All files are + extracted unless @member specifies a limit. + + If @member is non-None, returns the fully qualified + path to @member + ''' + def archive_extract(self, archive, format=3DNone, sub_dir=3DNone, memb= er=3DNone): + if type(archive) =3D=3D Asset: + if format is None: + format =3D guess_archive_format(archive.url) + archive =3D archive.fetch() + elif format is None: + format =3D guess_archive_format(archive) + + if member is not None: + if os.path.isabs(member): + member =3D os.path.relpath(member, '/') + + if sub_dir is None: + utils_archive_extract(archive, self.scratch_file(), format, me= mber) + else: + utils_archive_extract(archive, self.scratch_file(sub_dir), + format, member) + + if member is not None: + return self.scratch_file(member) + return None + def socket_dir(self): if self.socketdir is None: self.socketdir =3D tempfile.TemporaryDirectory( --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901607; cv=none; d=zohomail.com; s=zohoarc; b=c34d8gWo1Nj6irw3yzPhc3/WxrtEND4AarvIYbylueEi9b3GBvB52DdVB8KKmILwMS2zi0ffzd1Xl0J47N401R3S8U4fKQBaxALbwiw6yk4EH68V3p8vPX3HULFhNoqUnJN+qeWkbKRCt7RymSjUcJBGIUy6yBfPL0XIhokuFUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901607; 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=Zo2Ev1h7XM8RNSSw5ZdsJlEx6lQdeBi9sJy/SAc7ROA=; b=Bbjm7cXrZetQ9+BD6ja4bAVW9R7FKPvwDVL7W1HRODIyeyVuKv9z6xMERcd8WbLrdGEpdpEyTqj4V2H6EKMJoOjFC8I4hCDHxfE/yFrlpLsyEKyDLDV5JrVTXjfr/iedSQraXtvxOTaY6qj3UYrJQ76Dff0BBs2MzBpbbzT02as= 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 1732901607574570.7376043232389; Fri, 29 Nov 2024 09:33:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rN-0004ji-S4; Fri, 29 Nov 2024 12:32:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qr-0003xX-LP for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:24 -0500 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 1tH4qn-00015k-Qm for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:21 -0500 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-584-LGcB97lJOyWWkjA7n18lpQ-1; Fri, 29 Nov 2024 12:32:14 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 7F693195608A; Fri, 29 Nov 2024 17:32:13 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 84D721955F2D; Fri, 29 Nov 2024 17:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901537; 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=Zo2Ev1h7XM8RNSSw5ZdsJlEx6lQdeBi9sJy/SAc7ROA=; b=LC3aGmt83hZdxlZgr5YgxRmOx+Oa2NiYn2w6EvORpXH3sM5VgddWfM4Iwj+/3hGoSGh59d dpjy3aWoj5/dIMTYwG1SR4HH0l4eAforvyPqPxufta4w9an0fi1lG3wHSKkenMPq8SgUDt jsca+KSumdidEq5OUgfsfvL2EYuDKRM= X-MC-Unique: LGcB97lJOyWWkjA7n18lpQ-1 X-Mimecast-MFC-AGG-ID: LGcB97lJOyWWkjA7n18lpQ From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 19/22] tests/functional: convert tests to new archive_extract helper Date: Fri, 29 Nov 2024 17:31:17 +0000 Message-ID: <20241129173120.761728-20-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901609095019100 Replace use of utils.archive_extract and extract_from_deb with the new archive_extract helper. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/linuxkernel.py | 19 +------------- tests/functional/test_aarch64_aspeed.py | 4 +-- tests/functional/test_aarch64_raspi3.py | 8 +----- tests/functional/test_aarch64_raspi4.py | 14 +++++----- tests/functional/test_acpi_bits.py | 15 +++-------- tests/functional/test_arm_aspeed.py | 26 +++++-------------- tests/functional/test_arm_bflt.py | 3 +-- tests/functional/test_arm_bpim2u.py | 22 +++++++--------- tests/functional/test_arm_canona1100.py | 10 +++---- tests/functional/test_arm_collie.py | 1 - tests/functional/test_arm_orangepi.py | 26 ++++++++----------- tests/functional/test_arm_raspi2.py | 14 +++++----- tests/functional/test_arm_sx1.py | 1 - tests/functional/test_arm_vexpress.py | 4 +-- tests/functional/test_m68k_mcf5208evb.py | 4 +-- tests/functional/test_m68k_q800.py | 5 ++-- .../functional/test_microblaze_s3adsp1800.py | 4 +-- .../test_microblazeel_s3adsp1800.py | 4 +-- tests/functional/test_mips64el_fuloong2e.py | 6 ++--- tests/functional/test_mips64el_malta.py | 6 ++--- tests/functional/test_mips_malta.py | 12 ++++----- tests/functional/test_mipsel_malta.py | 5 +--- tests/functional/test_or1k_sim.py | 4 +-- tests/functional/test_ppc64_e500.py | 4 +-- tests/functional/test_ppc_amiga.py | 5 +--- tests/functional/test_ppc_bamboo.py | 4 +-- tests/functional/test_ppc_mac.py | 5 +--- tests/functional/test_ppc_mpc8544ds.py | 7 +++-- tests/functional/test_ppc_virtex_ml507.py | 4 +-- tests/functional/test_sh4_r2d.py | 5 ++-- tests/functional/test_sh4eb_r2d.py | 5 ++-- tests/functional/test_sparc64_sun4u.py | 8 +++--- tests/functional/test_sparc_sun4m.py | 4 +-- tests/functional/test_xtensa_lx60.py | 4 +-- 34 files changed, 90 insertions(+), 182 deletions(-) diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/q= emu_test/linuxkernel.py index fb6a158d36..6a1bfdabba 100644 --- a/tests/functional/qemu_test/linuxkernel.py +++ b/tests/functional/qemu_test/linuxkernel.py @@ -7,7 +7,7 @@ =20 from .testcase import QemuSystemTest from .cmd import wait_for_console_pattern -from .utils import deb_extract + =20 class LinuxKernelTest(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' @@ -28,20 +28,3 @@ def launch_kernel(self, kernel, initrd=3DNone, dtb=3DNon= e, console_index=3D0, self.vm.launch() if wait_for: self.wait_for_console_pattern(wait_for) - - def extract_from_deb(self, deb_path, path): - """ - Extracts a file from a deb package into the test workdir - - :param deb_path: path to the deb archive - :param path: path within the deb archive of the file to be extract= ed - :returns: path of the extracted file - """ - relpath =3D os.path.relpath(path, '/') - deb_extract(deb_path, self.workdir, member=3D"." + path) - # Return complete path to extracted file. Because callers to - # extract_from_deb() specify 'path' with a leading slash, it is - # necessary to use 'relative_to()' to turn it into a relative - # path for joining to the scratch dir - return os.path.normpath(self.scratch_file(relpath)) - diff --git a/tests/functional/test_aarch64_aspeed.py b/tests/functional/tes= t_aarch64_aspeed.py index c6c6b74acc..3c2f9bc978 100644 --- a/tests/functional/test_aarch64_aspeed.py +++ b/tests/functional/test_aarch64_aspeed.py @@ -12,7 +12,6 @@ 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.utils import archive_extract =20 class AST2x00MachineSDK(QemuSystemTest): =20 @@ -35,8 +34,7 @@ def do_test_aarch64_aspeed_sdk_start(self, image): def test_aarch64_ast2700_evb_sdk_v09_02(self): self.set_machine('ast2700-evb') =20 - image_path =3D self.ASSET_SDK_V902_AST2700.fetch() - archive_extract(image_path, self.workdir) + self.archive_extract(self.ASSET_SDK_V902_AST2700) =20 num_cpu =3D 4 uboot_size =3D os.path.getsize(self.scratch_file('ast2700-default', diff --git a/tests/functional/test_aarch64_raspi3.py b/tests/functional/tes= t_aarch64_raspi3.py index 98ed6f9d56..74f6630ed2 100755 --- a/tests/functional/test_aarch64_raspi3.py +++ b/tests/functional/test_aarch64_raspi3.py @@ -7,8 +7,6 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -from zipfile import ZipFile - from qemu_test import LinuxKernelTest, Asset =20 =20 @@ -21,11 +19,7 @@ class Aarch64Raspi3Machine(LinuxKernelTest): =20 def test_aarch64_raspi3_atf(self): efi_name =3D 'RPI_EFI.fd' - zip_path =3D self.ASSET_RPI3_UEFI.fetch() - - with ZipFile(zip_path, 'r') as zf: - zf.extract(efi_name, path=3Dself.workdir) - efi_fd =3D self.scratch_file(efi_name) + efi_fd =3D self.archive_extract(self.ASSET_RPI3_UEFI, member=3Defi= _name) =20 self.set_machine('raspi3b') self.vm.set_console(console_index=3D1) diff --git a/tests/functional/test_aarch64_raspi4.py b/tests/functional/tes= t_aarch64_raspi4.py index 6d68411528..4f95a3a61a 100755 --- a/tests/functional/test_aarch64_raspi4.py +++ b/tests/functional/test_aarch64_raspi4.py @@ -30,9 +30,10 @@ class Aarch64Raspi4Machine(LinuxKernelTest): '7c0b16d1853772f6f4c3ca63e789b3b9ff4936efac9c8a01fb0c98c05c7a7648') =20 def test_arm_raspi4(self): - deb_path =3D self.ASSET_KERNEL_20190215.fetch() - kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel8.img= ') - dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-= b.dtb') + kernel_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/kernel8.img') + dtb_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/bcm2711-rpi-4-b.dt= b') =20 self.set_machine('raspi4b') self.vm.set_console() @@ -58,9 +59,10 @@ def test_arm_raspi4(self): =20 =20 def test_arm_raspi4_initrd(self): - deb_path =3D self.ASSET_KERNEL_20190215.fetch() - kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel8.img= ') - dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-= b.dtb') + kernel_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/kernel8.img') + dtb_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/bcm2711-rpi-4-b.dt= b') initrd_path_gz =3D self.ASSET_INITRD.fetch() initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp= i_bits.py index a2872d2ddf..0649fba545 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -37,9 +37,7 @@ import re import shutil import subprocess -import tarfile import tempfile -import zipfile =20 from typing import ( List, @@ -262,19 +260,12 @@ def setUp(self): # pylint: disable=3Darguments-differ %(self.BITS_INTERNAL_VER, self.BITS_COMMIT_HASH)) =20 - bitsLocalArtLoc =3D self.ASSET_BITS.fetch() - self.logger.info("downloaded bits artifacts to %s", bitsLocalArtLo= c) - # extract the bits artifact in the temp working directory - with zipfile.ZipFile(bitsLocalArtLoc, 'r') as zref: - zref.extractall(prebuiltDir) + self.archive_extract(self.ASSET_BITS, sub_dir=3D'prebuilt', format= =3D'zip') =20 # extract the bits software in the temp working directory - with zipfile.ZipFile(bits_zip_file, 'r') as zref: - zref.extractall(self.workdir) - - with tarfile.open(grub_tar_file, 'r', encoding=3D'utf-8') as tarba= ll: - tarball.extractall(self.workdir) + self.archive_extract(bits_zip_file) + self.archive_extract(grub_tar_file) =20 self.copy_test_scripts() self.copy_bits_config() diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar= m_aspeed.py index ca223ac8f0..8e8fac9d7a 100755 --- a/tests/functional/test_arm_aspeed.py +++ b/tests/functional/test_arm_aspeed.py @@ -15,8 +15,6 @@ interrupt_interactive_console_until_pattern, skipIfMissingCommands, ) -from qemu_test.utils import archive_extract -from zipfile import ZipFile from unittest import skipUnless =20 class AST1030Machine(LinuxKernelTest): @@ -29,12 +27,8 @@ class AST1030Machine(LinuxKernelTest): def test_ast1030_zephyros_1_04(self): self.set_machine('ast1030-evb') =20 - zip_file =3D self.ASSET_ZEPHYR_1_04.fetch() - - kernel_name =3D "ast1030-evb-demo/zephyr.elf" - with ZipFile(zip_file, 'r') as zf: - zf.extract(kernel_name, path=3Dself.workdir) - kernel_file =3D self.scratch_file(kernel_name) + kernel_file =3D self.archive_extract( + self.ASSET_ZEPHYR_1_04, member=3D"ast1030-evb-demo/zephyr.elf") =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic') @@ -51,12 +45,8 @@ def test_ast1030_zephyros_1_04(self): def test_ast1030_zephyros_1_07(self): self.set_machine('ast1030-evb') =20 - zip_file =3D self.ASSET_ZEPHYR_1_07.fetch() - - kernel_name =3D "ast1030-evb-demo/zephyr.bin" - with ZipFile(zip_file, 'r') as zf: - zf.extract(kernel_name, path=3Dself.workdir) - kernel_file =3D self.scratch_file(kernel_name) + kernel_file =3D self.archive_extract( + self.ASSET_ZEPHYR_1_07, member=3D"ast1030-evb-demo/zephyr.bin") =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic') @@ -270,9 +260,7 @@ def do_test_arm_aspeed_sdk_start(self, image): def test_arm_ast2500_evb_sdk(self): self.set_machine('ast2500-evb') =20 - image_path =3D self.ASSET_SDK_V806_AST2500.fetch() - - archive_extract(image_path, self.workdir) + self.archive_extract(self.ASSET_SDK_V806_AST2500) =20 self.do_test_arm_aspeed_sdk_start( self.scratch_file('ast2500-default', 'image-bmc')) @@ -286,9 +274,7 @@ def test_arm_ast2500_evb_sdk(self): def test_arm_ast2600_evb_sdk(self): self.set_machine('ast2600-evb') =20 - image_path =3D self.ASSET_SDK_V806_AST2600_A2.fetch() - - archive_extract(image_path, self.workdir) + self.archive_extract(self.ASSET_SDK_V806_AST2600_A2) =20 self.vm.add_args('-device', 'tmp105,bus=3Daspeed.i2c.bus.5,address=3D0x4d,id=3Dtmp-test'); diff --git a/tests/functional/test_arm_bflt.py b/tests/functional/test_arm_= bflt.py index c73e0bfa8c..38d8c4b744 100755 --- a/tests/functional/test_arm_bflt.py +++ b/tests/functional/test_arm_bflt.py @@ -11,7 +11,6 @@ from qemu_test import QemuUserTest, Asset, has_cmd from qemu_test import (QemuUserTest, Asset, skipIfMissingCommands, skipUntrustedTest) -from qemu_test.utils import cpio_extract =20 =20 class LoadBFLT(QemuUserTest): @@ -28,7 +27,7 @@ def test_stm32(self): busybox_path =3D self.scratch_file("bin", "busybox") =20 with bz2.open(rootfs_path_bz2, 'rb') as cpio_handle: - cpio_extract(cpio_handle, self.workdir) + self.archive_extract(cpio_handle, format=3D"cpio") =20 res =3D self.run_cmd(busybox_path) ver =3D 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call = binary.' diff --git a/tests/functional/test_arm_bpim2u.py b/tests/functional/test_ar= m_bpim2u.py index 69f6cdaf68..fd30984e6b 100755 --- a/tests/functional/test_arm_bpim2u.py +++ b/tests/functional/test_arm_bpim2u.py @@ -10,7 +10,7 @@ from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, Asset, interrupt_interactive_console_until_pattern, skipBigDataTest) -from qemu_test.utils import (archive_extract, gzip_uncompress, lzma_uncomp= ress, +from qemu_test.utils import (gzip_uncompress, lzma_uncompress, image_pow2ceil_expand) =20 =20 @@ -39,12 +39,11 @@ class BananaPiMachine(LinuxKernelTest): =20 def test_arm_bpim2u(self): self.set_machine('bpim2u') - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') + kernel_path =3D self.archive_extract( + self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + @@ -61,12 +60,11 @@ def test_arm_bpim2u(self): =20 def test_arm_bpim2u_initrd(self): self.set_machine('bpim2u') - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') + kernel_path =3D self.archive_extract( + self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) initrd_path_gz =3D self.ASSET_INITRD.fetch() initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) @@ -100,11 +98,11 @@ def test_arm_bpim2u_gmac(self): self.require_netdev('user') =20 deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') + kernel_path =3D self.archive_extract( + self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) rootfs_path_xz =3D self.ASSET_ROOTFS.fetch() rootfs_path =3D self.scratch_file('rootfs.cpio') lzma_uncompress(rootfs_path_xz, rootfs_path) diff --git a/tests/functional/test_arm_canona1100.py b/tests/functional/tes= t_arm_canona1100.py index cee6a23ed1..5cfb6a0ceb 100755 --- a/tests/functional/test_arm_canona1100.py +++ b/tests/functional/test_arm_canona1100.py @@ -11,7 +11,6 @@ # later. See the COPYING file in the top-level directory. =20 from qemu_test import QemuSystemTest, Asset, 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""" @@ -25,13 +24,10 @@ class CanonA1100Machine(QemuSystemTest): def test_arm_canona1100(self): self.set_machine('canon-a1100') =20 - file_path =3D self.ASSET_BIOS.fetch() - archive_extract(file_path, dest_dir=3Dself.workdir, - member=3D"day18/barebox.canon-a1100.bin") + bios =3D self.archive_extract(self.ASSET_BIOS, + member=3D"day18/barebox.canon-a1100.bi= n") self.vm.set_console() - self.vm.add_args('-bios', - self.scratch_file('day18', - 'barebox.canon-a1100.bin')) + self.vm.add_args('-bios', bios) self.vm.launch() wait_for_console_pattern(self, 'running /env/bin/init') =20 diff --git a/tests/functional/test_arm_collie.py b/tests/functional/test_ar= m_collie.py index 7e144a0a8f..78fe61dfdf 100755 --- a/tests/functional/test_arm_collie.py +++ b/tests/functional/test_arm_collie.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class CollieTest(LinuxKernelTest): =20 diff --git a/tests/functional/test_arm_orangepi.py b/tests/functional/test_= arm_orangepi.py index 7b5e7b6ae1..ff3b62e686 100755 --- a/tests/functional/test_arm_orangepi.py +++ b/tests/functional/test_arm_orangepi.py @@ -11,7 +11,7 @@ from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, Asset, interrupt_interactive_console_until_pattern, wait_for_console_pattern, skipBigDataTest) -from qemu_test.utils import (archive_extract, gzip_uncompress, lzma_uncomp= ress, +from qemu_test.utils import (gzip_uncompress, lzma_uncompress, image_pow2ceil_expand) =20 =20 @@ -50,11 +50,10 @@ class BananaPiMachine(LinuxKernelTest): =20 def test_arm_orangepi(self): self.set_machine('orangepi-pc') - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') + kernel_path =3D self.archive_extract( + self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-o= rangepi-pc.dtb' - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + @@ -71,11 +70,10 @@ def test_arm_orangepi(self): =20 def test_arm_orangepi_initrd(self): self.set_machine('orangepi-pc') - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') + kernel_path =3D self.archive_extract( + self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-o= rangepi-pc.dtb' - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) initrd_path_gz =3D self.ASSET_INITRD.fetch() initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) @@ -107,11 +105,10 @@ def test_arm_orangepi_initrd(self): def test_arm_orangepi_sd(self): self.set_machine('orangepi-pc') self.require_netdev('user') - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') + kernel_path =3D self.archive_extract( + self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-o= rangepi-pc.dtb' - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) rootfs_path_xz =3D self.ASSET_ROOTFS.fetch() rootfs_path =3D self.scratch_file('rootfs.cpio') lzma_uncompress(rootfs_path_xz, rootfs_path) @@ -189,13 +186,12 @@ def test_arm_orangepi_armbian(self): def test_arm_orangepi_uboot_netbsd9(self): self.set_machine('orangepi-pc') # This test download a 304MB compressed image and expand it to 2GB - deb_path =3D self.ASSET_UBOOT.fetch() # We use the common OrangePi PC 'plus' build of U-Boot for our sec= ondary # program loader (SPL). We will then set the path to the more spec= ific # OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot p= rompt, # before to boot NetBSD. uboot_path =3D '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-sp= l.bin' - uboot_path =3D self.extract_from_deb(deb_path, uboot_path) + uboot_path =3D self.archive_extract(self.ASSET_UBOOT, member=3Dubo= ot_path) image_path_gz =3D self.ASSET_NETBSD.fetch() image_path =3D self.scratch_file('armv7.img') gzip_uncompress(image_path_gz, image_path) diff --git a/tests/functional/test_arm_raspi2.py b/tests/functional/test_ar= m_raspi2.py index c59dd6c066..8724eee010 100755 --- a/tests/functional/test_arm_raspi2.py +++ b/tests/functional/test_arm_raspi2.py @@ -35,9 +35,10 @@ def do_test_arm_raspi2(self, uart_id): serial_kernel_cmdline =3D { 0: 'earlycon=3Dpl011,0x3f201000 console=3DttyAMA0', } - deb_path =3D self.ASSET_KERNEL_20190215.fetch() - kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel7.img= ') - dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-= b.dtb') + kernel_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/kernel7.img') + dtb_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/bcm2709-rpi-2-b.dt= b') =20 self.set_machine('raspi2b') self.vm.set_console() @@ -59,9 +60,10 @@ def test_arm_raspi2_uart0(self): self.do_test_arm_raspi2(0) =20 def test_arm_raspi2_initrd(self): - deb_path =3D self.ASSET_KERNEL_20190215.fetch() - kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel7.img= ') - dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-= b.dtb') + kernel_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/kernel7.img') + dtb_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'/boot/bcm2709-rpi-2-b.dt= b') initrd_path_gz =3D self.ASSET_INITRD.fetch() initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) diff --git a/tests/functional/test_arm_sx1.py b/tests/functional/test_arm_s= x1.py index 2292317946..aa08e6fb19 100755 --- a/tests/functional/test_arm_sx1.py +++ b/tests/functional/test_arm_sx1.py @@ -14,7 +14,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class SX1Test(LinuxKernelTest): =20 diff --git a/tests/functional/test_arm_vexpress.py b/tests/functional/test_= arm_vexpress.py index b1ac63ac36..3861366325 100755 --- a/tests/functional/test_arm_vexpress.py +++ b/tests/functional/test_arm_vexpress.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class VExpressTest(LinuxKernelTest): =20 @@ -16,8 +15,7 @@ class VExpressTest(LinuxKernelTest): =20 def test_arm_vexpressa9(self): self.set_machine('vexpress-a9') - file_path =3D self.ASSET_DAY16.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY16) self.launch_kernel(self.scratch_file('day16', 'winter.zImage'), dtb=3Dself.scratch_file('day16', 'vexpress-v2p-ca9.dtb'), diff --git a/tests/functional/test_m68k_mcf5208evb.py b/tests/functional/te= st_m68k_mcf5208evb.py index 449248c3e8..ae650ae4ca 100755 --- a/tests/functional/test_m68k_mcf5208evb.py +++ b/tests/functional/test_m68k_mcf5208evb.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class Mcf5208EvbTest(LinuxKernelTest): =20 @@ -16,8 +15,7 @@ class Mcf5208EvbTest(LinuxKernelTest): =20 def test_m68k_mcf5208evb(self): self.set_machine('mcf5208evb') - file_path =3D self.ASSET_DAY07.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY07) self.vm.set_console() self.vm.add_args('-kernel', self.scratch_file('day07', 'sanity-clause.elf')) diff --git a/tests/functional/test_m68k_q800.py b/tests/functional/test_m68= k_q800.py index 3b17244b98..c63f9b6935 100755 --- a/tests/functional/test_m68k_q800.py +++ b/tests/functional/test_m68k_q800.py @@ -18,9 +18,8 @@ class Q800MachineTest(LinuxKernelTest): def test_m68k_q800(self): self.set_machine('q800') =20 - deb_path =3D self.ASSET_KERNEL.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinux-5.3.0-1-m68k') + kernel_path =3D self.archive_extract(self.ASSET_KERNEL, + member=3D'/boot/vmlinux-5.3.0-1= -m68k') =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + diff --git a/tests/functional/test_microblaze_s3adsp1800.py b/tests/functio= nal/test_microblaze_s3adsp1800.py index aafc375d3c..56e5e082c8 100755 --- a/tests/functional/test_microblaze_s3adsp1800.py +++ b/tests/functional/test_microblaze_s3adsp1800.py @@ -9,7 +9,6 @@ =20 from qemu_test import (exec_command, exec_command_and_wait_for_pattern, QemuSystemTest, Asset, wait_for_console_pattern) -from qemu_test.utils import archive_extract =20 class MicroblazeMachine(QemuSystemTest): =20 @@ -22,8 +21,7 @@ class MicroblazeMachine(QemuSystemTest): =20 def test_microblaze_s3adsp1800(self): self.set_machine('petalogix-s3adsp1800') - file_path =3D self.ASSET_IMAGE.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_IMAGE) self.vm.set_console() self.vm.add_args('-kernel', self.scratch_file('day17', 'ballerina.bin')) diff --git a/tests/functional/test_microblazeel_s3adsp1800.py b/tests/funct= ional/test_microblazeel_s3adsp1800.py index 9ea9182f42..9cc516ebf3 100755 --- a/tests/functional/test_microblazeel_s3adsp1800.py +++ b/tests/functional/test_microblazeel_s3adsp1800.py @@ -10,7 +10,6 @@ import time from qemu_test import (exec_command, exec_command_and_wait_for_pattern, QemuSystemTest, Asset, wait_for_console_pattern) -from qemu_test.utils import archive_extract =20 class MicroblazeelMachine(QemuSystemTest): =20 @@ -23,8 +22,7 @@ class MicroblazeelMachine(QemuSystemTest): 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.archive_extract(self.ASSET_IMAGE) self.vm.set_console() self.vm.add_args('-kernel', self.scratch_file('day13', 'xmaton.bin= ')) tftproot =3D self.scratch_file('day13') diff --git a/tests/functional/test_mips64el_fuloong2e.py b/tests/functional= /test_mips64el_fuloong2e.py index 8d0ae8d1d5..920a7ec881 100755 --- a/tests/functional/test_mips64el_fuloong2e.py +++ b/tests/functional/test_mips64el_fuloong2e.py @@ -27,9 +27,9 @@ class MipsFuloong2e(LinuxKernelTest): '2a70f15b397f4ced632b0c15cb22660394190644146d804d60a4796eefbe1f50') =20 def test_linux_kernel_3_16(self): - deb_path =3D self.ASSET_KERNEL.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinux-3.16.0-6-loongs= on-2e') + kernel_path =3D self.archive_extract( + self.ASSET_KERNEL, + member=3D'/boot/vmlinux-3.16.0-6-loongson-2e') =20 self.set_machine('fuloong2e') self.vm.set_console() diff --git a/tests/functional/test_mips64el_malta.py b/tests/functional/tes= t_mips64el_malta.py index cc17f8af1f..d4b3c1eeab 100755 --- a/tests/functional/test_mips64el_malta.py +++ b/tests/functional/test_mips64el_malta.py @@ -39,9 +39,9 @@ def test_mips64el_malta(self): [2] https://kernel-team.pages.debian.net/kernel-handbook/ ch-common-tasks.html#s-common-official """ - deb_path =3D self.ASSET_KERNEL_2_63_2.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinux-2.6.32-5-5kc-ma= lta') + kernel_path =3D self.archive_extract( + self.ASSET_KERNEL_2_63_2, + member=3D'/boot/vmlinux-2.6.32-5-5kc-malta') =20 self.set_machine('malta') self.vm.set_console() diff --git a/tests/functional/test_mips_malta.py b/tests/functional/test_mi= ps_malta.py index a6d80d0012..65300b7ddf 100755 --- a/tests/functional/test_mips_malta.py +++ b/tests/functional/test_mips_malta.py @@ -20,9 +20,9 @@ class MaltaMachineConsole(LinuxKernelTest): '16ca524148afb0626f483163e5edf352bc1ab0e4fc7b9f9d473252762f2c7a43') =20 def test_mips_malta(self): - deb_path =3D self.ASSET_KERNEL_2_63_2.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinux-2.6.32-5-4kc-ma= lta') + kernel_path =3D self.archive_extract( + self.ASSET_KERNEL_2_63_2, + member=3D'/boot/vmlinux-2.6.32-5-4kc-malta') =20 self.set_machine('malta') self.vm.set_console() @@ -46,9 +46,9 @@ def test_mips_malta(self): 'dcfe3a7fe3200da3a00d176b95caaa086495eb158f2bff64afc67d7e1eb2cddc') =20 def test_mips_malta_cpio(self): - deb_path =3D self.ASSET_KERNEL_4_5_0.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinux-4.5.0-2-4kc-mal= ta') + kernel_path =3D self.archive_extract( + self.ASSET_KERNEL_4_5_0, + member=3D'/boot/vmlinux-4.5.0-2-4kc-malta') initrd_path_gz =3D self.ASSET_INITRD.fetch() initrd_path =3D self.scratch_file('rootfs.cpio') gzip_uncompress(initrd_path_gz, initrd_path) diff --git a/tests/functional/test_mipsel_malta.py b/tests/functional/test_= mipsel_malta.py index c5bb4f73c8..90747ba2d0 100755 --- a/tests/functional/test_mipsel_malta.py +++ b/tests/functional/test_mipsel_malta.py @@ -15,7 +15,6 @@ interrupt_interactive_console_until_pattern, wait_for_console_pattern) from qemu_test.utils import lzma_uncompress -from zipfile import ZipFile =20 =20 class MaltaMachineConsole(LinuxKernelTest): @@ -75,9 +74,7 @@ class MaltaMachineYAMON(QemuSystemTest): =20 def test_mipsel_malta_yamon(self): yamon_bin =3D 'yamon-02.22.bin' - zip_path =3D self.ASSET_YAMON_ROM.fetch() - with ZipFile(zip_path, 'r') as zf: - zf.extract(yamon_bin, path=3Dself.workdir) + self.archive_extract(self.ASSET_YAMON_ROM) yamon_path =3D self.scratch_file(yamon_bin) =20 self.set_machine('malta') diff --git a/tests/functional/test_or1k_sim.py b/tests/functional/test_or1k= _sim.py index a5b2b5b1e5..49f2e3467e 100755 --- a/tests/functional/test_or1k_sim.py +++ b/tests/functional/test_or1k_sim.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class OpenRISC1kSimTest(LinuxKernelTest): =20 @@ -16,8 +15,7 @@ class OpenRISC1kSimTest(LinuxKernelTest): =20 def test_or1k_sim(self): self.set_machine('or1k-sim') - file_path =3D self.ASSET_DAY20.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY20) self.vm.set_console() self.vm.add_args('-kernel', self.scratch_file('day20', 'vmlinux')) self.vm.launch() diff --git a/tests/functional/test_ppc64_e500.py b/tests/functional/test_pp= c64_e500.py index bf4a6af9d4..24295646e0 100755 --- a/tests/functional/test_ppc64_e500.py +++ b/tests/functional/test_ppc64_e500.py @@ -5,7 +5,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class E500Test(LinuxKernelTest): =20 @@ -16,8 +15,7 @@ class E500Test(LinuxKernelTest): def test_ppc64_e500(self): self.set_machine('ppce500') self.cpu =3D 'e5500' - file_path =3D self.ASSET_DAY19.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY19) self.launch_kernel(self.scratch_file('day19', 'uImage'), wait_for=3D'QEMU advent calendar') =20 diff --git a/tests/functional/test_ppc_amiga.py b/tests/functional/test_ppc= _amiga.py index 3e1a666c45..8508697456 100755 --- a/tests/functional/test_ppc_amiga.py +++ b/tests/functional/test_ppc_amiga.py @@ -10,7 +10,6 @@ import subprocess =20 from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern, run= _cmd -from zipfile import ZipFile =20 class AmigaOneMachine(QemuSystemTest): =20 @@ -25,9 +24,7 @@ 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) + self.archive_extract(self.ASSET_IMAGE, format=3D"zip") bios =3D self.scratch_file("u-boot-amigaone.bin") with open(bios, "wb") as bios_fh: subprocess.run(['tail', '-c', '524288', diff --git a/tests/functional/test_ppc_bamboo.py b/tests/functional/test_pp= c_bamboo.py index 7ec173cbcd..2890200b92 100755 --- a/tests/functional/test_ppc_bamboo.py +++ b/tests/functional/test_ppc_bamboo.py @@ -7,7 +7,6 @@ # 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 qemu_test.utils import archive_extract from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, exec_command_and_wait_for_pattern) =20 @@ -25,8 +24,7 @@ def test_ppc_bamboo(self): self.set_machine('bamboo') self.require_accelerator("tcg") self.require_netdev('user') - file_path =3D self.ASSET_IMAGE.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_IMAGE) self.vm.set_console() self.vm.add_args('-kernel', self.scratch_file('system-image-powerpc-440fp', diff --git a/tests/functional/test_ppc_mac.py b/tests/functional/test_ppc_m= ac.py index 10812824bd..e6b730c243 100755 --- a/tests/functional/test_ppc_mac.py +++ b/tests/functional/test_ppc_mac.py @@ -5,7 +5,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class MacTest(LinuxKernelTest): =20 @@ -19,9 +18,7 @@ def do_day15_test(self): # we're running kvm_hv or kvm_pr. For now let's disable this test # if we don't have TCG support. self.require_accelerator("tcg") - - file_path =3D self.ASSET_DAY15.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY15) self.vm.add_args('-M', 'graphics=3Doff') self.launch_kernel(self.scratch_file('day15', 'invaders.elf'), wait_for=3D'QEMU advent calendar') diff --git a/tests/functional/test_ppc_mpc8544ds.py b/tests/functional/test= _ppc_mpc8544ds.py index 1089d5ff5b..8ca2257967 100755 --- a/tests/functional/test_ppc_mpc8544ds.py +++ b/tests/functional/test_ppc_mpc8544ds.py @@ -7,7 +7,6 @@ # 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 qemu_test.utils import archive_extract from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern =20 class Mpc8544dsMachine(QemuSystemTest): @@ -24,10 +23,10 @@ class Mpc8544dsMachine(QemuSystemTest): def test_ppc_mpc8544ds(self): self.require_accelerator("tcg") self.set_machine('mpc8544ds') - file_path =3D self.ASSET_IMAGE.fetch() - archive_extract(file_path, self.workdir, member=3D'creek/creek.bin= ') + kernel_file =3D self.archive_extract(self.ASSET_IMAGE, + member=3D'creek/creek.bin') self.vm.set_console() - self.vm.add_args('-kernel', self.scratch_file('creek', 'creek.bin'= )) + self.vm.add_args('-kernel', kernel_file) self.vm.launch() wait_for_console_pattern(self, 'QEMU advent calendar 2020', self.panic_message) diff --git a/tests/functional/test_ppc_virtex_ml507.py b/tests/functional/t= est_ppc_virtex_ml507.py index f39dfa5ae4..5f2a22c2c2 100755 --- a/tests/functional/test_ppc_virtex_ml507.py +++ b/tests/functional/test_ppc_virtex_ml507.py @@ -7,7 +7,6 @@ # 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 qemu_test.utils import archive_extract from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern =20 class VirtexMl507Machine(QemuSystemTest): @@ -24,8 +23,7 @@ class VirtexMl507Machine(QemuSystemTest): def test_ppc_virtex_ml507(self): self.require_accelerator("tcg") self.set_machine('virtex-ml507') - file_path =3D self.ASSET_IMAGE.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_IMAGE) self.vm.set_console() self.vm.add_args('-kernel', self.scratch_file('hippo', 'hippo.linu= x'), '-dtb', self.scratch_file('hippo', diff --git a/tests/functional/test_sh4_r2d.py b/tests/functional/test_sh4_r= 2d.py index dca4601392..03a648374c 100755 --- a/tests/functional/test_sh4_r2d.py +++ b/tests/functional/test_sh4_r2d.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset, skipFlakyTest -from qemu_test.utils import archive_extract + =20 class R2dTest(LinuxKernelTest): =20 @@ -19,8 +19,7 @@ class R2dTest(LinuxKernelTest): @skipFlakyTest(bug_url=3DNone) def test_r2d(self): self.set_machine('r2d') - file_path =3D self.ASSET_DAY09.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY09) self.vm.add_args('-append', 'console=3DttySC1') self.launch_kernel(self.scratch_file('day09', 'zImage'), console_index=3D1, diff --git a/tests/functional/test_sh4eb_r2d.py b/tests/functional/test_sh4= eb_r2d.py index 38ee55cf4c..7087ab4c92 100755 --- a/tests/functional/test_sh4eb_r2d.py +++ b/tests/functional/test_sh4eb_r2d.py @@ -6,7 +6,7 @@ =20 from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern) -from qemu_test.utils import archive_extract + =20 class R2dEBTest(LinuxKernelTest): =20 @@ -16,8 +16,7 @@ class R2dEBTest(LinuxKernelTest): =20 def test_sh4eb_r2d(self): self.set_machine('r2d') - file_path =3D self.ASSET_TGZ.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_TGZ) self.vm.add_args('-append', 'console=3DttySC1 noiotrap') self.launch_kernel(self.scratch_file('sh4eb', 'linux-kernel'), initrd=3Dself.scratch_file('sh4eb', 'initramfs.= cpio.gz'), diff --git a/tests/functional/test_sparc64_sun4u.py b/tests/functional/test= _sparc64_sun4u.py index 43617f1aaf..d1261639b4 100755 --- a/tests/functional/test_sparc64_sun4u.py +++ b/tests/functional/test_sparc64_sun4u.py @@ -11,7 +11,6 @@ # later. See the COPYING file in the top-level directory. =20 from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern -from qemu_test.utils import archive_extract =20 =20 class Sun4uMachine(QemuSystemTest): @@ -26,11 +25,10 @@ class Sun4uMachine(QemuSystemTest): =20 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) + kernel_file =3D self.archive_extract(self.ASSET_IMAGE, + member=3D'day23/vmlinux') self.vm.set_console() - self.vm.add_args('-kernel', self.scratch_file(kernel_name), + self.vm.add_args('-kernel', kernel_file, '-append', 'printk.time=3D0') self.vm.launch() wait_for_console_pattern(self, 'Starting logging: OK') diff --git a/tests/functional/test_sparc_sun4m.py b/tests/functional/test_s= parc_sun4m.py index 619c03d36a..468931f3ef 100755 --- a/tests/functional/test_sparc_sun4m.py +++ b/tests/functional/test_sparc_sun4m.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class Sun4mTest(LinuxKernelTest): =20 @@ -16,8 +15,7 @@ class Sun4mTest(LinuxKernelTest): =20 def test_sparc_ss20(self): self.set_machine('SS-20') - file_path =3D self.ASSET_DAY11.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY11) self.launch_kernel(self.scratch_file('day11', 'zImage.elf'), wait_for=3D'QEMU advent calendar') =20 diff --git a/tests/functional/test_xtensa_lx60.py b/tests/functional/test_x= tensa_lx60.py index 5048e4c69e..ec59509a34 100755 --- a/tests/functional/test_xtensa_lx60.py +++ b/tests/functional/test_xtensa_lx60.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import archive_extract =20 class XTensaLX60Test(LinuxKernelTest): =20 @@ -17,8 +16,7 @@ class XTensaLX60Test(LinuxKernelTest): def test_xtensa_lx60(self): self.set_machine('lx60') self.cpu =3D 'dc233c' - file_path =3D self.ASSET_DAY02.fetch() - archive_extract(file_path, self.workdir) + self.archive_extract(self.ASSET_DAY02) self.launch_kernel(self.scratch_file('day02', 'santas-sleigh-ride.elf'), wait_for=3D'QEMU advent calendar') --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901608; cv=none; d=zohomail.com; s=zohoarc; b=KBq0eJwU0jJRZ7KyotIVxcdOROFef3Ryvyx4Mo/E1btHJTEoIwvVejrAE4hvdjn0HfjL1WeQumcA83L2RnTQs2nzCht13Oazrv5iPjUsixg/JOjx3MdZGK/IywPmtVRkOE+a4D+9HpBk72F23W+YRzKFoujjevs9a8XZmBOJA5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901608; 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=S8oE50Xln0OaQahu+eCywKCurnfiG7RmcFzVi0Nb7rE=; b=dpw000QWdRmnb/nFOPrj+f9FzBVHSlws5ejQhEbSw+0SzGaxnraiy5FUykVrnDbdzPxaoPoNRnCj4WI5Deu0oS8DviLsZkQHJ4Hl8P76wfDVqxBFAdLMUOjXjaWUp692MDS823iNym+tbpsbVN0JKZfQPuXkXQdtJmpT7qBwtVc= 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 1732901608385814.0628181161666; Fri, 29 Nov 2024 09:33:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rO-0004rB-OR; Fri, 29 Nov 2024 12:32:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qs-0003xZ-93 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:24 -0500 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 1tH4qq-00016h-S6 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:22 -0500 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-573--O_dXb2AN4uLJ9A1O1_j6w-1; Fri, 29 Nov 2024 12:32:17 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 A85031955D50; Fri, 29 Nov 2024 17:32:16 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7DE9A1955F41; Fri, 29 Nov 2024 17:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901539; 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=S8oE50Xln0OaQahu+eCywKCurnfiG7RmcFzVi0Nb7rE=; b=gq3hGOOhuTTTLjeiif5AaFa6DUA6OZ4zxAC6HfOWPPmmOULg4269dcul+wD2IXk1O+Qod5 939fwAycJYdTcHwm2ljaCVUtRu0A/ef0OmjZ9oi70bGsbIm8tUFuPVwLKawzdNV7l3NTqL gAiYOx58KAwbxBE+HE4a+xgu+t9/jig= X-MC-Unique: -O_dXb2AN4uLJ9A1O1_j6w-1 X-Mimecast-MFC-AGG-ID: -O_dXb2AN4uLJ9A1O1_j6w From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 20/22] tests/functional: generalize uncompress Date: Fri, 29 Nov 2024 17:31:18 +0000 Message-ID: <20241129173120.761728-21-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901608690019100 There are many types of compression that the tests deal with, and it makes sense to have a single helper 'uncompress' that can deal with all. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 8c1df8f8c2..90c87b3671 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -115,6 +115,23 @@ def lzma_uncompress(xz_path, output_path): os.remove(output_path) raise =20 +def uncompress(input_path, output_path, format=3DNone): + if format =3D=3D "xz": + lzma_uncompress(input_path, output_path) + elif format =3D=3D "gz": + gzip_uncompress(input_path, output_path) + else: + raise Exception(f"Unknown compression format {format}") + +def guess_uncompress_format(path): + (name, ext) =3D os.path.splitext(path) + if ext =3D=3D ".xz": + return "xz" + elif ext =3D=3D ".gz": + return "gz" + else: + raise Exception(f"Unknown compression format for {path}") + def cpio_extract(cpio_handle, output_path): cwd =3D os.getcwd() os.chdir(output_path) --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901736; cv=none; d=zohomail.com; s=zohoarc; b=MjcFq1ZGi31zfJ5q9VLQ2hUT2k4tk80PaFBxAQHSKXvYvQuBLX1vbAZedSG/0hXzXsNhudq5SjQ+L5syuhPvJk/n5lsIr9MBOzWp7EkqcmSEzTbu2mM+oEi2C0uG/f1dTlbUpx+UTGulItMHSZ+7TM4murciRlOHt5NLIJRo65k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901736; 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=xL5Wxr2F74R3RQEXwSYCoWJhnI9k2JMIAfjAihei9rU=; b=Xh4OsQjmWrPgbYEud50J6Vi8gLBQDmE/saVk0zSWjSgaR5JGBSOnt+ayaLCt7bWHgnOwCKF+Ys8wYj2kYt0XDm2+hHfuRh0aiw/jZVbOJ1ZQm4dVGvxuSk64dZZ4xhIN+/RBUUV3W5nIDSQzw0qafcEWatfbL1/0bbiqNMdcpzE= 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 1732901736930665.1063044615912; Fri, 29 Nov 2024 09:35:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rP-0004z4-Ox; Fri, 29 Nov 2024 12:32:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qx-00046T-QQ for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:27 -0500 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 1tH4qw-00017Y-Cb for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:27 -0500 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-400-SpRAWYlVMeS0UrB2rcE9dQ-1; Fri, 29 Nov 2024 12:32:20 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 56B931955EA9; Fri, 29 Nov 2024 17:32:19 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 13CE21955F2F; Fri, 29 Nov 2024 17:32:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901545; 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=xL5Wxr2F74R3RQEXwSYCoWJhnI9k2JMIAfjAihei9rU=; b=DvBtAgZ3tH16cVO3V1qntehplsFkmzS1sGq2WjpLVk6qC8LEXQ+OBG8r0XW6MbHnQ1Ydcz e+gq0tMiFGnni33/ydbZi7tJ808NK+Ynr5YNpPxGTYOQu5DCZ/O+MBI75AbbfEnXFtWF4J XpTbjJ5nNpRxw385IzOAB7oN+gFpLmI= X-MC-Unique: SpRAWYlVMeS0UrB2rcE9dQ-1 X-Mimecast-MFC-AGG-ID: SpRAWYlVMeS0UrB2rcE9dQ From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 21/22] tests/functional: add 'uncompress' to QemuBaseTest Date: Fri, 29 Nov 2024 17:31:19 +0000 Message-ID: <20241129173120.761728-22-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901751995019100 This helper wrappers utils.uncompress, forcing the use of the scratch directory, to ensure any uncompressed files are cleaned at test termination. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/testcase.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index 31d06f0172..5c088a2442 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -29,7 +29,8 @@ from .cmd import run_cmd from .config import BUILD_DIR from .utils import (archive_extract as utils_archive_extract, - guess_archive_format) + uncompress as utils_uncompress, + guess_archive_format, guess_uncompress_format) =20 =20 class QemuBaseTest(unittest.TestCase): @@ -41,6 +42,21 @@ class QemuBaseTest(unittest.TestCase): log =3D None logdir =3D None =20 + def uncompress(self, input_path, format=3DNone): + if type(input_path) =3D=3D Asset: + if format is None: + format =3D guess_uncompress_format(input_path.url) + input_path =3D input_path.fetch() + elif format is None: + format =3D guess_uncompress_format(input_path) + + (name, ext) =3D os.path.splitext(input_path) + output_path =3D self.scratch_file(os.path.basename(name)) + + utils_uncompress(input_path, output_path) + + return output_path + ''' @params archive: filename, Asset, or file-like object to extract @params sub_dir: optional sub-directory to extract into --=20 2.46.0 From nobody Thu Dec 26 11:50:36 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=1732901689; cv=none; d=zohomail.com; s=zohoarc; b=BVKUlpL93GZInxGk76oJbQ0IAxtrB0MFD4MFWxgtgiqRIsN42BXWe1ABoB29+SIz7Ti5UyK+s1TZEj94RL+lZBeVOFSBNlxN7vWmV/UolFeQmUge8aqPTSwsR3RjMp/l1EO65Q44viwaN82IXoUamsEAzSG1ywS9LEMmego9uc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732901689; 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=CPJ1jAMbeTUugoGsXmA99voHNxJYR4JASHnvPOAsrR8=; b=Kqkms9QXZsLhv19c6whZdxIc7tjq8rSqtgvKtQagUL/sW7a0qi50r0JXVCZmqpVPfVBuwYV69zks0iFC7rop/doVC06f2QG9vSm1hpq78v17csYf+l+w5WsLdbp0f/cTArBM153VFwJTj13cdbO2N5CCsLNDGMneEI+QUSZi2o4= 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 1732901689356611.0615592546363; Fri, 29 Nov 2024 09:34:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tH4rI-0004Xs-8L; Fri, 29 Nov 2024 12:32:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tH4qx-000468-Jy for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:27 -0500 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 1tH4qv-00017L-5R for qemu-devel@nongnu.org; Fri, 29 Nov 2024 12:32:27 -0500 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-481-u9mS1jwzNtOqsd-SIvzq0w-1; Fri, 29 Nov 2024 12:32:23 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 37148195609F; Fri, 29 Nov 2024 17:32:22 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E65141955F41; Fri, 29 Nov 2024 17:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732901544; 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=CPJ1jAMbeTUugoGsXmA99voHNxJYR4JASHnvPOAsrR8=; b=MVd9+HcmxlD0y12gwtYI6IIj/xayzlqCdTsaHtAY724kAZ89TAPgiMkuuGr+h+kBuio50j gaUo8sEBOidHy1/7kQfQ2yVVOIhdfeQdA2QKBY3j1ZgwQiv4Tksuy3vJcW2GLkkcx3QGvJ oPyzKLUqJjQmFD1lWjuq0o2sBFiyOJs= X-MC-Unique: u9mS1jwzNtOqsd-SIvzq0w-1 X-Mimecast-MFC-AGG-ID: u9mS1jwzNtOqsd-SIvzq0w From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 22/22] tests/functional: convert tests to new uncompress helper Date: Fri, 29 Nov 2024 17:31:20 +0000 Message-ID: <20241129173120.761728-23-berrange@redhat.com> In-Reply-To: <20241129173120.761728-1-berrange@redhat.com> References: <20241129173120.761728-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 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_H2=-0.93, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1732901691408019100 Replace use of lzma_uncompress and gzip_uncompress with the new uncompress helper. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/testcase.py | 2 +- tests/functional/test_aarch64_raspi4.py | 5 +---- tests/functional/test_aarch64_sbsaref.py | 9 ++------- tests/functional/test_alpha_clipper.py | 4 +--- tests/functional/test_arm_bpim2u.py | 15 ++++----------- tests/functional/test_arm_orangepi.py | 19 +++++-------------- tests/functional/test_arm_raspi2.py | 5 +---- tests/functional/test_mips64el_malta.py | 9 ++------- tests/functional/test_mips_malta.py | 5 +---- tests/functional/test_mipsel_malta.py | 15 +++++---------- tests/functional/test_rx_gdbsim.py | 5 +---- tests/functional/test_s390x_ccw_virtio.py | 6 ++---- tests/functional/test_s390x_topology.py | 5 +---- 13 files changed, 27 insertions(+), 77 deletions(-) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index 5c088a2442..b91a72cda0 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -53,7 +53,7 @@ def uncompress(self, input_path, format=3DNone): (name, ext) =3D os.path.splitext(input_path) output_path =3D self.scratch_file(os.path.basename(name)) =20 - utils_uncompress(input_path, output_path) + utils_uncompress(input_path, output_path, format) =20 return output_path =20 diff --git a/tests/functional/test_aarch64_raspi4.py b/tests/functional/tes= t_aarch64_raspi4.py index 4f95a3a61a..8eca1c5fee 100755 --- a/tests/functional/test_aarch64_raspi4.py +++ b/tests/functional/test_aarch64_raspi4.py @@ -7,7 +7,6 @@ =20 from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern) -from qemu_test.utils import gzip_uncompress =20 =20 class Aarch64Raspi4Machine(LinuxKernelTest): @@ -63,9 +62,7 @@ def test_arm_raspi4_initrd(self): member=3D'/boot/kernel8.img') dtb_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, member=3D'/boot/bcm2711-rpi-4-b.dt= b') - initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D self.scratch_file('rootfs.cpio') - gzip_uncompress(initrd_path_gz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_INITRD) =20 self.set_machine('raspi4b') self.vm.set_console() diff --git a/tests/functional/test_aarch64_sbsaref.py b/tests/functional/te= st_aarch64_sbsaref.py index 4c173a0303..38de5f5ba9 100755 --- a/tests/functional/test_aarch64_sbsaref.py +++ b/tests/functional/test_aarch64_sbsaref.py @@ -10,7 +10,6 @@ =20 from qemu_test import (QemuSystemTest, Asset, wait_for_console_pattern, interrupt_interactive_console_until_pattern) -from qemu_test.utils import lzma_uncompress =20 =20 def fetch_firmware(test): @@ -29,14 +28,10 @@ def fetch_firmware(test): """ =20 # Secure BootRom (TF-A code) - fs0_xz_path =3D Aarch64SbsarefMachine.ASSET_FLASH0.fetch() - fs0_path =3D test.scratch_file("SBSA_FLASH0.fd") - lzma_uncompress(fs0_xz_path, fs0_path) + fs0_path =3D test.uncompress(Aarch64SbsarefMachine.ASSET_FLASH0) =20 # Non-secure rom (UEFI and EFI variables) - fs1_xz_path =3D Aarch64SbsarefMachine.ASSET_FLASH1.fetch() - fs1_path =3D test.scratch_file("SBSA_FLASH1.fd") - lzma_uncompress(fs1_xz_path, fs1_path) + fs1_path =3D test.uncompress(Aarch64SbsarefMachine.ASSET_FLASH1) =20 for path in [fs0_path, fs1_path]: with open(path, "ab+") as fd: diff --git a/tests/functional/test_alpha_clipper.py b/tests/functional/test= _alpha_clipper.py index 72cd7b57e6..c5d7181953 100755 --- a/tests/functional/test_alpha_clipper.py +++ b/tests/functional/test_alpha_clipper.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from qemu_test import LinuxKernelTest, Asset -from qemu_test.utils import gzip_uncompress =20 =20 class AlphaClipperTest(LinuxKernelTest): @@ -20,8 +19,7 @@ def test_alpha_clipper(self): self.set_machine('clipper') kernel_path =3D self.ASSET_KERNEL.fetch() =20 - uncompressed_kernel =3D self.scratch_file('vmlinux') - gzip_uncompress(kernel_path, uncompressed_kernel) + uncompressed_kernel =3D self.uncompress(self.ASSET_KERNEL, format= =3D"gz") =20 self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3DttyS0' diff --git a/tests/functional/test_arm_bpim2u.py b/tests/functional/test_ar= m_bpim2u.py index fd30984e6b..50ecf7babb 100755 --- a/tests/functional/test_arm_bpim2u.py +++ b/tests/functional/test_arm_bpim2u.py @@ -10,8 +10,7 @@ from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, Asset, interrupt_interactive_console_until_pattern, skipBigDataTest) -from qemu_test.utils import (gzip_uncompress, lzma_uncompress, - image_pow2ceil_expand) +from qemu_test.utils import (image_pow2ceil_expand) =20 =20 class BananaPiMachine(LinuxKernelTest): @@ -65,9 +64,7 @@ def test_arm_bpim2u_initrd(self): dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' 'sun8i-r40-bananapi-m2-ultra.dtb') dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) - initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D self.scratch_file('rootfs.cpio') - gzip_uncompress(initrd_path_gz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_INITRD) =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + @@ -103,9 +100,7 @@ def test_arm_bpim2u_gmac(self): dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' 'sun8i-r40-bananapi-m2-ultra.dtb') dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) - rootfs_path_xz =3D self.ASSET_ROOTFS.fetch() - rootfs_path =3D self.scratch_file('rootfs.cpio') - lzma_uncompress(rootfs_path_xz, rootfs_path) + rootfs_path =3D self.uncompress(self.ASSET_ROOTFS) image_pow2ceil_expand(rootfs_path) =20 self.vm.set_console() @@ -147,9 +142,7 @@ def test_arm_bpim2u_openwrt_22_03_3(self): self.set_machine('bpim2u') # This test download a 8.9 MiB compressed image and expand it # to 127 MiB. - image_path_gz =3D self.ASSET_SD_IMAGE.fetch() - image_path =3D self.scratch_file('sdcard.img') - gzip_uncompress(image_path_gz, image_path) + image_path =3D self.uncompress(self.ASSET_SD_IMAGE) image_pow2ceil_expand(image_path) =20 self.vm.set_console() diff --git a/tests/functional/test_arm_orangepi.py b/tests/functional/test_= arm_orangepi.py index ff3b62e686..9c3aad4dbc 100755 --- a/tests/functional/test_arm_orangepi.py +++ b/tests/functional/test_arm_orangepi.py @@ -11,8 +11,7 @@ from qemu_test import (LinuxKernelTest, exec_command_and_wait_for_pattern, Asset, interrupt_interactive_console_until_pattern, wait_for_console_pattern, skipBigDataTest) -from qemu_test.utils import (gzip_uncompress, lzma_uncompress, - image_pow2ceil_expand) +from qemu_test.utils import image_pow2ceil_expand =20 =20 class BananaPiMachine(LinuxKernelTest): @@ -74,9 +73,7 @@ def test_arm_orangepi_initrd(self): self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-o= rangepi-pc.dtb' dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) - initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D self.scratch_file('rootfs.cpio') - gzip_uncompress(initrd_path_gz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_INITRD) =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + @@ -109,9 +106,7 @@ def test_arm_orangepi_sd(self): self.ASSET_DEB, member=3D'/boot/vmlinuz-6.6.16-current-sunxi') dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun8i-h3-o= rangepi-pc.dtb' dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) - rootfs_path_xz =3D self.ASSET_ROOTFS.fetch() - rootfs_path =3D self.scratch_file('rootfs.cpio') - lzma_uncompress(rootfs_path_xz, rootfs_path) + rootfs_path =3D self.uncompress(self.ASSET_ROOTFS) image_pow2ceil_expand(rootfs_path) =20 self.vm.set_console() @@ -152,9 +147,7 @@ def test_arm_orangepi_armbian(self): # This test download a 275 MiB compressed image and expand it # to 1036 MiB, but the underlying filesystem is 1552 MiB... # As we expand it to 2 GiB we are safe. - image_path_xz =3D self.ASSET_ARMBIAN.fetch() - image_path =3D self.scratch_file('armbian.img') - lzma_uncompress(image_path_xz, image_path) + iamge_path =3D self.uncompress(self.ASSET_ARMBIAN) image_pow2ceil_expand(image_path) =20 self.vm.set_console() @@ -192,9 +185,7 @@ def test_arm_orangepi_uboot_netbsd9(self): # before to boot NetBSD. uboot_path =3D '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-sp= l.bin' uboot_path =3D self.archive_extract(self.ASSET_UBOOT, member=3Dubo= ot_path) - image_path_gz =3D self.ASSET_NETBSD.fetch() - image_path =3D self.scratch_file('armv7.img') - gzip_uncompress(image_path_gz, image_path) + image_path =3D self.uncompress(self.ASSET_NETBSD) image_pow2ceil_expand(image_path) image_drive_args =3D 'if=3Dsd,format=3Draw,snapshot=3Don,file=3D' = + image_path =20 diff --git a/tests/functional/test_arm_raspi2.py b/tests/functional/test_ar= m_raspi2.py index 8724eee010..8c001568f8 100755 --- a/tests/functional/test_arm_raspi2.py +++ b/tests/functional/test_arm_raspi2.py @@ -9,7 +9,6 @@ =20 from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern) -from qemu_test.utils import gzip_uncompress =20 =20 class ArmRaspi2Machine(LinuxKernelTest): @@ -64,9 +63,7 @@ def test_arm_raspi2_initrd(self): member=3D'/boot/kernel7.img') dtb_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, member=3D'/boot/bcm2709-rpi-2-b.dt= b') - initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D self.scratch_file('rootfs.cpio') - gzip_uncompress(initrd_path_gz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_INITRD) =20 self.set_machine('raspi2b') self.vm.set_console() diff --git a/tests/functional/test_mips64el_malta.py b/tests/functional/tes= t_mips64el_malta.py index d4b3c1eeab..7f7da37c0f 100755 --- a/tests/functional/test_mips64el_malta.py +++ b/tests/functional/test_mips64el_malta.py @@ -15,7 +15,6 @@ from qemu_test import (LinuxKernelTest, Asset, exec_command_and_wait_for_pattern, skipIfMissingImports, skipFlakyTest, skipUntrustedT= est) -from qemu_test.utils import gzip_uncompress =20 =20 class MaltaMachineConsole(LinuxKernelTest): @@ -67,9 +66,7 @@ def test_mips64el_malta(self): @skipUntrustedTest() def test_mips64el_malta_5KEc_cpio(self): kernel_path =3D self.ASSET_KERNEL_3_19_3.fetch() - initrd_path_gz =3D self.ASSET_CPIO_R1.fetch() - initrd_path =3D self.scratch_file('rootfs.cpio') - gzip_uncompress(initrd_path_gz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_CPIO_R1) =20 self.set_machine('malta') self.vm.set_console() @@ -119,9 +116,7 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_coun= t): =20 screendump_path =3D self.scratch_file('screendump.pbm') =20 - kernel_path_gz =3D self.ASSET_KERNEL_4_7_0.fetch() - kernel_path =3D self.scratch_file("vmlinux") - gzip_uncompress(kernel_path_gz, kernel_path) + kernel_path =3D self.uncompress(self.ASSET_KERNEL_4_7_0) =20 tuxlogo_path =3D self.ASSET_TUXLOGO.fetch() =20 diff --git a/tests/functional/test_mips_malta.py b/tests/functional/test_mi= ps_malta.py index 65300b7ddf..3695a9e6a6 100755 --- a/tests/functional/test_mips_malta.py +++ b/tests/functional/test_mips_malta.py @@ -8,7 +8,6 @@ =20 from qemu_test import LinuxKernelTest, Asset from qemu_test import exec_command_and_wait_for_pattern -from qemu_test.utils import gzip_uncompress =20 =20 class MaltaMachineConsole(LinuxKernelTest): @@ -49,9 +48,7 @@ def test_mips_malta_cpio(self): kernel_path =3D self.archive_extract( self.ASSET_KERNEL_4_5_0, member=3D'/boot/vmlinux-4.5.0-2-4kc-malta') - initrd_path_gz =3D self.ASSET_INITRD.fetch() - initrd_path =3D self.scratch_file('rootfs.cpio') - gzip_uncompress(initrd_path_gz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_INITRD) =20 self.set_machine('malta') self.vm.set_console() diff --git a/tests/functional/test_mipsel_malta.py b/tests/functional/test_= mipsel_malta.py index 90747ba2d0..aed41ac9b9 100755 --- a/tests/functional/test_mipsel_malta.py +++ b/tests/functional/test_mipsel_malta.py @@ -14,7 +14,6 @@ from qemu_test import (QemuSystemTest, LinuxKernelTest, Asset, interrupt_interactive_console_until_pattern, wait_for_console_pattern) -from qemu_test.utils import lzma_uncompress =20 =20 class MaltaMachineConsole(LinuxKernelTest): @@ -35,9 +34,8 @@ class MaltaMachineConsole(LinuxKernelTest): 'generic_nano32r6el_page64k_dbg.xz'), 'ce21ff4b07a981ecb8a39db2876616f5a2473eb2ab459c6f67465b9914b0c6b6') =20 - def do_test_mips_malta32el_nanomips(self, kernel_path_xz): - kernel_path =3D self.scratch_file('kernel') - lzma_uncompress(kernel_path_xz, kernel_path) + def do_test_mips_malta32el_nanomips(self, kernel): + kernel_path =3D self.uncompress(kernel) =20 self.set_machine('malta') self.vm.set_console() @@ -53,16 +51,13 @@ def do_test_mips_malta32el_nanomips(self, kernel_path_x= z): self.wait_for_console_pattern(console_pattern) =20 def test_mips_malta32el_nanomips_4k(self): - kernel_path_xz =3D self.ASSET_KERNEL_4K.fetch() - self.do_test_mips_malta32el_nanomips(kernel_path_xz) + self.do_test_mips_malta32el_nanomips(self.ASSET_KERNEL_4K) =20 def test_mips_malta32el_nanomips_16k_up(self): - kernel_path_xz =3D self.ASSET_KERNEL_16K.fetch() - self.do_test_mips_malta32el_nanomips(kernel_path_xz) + self.do_test_mips_malta32el_nanomips(self.ASSET_KERNEL_16K) =20 def test_mips_malta32el_nanomips_64k_dbg(self): - kernel_path_xz =3D self.ASSET_KERNEL_16K.fetch() - self.do_test_mips_malta32el_nanomips(kernel_path_xz) + self.do_test_mips_malta32el_nanomips(self.ASSET_KERNEL_64K) =20 =20 class MaltaMachineYAMON(QemuSystemTest): diff --git a/tests/functional/test_rx_gdbsim.py b/tests/functional/test_rx_= gdbsim.py index b7d5d7d062..d0238a0fd5 100755 --- a/tests/functional/test_rx_gdbsim.py +++ b/tests/functional/test_rx_gdbsim.py @@ -13,7 +13,6 @@ from qemu_test import (QemuSystemTest, Asset, exec_command_and_wait_for_pattern, wait_for_console_pattern, skipFlakyTest) -from qemu_test.utils import gzip_uncompress =20 =20 class RxGdbSimMachine(QemuSystemTest): @@ -37,9 +36,7 @@ def test_uboot(self): """ self.set_machine('gdbsim-r5f562n8') =20 - uboot_path_gz =3D self.ASSET_UBOOT.fetch() - uboot_path =3D self.scratch_file('u-boot.bin') - gzip_uncompress(uboot_path_gz, uboot_path) + uboot_path =3D self.uncompress(self.ASSET_UBOOT) =20 self.vm.set_console() self.vm.add_args('-bios', uboot_path, diff --git a/tests/functional/test_s390x_ccw_virtio.py b/tests/functional/t= est_s390x_ccw_virtio.py index e70fffa290..c24747d4a8 100755 --- a/tests/functional/test_s390x_ccw_virtio.py +++ b/tests/functional/test_s390x_ccw_virtio.py @@ -17,7 +17,7 @@ from qemu_test import (QemuSystemTest, Asset, exec_command_and_wait_for_pattern, wait_for_console_pattern) -from qemu_test.utils import lzma_uncompress + =20 class S390CCWVirtioMachine(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' @@ -174,9 +174,7 @@ def test_s390x_fedora(self): =20 kernel_path =3D self.ASSET_F31_KERNEL.fetch() =20 - initrd_path_xz =3D self.ASSET_F31_INITRD.fetch() - initrd_path =3D self.scratch_file('initrd-raw.img') - lzma_uncompress(initrd_path_xz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_F31_INITRD, format=3D"x= z") =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + ' audit= =3D0 ' diff --git a/tests/functional/test_s390x_topology.py b/tests/functional/tes= t_s390x_topology.py index 64276e4f7e..aa6ddb8601 100755 --- a/tests/functional/test_s390x_topology.py +++ b/tests/functional/test_s390x_topology.py @@ -13,7 +13,6 @@ from qemu_test import (QemuSystemTest, Asset, exec_command, exec_command_and_wait_for_pattern, wait_for_console_pattern) -from qemu_test.utils import lzma_uncompress =20 =20 class S390CPUTopology(QemuSystemTest): @@ -85,9 +84,7 @@ def kernel_init(self): """ self.require_accelerator("kvm") kernel_path =3D self.ASSET_F35_KERNEL.fetch() - initrd_path_xz =3D self.ASSET_F35_INITRD.fetch() - initrd_path =3D self.scratch_file('initrd-raw.img') - lzma_uncompress(initrd_path_xz, initrd_path) + initrd_path =3D self.uncompress(self.ASSET_F35_INITRD, format=3D"x= z") =20 self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE --=20 2.46.0