From nobody Sat Dec 28 10:14:38 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=1734451886; cv=none; d=zohomail.com; s=zohoarc; b=OEroFpaB/CQybufvWDJDFE425IvaXjVZrMrPEvQ5xJpjdWkxdp3gbNTIHYEpJRWKA6cg++VU6XExhs4SY9G5mh692Jkqoe5KBly2r1NSlIac19wcE9qhh0Udp7OpnTgqviHVJEf0msZYhzwMLbFtjfo22trUsPOICpkYImjLuRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734451886; 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=oDjuLanGID/HLMbXE+PjjB6rDvixIxSrfc7QlURc5Xw=; b=ZrNfMKNzRPyYlVh7pGJMYvSG2OqtvSYKRvd2XauaC1St2IemWlcbCTHZ/nn+NYs5IHKN5lXoCTg2Zaq1cNz3/nBx5v9BM8vh7gY6V/u48r5B2QyZGhDiT4yl2XxaQ9fbHspDP5+0e2R+3chXpnltzOcfEOL7y5y5THz9BWijENE= 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 1734451886739304.41064778683915; Tue, 17 Dec 2024 08:11:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNa0h-0005JA-KK; Tue, 17 Dec 2024 11:01: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 1tNa0a-0004sq-Mc for qemu-devel@nongnu.org; Tue, 17 Dec 2024 11:01:17 -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 1tNa0V-0002Cf-K5 for qemu-devel@nongnu.org; Tue, 17 Dec 2024 11:01:16 -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-212-GyYOaeDjMRygv-l1A1p9lQ-1; Tue, 17 Dec 2024 11:01:08 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AA1511956048; Tue, 17 Dec 2024 16:01:07 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.136]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 69BB9300F9B5; Tue, 17 Dec 2024 16:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734451270; 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=oDjuLanGID/HLMbXE+PjjB6rDvixIxSrfc7QlURc5Xw=; b=bCAn6TnpTnP61yYbcA1OMsipBsalfGxWxyQDf9zBaEquHMpHeEJSIvwn09sGybxf7lrBs3 J69K/oWuCZ0svWuHNSBP2rEQul7wHNCdanbW9SA/11u09GxufAvgYL2lwC1O82U7258/uY TvHid8HP+CfuX+LFYjfMsaoL6dMjgXI= X-MC-Unique: GyYOaeDjMRygv-l1A1p9lQ-1 X-Mimecast-MFC-AGG-ID: GyYOaeDjMRygv-l1A1p9lQ From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth Subject: [PATCH v3 23/32] tests/functional: convert tests to new archive_extract helper Date: Tue, 17 Dec 2024 15:59:44 +0000 Message-ID: <20241217155953.3950506-24-berrange@redhat.com> In-Reply-To: <20241217155953.3950506-1-berrange@redhat.com> References: <20241217155953.3950506-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.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 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=-1.116, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1734451889120116600 Replace use of utils.archive_extract and extract_from_deb with the new archive_extract helper. Reviewed-by: Thomas Huth Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/functional/qemu_test/linuxkernel.py | 19 ---------- tests/functional/test_aarch64_aspeed.py | 5 ++- 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_ast1030.py | 16 +++------ tests/functional/test_arm_aspeed_ast2500.py | 6 ++-- tests/functional/test_arm_aspeed_ast2600.py | 5 +-- tests/functional/test_arm_aspeed_rainier.py | 11 +++--- tests/functional/test_arm_bflt.py | 3 +- tests/functional/test_arm_bpim2u.py | 26 +++++++------- tests/functional/test_arm_canona1100.py | 11 +++--- tests/functional/test_arm_cubieboard.py | 20 +++++------ tests/functional/test_arm_orangepi.py | 35 +++++++++---------- tests/functional/test_arm_raspi2.py | 14 ++++---- tests/functional/test_arm_smdkc210.py | 9 +++-- tests/functional/test_arm_vexpress.py | 5 ++- tests/functional/test_m68k_mcf5208evb.py | 5 ++- tests/functional/test_m68k_q800.py | 5 ++- .../functional/test_microblaze_s3adsp1800.py | 5 ++- .../test_microblazeel_s3adsp1800.py | 5 ++- 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 | 5 ++- tests/functional/test_ppc64_e500.py | 5 ++- tests/functional/test_ppc_amiga.py | 6 ++-- tests/functional/test_ppc_bamboo.py | 5 ++- tests/functional/test_ppc_mac.py | 6 ++-- tests/functional/test_ppc_mpc8544ds.py | 8 ++--- tests/functional/test_ppc_virtex_ml507.py | 5 ++- 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 | 5 ++- tests/functional/test_xtensa_lx60.py | 5 ++- 37 files changed, 134 insertions(+), 205 deletions(-) diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/q= emu_test/linuxkernel.py index 8f2810f3af..2c9598102d 100644 --- a/tests/functional/qemu_test/linuxkernel.py +++ b/tests/functional/qemu_test/linuxkernel.py @@ -3,11 +3,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 .testcase import QemuSystemTest from .cmd import wait_for_console_pattern -from .archive import deb_extract =20 =20 class LinuxKernelTest(QemuSystemTest): @@ -29,19 +26,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 - """ - 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 os.path.relpath() as otherwise scratch_file() - # interprets it as an absolute path and drops the required prefix - return os.path.normpath(self.scratch_file(os.path.relpath(path, '/= '))) - diff --git a/tests/functional/test_aarch64_aspeed.py b/tests/functional/tes= t_aarch64_aspeed.py index 8ba2c67248..141d863859 100755 --- a/tests/functional/test_aarch64_aspeed.py +++ b/tests/functional/test_aarch64_aspeed.py @@ -11,7 +11,7 @@ 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 @@ -34,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 2cda03f86f..3918e35e82 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.dtb= ') =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.dtb= ') 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 3b99ecf3a4..20da435687 100755 --- a/tests/functional/test_acpi_bits.py +++ b/tests/functional/test_acpi_bits.py @@ -35,8 +35,6 @@ import re import shutil import subprocess -import tarfile -import zipfile =20 from typing import ( List, @@ -260,19 +258,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_ast1030.py b/tests/functional= /test_arm_aspeed_ast1030.py index 01b13c5591..d45d9f7c1c 100755 --- a/tests/functional/test_arm_aspeed_ast1030.py +++ b/tests/functional/test_arm_aspeed_ast1030.py @@ -8,7 +8,7 @@ =20 from qemu_test import LinuxKernelTest, Asset from qemu_test import exec_command_and_wait_for_pattern -from zipfile import ZipFile + =20 class AST1030Machine(LinuxKernelTest): =20 @@ -20,12 +20,9 @@ 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=3Dkernel_name) =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic') @@ -42,12 +39,9 @@ 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=3Dkernel_name) =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_file, '-nographic') diff --git a/tests/functional/test_arm_aspeed_ast2500.py b/tests/functional= /test_arm_aspeed_ast2500.py index 8c5593cdc8..743fc46eb2 100755 --- a/tests/functional/test_arm_aspeed_ast2500.py +++ b/tests/functional/test_arm_aspeed_ast2500.py @@ -7,7 +7,7 @@ from qemu_test import Asset from aspeed import AspeedTest from qemu_test import exec_command_and_wait_for_pattern -from qemu_test.utils import archive_extract + =20 class AST2500Machine(AspeedTest): =20 @@ -45,9 +45,7 @@ def test_arm_ast2500_evb_buildroot(self): 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")) diff --git a/tests/functional/test_arm_aspeed_ast2600.py b/tests/functional= /test_arm_aspeed_ast2600.py index 25948c1c34..21640123ee 100755 --- a/tests/functional/test_arm_aspeed_ast2600.py +++ b/tests/functional/test_arm_aspeed_ast2600.py @@ -12,7 +12,6 @@ from qemu_test import Asset from aspeed import AspeedTest from qemu_test import exec_command_and_wait_for_pattern, skipIfMissingComm= ands -from qemu_test.utils import archive_extract =20 =20 class AST2600Machine(AspeedTest): @@ -105,9 +104,7 @@ def test_arm_ast2600_evb_buildroot_tpm(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_aspeed_rainier.py b/tests/functional= /test_arm_aspeed_rainier.py index b856aea6db..602d6194ac 100755 --- a/tests/functional/test_arm_aspeed_rainier.py +++ b/tests/functional/test_arm_aspeed_rainier.py @@ -43,11 +43,12 @@ def test_arm_aspeed_emmc_boot(self): def test_arm_debian_kernel_boot(self): self.set_machine('rainier-bmc') =20 - deb_path =3D self.ASSET_DEBIAN_LINUX_ARMHF_DEB.fetch() - - kernel_path =3D self.extract_from_deb(deb_path, '/boot/vmlinuz-5.1= 7.0-2-armmp') - dtb_path =3D self.extract_from_deb(deb_path, - '/usr/lib/linux-image-5.17.0-2-armmp/aspeed-bmc-ibm-rainie= r.dtb') + kernel_path =3D self.archive_extract( + self.ASSET_DEBIAN_LINUX_ARMHF_DEB, + member=3D'boot/vmlinuz-5.17.0-2-armmp') + dtb_path =3D self.archive_extract( + self.ASSET_DEBIAN_LINUX_ARMHF_DEB, + member=3D'usr/lib/linux-image-5.17.0-2-armmp/aspeed-bmc-ibm-ra= inier.dtb') =20 self.vm.set_console() self.vm.add_args('-kernel', kernel_path, diff --git a/tests/functional/test_arm_bflt.py b/tests/functional/test_arm_= bflt.py index 88ef7b1edc..f273fc8354 100755 --- a/tests/functional/test_arm_bflt.py +++ b/tests/functional/test_arm_bflt.py @@ -10,7 +10,6 @@ =20 from qemu_test import QemuUserTest, Asset from qemu_test import skipIfMissingCommands, skipUntrustedTest -from qemu_test.utils import cpio_extract =20 =20 class LoadBFLT(QemuUserTest): @@ -27,7 +26,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 2af6d9a18d..91c56b0930 100755 --- a/tests/functional/test_arm_bpim2u.py +++ b/tests/functional/test_arm_bpim2u.py @@ -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') - dtb_path =3D ('/usr/lib/linux-image-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') - dtb_path =3D ('/usr/lib/linux-image-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') - dtb_path =3D ('/usr/lib/linux-image-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 b4e3633422..21a1a596a0 100755 --- a/tests/functional/test_arm_canona1100.py +++ b/tests/functional/test_arm_canona1100.py @@ -12,7 +12,7 @@ =20 from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern -from qemu_test.utils import archive_extract + =20 class CanonA1100Machine(QemuSystemTest): """Boots the barebox firmware and checks that the console is operation= al""" @@ -26,13 +26,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_cubieboard.py b/tests/functional/tes= t_arm_cubieboard.py index d81c333d0c..32db303253 100755 --- a/tests/functional/test_arm_cubieboard.py +++ b/tests/functional/test_arm_cubieboard.py @@ -38,11 +38,11 @@ class CubieboardMachine(LinuxKernelTest): =20 def test_arm_cubieboard_initrd(self): self.set_machine('cubieboard') - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') - dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun4i-a10-= cubieboard.dtb' - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + 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/' + + 'sun4i-a10-cubieboard.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) @@ -71,11 +71,11 @@ def test_arm_cubieboard_initrd(self): =20 def test_arm_cubieboard_sata(self): self.set_machine('cubieboard') - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') - dtb_path =3D '/usr/lib/linux-image-6.6.16-current-sunxi/sun4i-a10-= cubieboard.dtb' - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + 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/' + + 'sun4i-a10-cubieboard.dtb') + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) =20 rootfs_path_gz =3D self.ASSET_SATA_ROOTFS.fetch() rootfs_path =3D self.scratch_file('rootfs.cpio') diff --git a/tests/functional/test_arm_orangepi.py b/tests/functional/test_= arm_orangepi.py index bea67cfb6a..aa2d9d19a4 100755 --- a/tests/functional/test_arm_orangepi.py +++ b/tests/functional/test_arm_orangepi.py @@ -50,11 +50,11 @@ 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') - 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) + 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-orangepi-pc.dtb') + 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 +71,11 @@ 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') - 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) + 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-orangepi-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) @@ -107,11 +107,11 @@ 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') - 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) + 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-orangepi-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) @@ -189,13 +189,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 'usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl= .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) diff --git a/tests/functional/test_arm_raspi2.py b/tests/functional/test_ar= m_raspi2.py index 075f6b3301..5e38d1a937 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.dtb= ') =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.dtb= ') 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_smdkc210.py b/tests/functional/test_= arm_smdkc210.py index c6c8f9a5f4..f4e86f7e2b 100755 --- a/tests/functional/test_arm_smdkc210.py +++ b/tests/functional/test_arm_smdkc210.py @@ -25,11 +25,10 @@ class Smdkc210Machine(LinuxKernelTest): def test_arm_exynos4210_initrd(self): self.set_machine('smdkc210') =20 - deb_path =3D self.ASSET_DEB.fetch() - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-4.19.0-6-armmp') - dtb_path =3D '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv= 310.dtb' - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + kernel_path =3D self.archive_extract(self.ASSET_DEB, + member=3D'boot/vmlinuz-4.19.0-6= -armmp') + dtb_path =3D 'usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv3= 10.dtb' + dtb_path =3D self.archive_extract(self.ASSET_DEB, member=3Ddtb_pat= h) =20 initrd_path_gz =3D self.ASSET_ROOTFS.fetch() initrd_path =3D self.scratch_file('rootfs.cpio') diff --git a/tests/functional/test_arm_vexpress.py b/tests/functional/test_= arm_vexpress.py index b1ac63ac36..6b11552894 100755 --- a/tests/functional/test_arm_vexpress.py +++ b/tests/functional/test_arm_vexpress.py @@ -6,7 +6,7 @@ # 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 +16,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..c7d1998933 100755 --- a/tests/functional/test_m68k_mcf5208evb.py +++ b/tests/functional/test_m68k_mcf5208evb.py @@ -6,7 +6,7 @@ # 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 +16,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..400b7aeb5d 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 61c4d6bbf8..2c4464bd05 100755 --- a/tests/functional/test_microblaze_s3adsp1800.py +++ b/tests/functional/test_microblaze_s3adsp1800.py @@ -9,7 +9,7 @@ =20 from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern -from qemu_test.utils import archive_extract + =20 class MicroblazeMachine(QemuSystemTest): =20 @@ -22,8 +22,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 926c885f63..c382afe6bf 100755 --- a/tests/functional/test_microblazeel_s3adsp1800.py +++ b/tests/functional/test_microblazeel_s3adsp1800.py @@ -11,7 +11,7 @@ from qemu_test import exec_command, exec_command_and_wait_for_pattern from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern -from qemu_test.utils import archive_extract + =20 class MicroblazeelMachine(QemuSystemTest): =20 @@ -24,8 +24,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 531d16d8f6..35e500b022 100755 --- a/tests/functional/test_mips64el_fuloong2e.py +++ b/tests/functional/test_mips64el_fuloong2e.py @@ -26,9 +26,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 ea362cf335..39fafb8bf1 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..6ab6c0832a 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 77671e0081..1f44881c78 100755 --- a/tests/functional/test_mipsel_malta.py +++ b/tests/functional/test_mipsel_malta.py @@ -13,7 +13,6 @@ from qemu_test import interrupt_interactive_console_until_pattern from qemu_test import wait_for_console_pattern from qemu_test.utils import lzma_uncompress -from zipfile import ZipFile =20 =20 class MaltaMachineConsole(LinuxKernelTest): @@ -73,9 +72,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..f9f0b690a0 100755 --- a/tests/functional/test_or1k_sim.py +++ b/tests/functional/test_or1k_sim.py @@ -6,7 +6,7 @@ # 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 +16,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..b92fe0b0e7 100755 --- a/tests/functional/test_ppc64_e500.py +++ b/tests/functional/test_ppc64_e500.py @@ -5,7 +5,7 @@ # 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 +16,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 9ed23a1f0f..8600e2e963 100755 --- a/tests/functional/test_ppc_amiga.py +++ b/tests/functional/test_ppc_amiga.py @@ -11,7 +11,7 @@ =20 from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern -from zipfile import ZipFile + =20 class AmigaOneMachine(QemuSystemTest): =20 @@ -26,9 +26,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 1ae2f47bcc..fddcc24d0d 100755 --- a/tests/functional/test_ppc_bamboo.py +++ b/tests/functional/test_ppc_bamboo.py @@ -7,11 +7,11 @@ # 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 from qemu_test import wait_for_console_pattern from qemu_test import exec_command_and_wait_for_pattern =20 + class BambooMachine(QemuSystemTest): =20 timeout =3D 90 @@ -25,8 +25,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..9e4bc1a52c 100755 --- a/tests/functional/test_ppc_mac.py +++ b/tests/functional/test_ppc_mac.py @@ -5,7 +5,7 @@ # 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 +19,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 87b5d4d12b..0715410d7a 100755 --- a/tests/functional/test_ppc_mpc8544ds.py +++ b/tests/functional/test_ppc_mpc8544ds.py @@ -7,10 +7,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 -from qemu_test.utils import archive_extract from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern =20 + class Mpc8544dsMachine(QemuSystemTest): =20 timeout =3D 90 @@ -25,10 +25,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 f297651e64..8fe43549b7 100755 --- a/tests/functional/test_ppc_virtex_ml507.py +++ b/tests/functional/test_ppc_virtex_ml507.py @@ -7,10 +7,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 -from qemu_test.utils import archive_extract from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern =20 + class VirtexMl507Machine(QemuSystemTest): =20 timeout =3D 90 @@ -25,8 +25,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 c8954c93eb..473093bbe1 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 from qemu_test import 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', diff --git a/tests/functional/test_sparc64_sun4u.py b/tests/functional/test= _sparc64_sun4u.py index e7f6db0f24..27ac289659 100755 --- a/tests/functional/test_sparc64_sun4u.py +++ b/tests/functional/test_sparc64_sun4u.py @@ -12,7 +12,6 @@ =20 from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern -from qemu_test.utils import archive_extract =20 =20 class Sun4uMachine(QemuSystemTest): @@ -27,11 +26,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..7cd28ebdd1 100755 --- a/tests/functional/test_sparc_sun4m.py +++ b/tests/functional/test_sparc_sun4m.py @@ -6,7 +6,7 @@ # 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 +16,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..147c920899 100755 --- a/tests/functional/test_xtensa_lx60.py +++ b/tests/functional/test_xtensa_lx60.py @@ -6,7 +6,7 @@ # 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 +17,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