From nobody Fri May  9 15:16:40 2025
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=1733938073; cv=none;
	d=zohomail.com; s=zohoarc;
	b=WGPsl3AUaRDUVxFcGUApH2rW78hOIBX+npcGUMm5VJkk2CuHyiPL6mfgPrNZsGUtaBbWrRVFdUYWpPXg3cmB+jcbuQ89Ih8a8VXWrGgay4H7jO2blS8ZL6VoB86eyNeJwIvdwDy+heG/CBRumKLQGZb09DKybdzDurLUjOyRLJI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938073;
 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=YeLFsjFKIqqSOpK0oxt6QByw5VRmUNDd2XoObvpQ1c4=;
	b=DPSzKiiH8TM/qljfPkIfkeJSjjevTw4Y5VOPzKWc6CXDvLjJOVt7eltrAcuIU5Y07J5KxGsdtmubuNq87o/+7u/EoNpymlBItXRmrKpAiRME+e0N5z2chmVqFOj0q4R7HuLo9btSAMdbnCTeX9oWz7d+AayG3B28CZlbpw9EaX4=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938073859658.8324385048347;
 Wed, 11 Dec 2024 09:27:53 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUS-0005Rh-4w; Wed, 11 Dec 2024 12:27:12 -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 <berrange@redhat.com>)
 id 1tLQUL-0005Qp-Vt
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:06 -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 <berrange@redhat.com>)
 id 1tLQUI-00016J-VS
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:05 -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-594-jtiotzwyMDKfUr6g3LOGpw-1; Wed,
 11 Dec 2024 12:26:58 -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 D3C7819560AB; Wed, 11 Dec 2024 17:26:55 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 425FF1956048; Wed, 11 Dec 2024 17:26:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938021;
 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=YeLFsjFKIqqSOpK0oxt6QByw5VRmUNDd2XoObvpQ1c4=;
 b=EJcky9M3rQZV5WCVNSQrQZvmIIcqWLuaMlMlSTmI5DS1Nexd338eVICS9DXJUTZTXmK3uQ
 PEYweDK6Tt/f4LJ+MluMafEtD31FJFZ6i/MLCdAzuye9gIt1T8aPflQnLEnltKZ5AxABxi
 AbLTfmiYFvAw21xPgrEQjnh3p6+C7Ho=
X-MC-Unique: jtiotzwyMDKfUr6g3LOGpw-1
X-Mimecast-MFC-AGG-ID: jtiotzwyMDKfUr6g3LOGpw
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 Thomas Huth <thuth@redhat.com>
Subject: [PATCH v2 01/31] tests/functional: remove many unused imports
Date: Wed, 11 Dec 2024 17:26:17 +0000
Message-ID: <20241211172648.2893097-2-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938075448116600

Identified using 'pylint --disable=3Dall --enable=3DW0611'

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 tests/functional/qemu_test/asset.py              | 1 -
 tests/functional/qemu_test/tesseract.py          | 1 -
 tests/functional/qemu_test/tuxruntest.py         | 3 +--
 tests/functional/test_aarch64_aspeed.py          | 1 -
 tests/functional/test_aarch64_sbsaref_alpine.py  | 1 -
 tests/functional/test_aarch64_sbsaref_freebsd.py | 1 -
 tests/functional/test_acpi_bits.py               | 2 --
 tests/functional/test_arm_aspeed.py              | 1 -
 tests/functional/test_arm_bpim2u.py              | 2 +-
 tests/functional/test_arm_collie.py              | 2 +-
 tests/functional/test_arm_cubieboard.py          | 1 -
 tests/functional/test_arm_orangepi.py            | 2 +-
 tests/functional/test_arm_smdkc210.py            | 3 +--
 tests/functional/test_arm_sx1.py                 | 2 +-
 tests/functional/test_microblaze_s3adsp1800.py   | 1 -
 tests/functional/test_ppc_amiga.py               | 2 +-
 tests/functional/test_virtio_gpu.py              | 1 -
 tests/lcitool/libvirt-ci                         | 2 +-
 18 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_te=
st/asset.py
index f126cd5863..559af0351f 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -9,7 +9,6 @@
 import logging
 import os
 import stat
-import subprocess
 import sys
 import unittest
 import urllib.request
diff --git a/tests/functional/qemu_test/tesseract.py b/tests/functional/qem=
u_test/tesseract.py
index db441027b9..ef1833139d 100644
--- a/tests/functional/qemu_test/tesseract.py
+++ b/tests/functional/qemu_test/tesseract.py
@@ -5,7 +5,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 re
 import logging
=20
 from . import has_cmd, run_cmd
diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qe=
mu_test/tuxruntest.py
index ab3b27da43..d375f2713b 100644
--- a/tests/functional/qemu_test/tuxruntest.py
+++ b/tests/functional/qemu_test/tuxruntest.py
@@ -11,10 +11,9 @@
=20
 import os
 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 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
=20
diff --git a/tests/functional/test_aarch64_aspeed.py b/tests/functional/tes=
t_aarch64_aspeed.py
index 59916efd71..e196f88537 100644
--- a/tests/functional/test_aarch64_aspeed.py
+++ b/tests/functional/test_aarch64_aspeed.py
@@ -6,7 +6,6 @@
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
-import sys
 import os
=20
 from qemu_test import QemuSystemTest, Asset
diff --git a/tests/functional/test_aarch64_sbsaref_alpine.py b/tests/functi=
onal/test_aarch64_sbsaref_alpine.py
index ebc29b2fb5..6dbc90f30e 100755
--- a/tests/functional/test_aarch64_sbsaref_alpine.py
+++ b/tests/functional/test_aarch64_sbsaref_alpine.py
@@ -12,7 +12,6 @@
=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 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..77ba2ba1da 100755
--- a/tests/functional/test_aarch64_sbsaref_freebsd.py
+++ b/tests/functional/test_aarch64_sbsaref_freebsd.py
@@ -12,7 +12,6 @@
=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 unittest import skipUnless
 from test_aarch64_sbsaref import fetch_firmware
=20
diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp=
i_bits.py
index 63e2c5309d..3df9562394 100755
--- a/tests/functional/test_acpi_bits.py
+++ b/tests/functional/test_acpi_bits.py
@@ -31,14 +31,12 @@
 https://gitlab.com/qemu-project/biosbits-bits .
 """
=20
-import logging
 import os
 import platform
 import re
 import shutil
 import subprocess
 import tarfile
-import tempfile
 import zipfile
=20
 from pathlib import Path
diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar=
m_aspeed.py
index d88170ac24..314201a439 100755
--- a/tests/functional/test_arm_aspeed.py
+++ b/tests/functional/test_arm_aspeed.py
@@ -13,7 +13,6 @@
=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.utils import archive_extract
 from zipfile import ZipFile
diff --git a/tests/functional/test_arm_bpim2u.py b/tests/functional/test_ar=
m_bpim2u.py
index 35ea58d46c..c9cf43c147 100755
--- a/tests/functional/test_arm_bpim2u.py
+++ b/tests/functional/test_arm_bpim2u.py
@@ -9,7 +9,7 @@
=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 gzip_uncompress, lzma_uncompress
 from qemu_test.utils import image_pow2ceil_expand
 from unittest import skipUnless
=20
diff --git a/tests/functional/test_arm_collie.py b/tests/functional/test_ar=
m_collie.py
index 7e144a0a8f..fe1be3d079 100755
--- a/tests/functional/test_arm_collie.py
+++ b/tests/functional/test_arm_collie.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 CollieTest(LinuxKernelTest):
=20
diff --git a/tests/functional/test_arm_cubieboard.py b/tests/functional/tes=
t_arm_cubieboard.py
index 2b33a1b50b..9e42b72060 100755
--- a/tests/functional/test_arm_cubieboard.py
+++ b/tests/functional/test_arm_cubieboard.py
@@ -5,7 +5,6 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
 import os
-import shutil
=20
 from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pa=
ttern
 from qemu_test import interrupt_interactive_console_until_pattern
diff --git a/tests/functional/test_arm_orangepi.py b/tests/functional/test_=
arm_orangepi.py
index 6d57223a03..a872305e93 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
 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 gzip_uncompress, lzma_uncompress
 from qemu_test.utils import image_pow2ceil_expand
 from unittest import skipUnless
=20
diff --git a/tests/functional/test_arm_smdkc210.py b/tests/functional/test_=
arm_smdkc210.py
index 967752feeb..b3b39b069d 100755
--- a/tests/functional/test_arm_smdkc210.py
+++ b/tests/functional/test_arm_smdkc210.py
@@ -5,9 +5,8 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
 import os
-import shutil
=20
-from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pa=
ttern
+from qemu_test import LinuxKernelTest, Asset
 from qemu_test.utils import gzip_uncompress
=20
 class Smdkc210Machine(LinuxKernelTest):
diff --git a/tests/functional/test_arm_sx1.py b/tests/functional/test_arm_s=
x1.py
index 2292317946..b85bfaa178 100755
--- a/tests/functional/test_arm_sx1.py
+++ b/tests/functional/test_arm_sx1.py
@@ -14,7 +14,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 SX1Test(LinuxKernelTest):
=20
diff --git a/tests/functional/test_microblaze_s3adsp1800.py b/tests/functio=
nal/test_microblaze_s3adsp1800.py
index d2be3105a2..d452a0271c 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
-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
diff --git a/tests/functional/test_ppc_amiga.py b/tests/functional/test_ppc=
_amiga.py
index b793b5c432..f5faa0f0b3 100755
--- a/tests/functional/test_ppc_amiga.py
+++ b/tests/functional/test_ppc_amiga.py
@@ -10,7 +10,7 @@
 import subprocess
=20
 from qemu_test import QemuSystemTest, Asset
-from qemu_test import wait_for_console_pattern, run_cmd
+from qemu_test import wait_for_console_pattern
 from zipfile import ZipFile
=20
 class AmigaOneMachine(QemuSystemTest):
diff --git a/tests/functional/test_virtio_gpu.py b/tests/functional/test_vi=
rtio_gpu.py
index d5027487ac..2d298b1f02 100755
--- a/tests/functional/test_virtio_gpu.py
+++ b/tests/functional/test_virtio_gpu.py
@@ -12,7 +12,6 @@
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test import is_readable_executable_file
=20
-from qemu.utils import kvm_available
=20
 import os
 import socket
diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
index 9ad3f70bde..0f11966131 160000
--- a/tests/lcitool/libvirt-ci
+++ b/tests/lcitool/libvirt-ci
@@ -1 +1 @@
-Subproject commit 9ad3f70bde9865d5ad18f36d256d472e72b5cbf3
+Subproject commit 0f119661317333038e91b6fb9d0381a6934dcd0c
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938435; cv=none;
	d=zohomail.com; s=zohoarc;
	b=nPF+6jfjsl2ue3agjzCVEsY4BgcZPG3Gv8dj316txXWT4+YhvcLJVPmkD7aWnBr2b551X9rT/Z/ypkeTC/QOhGKwEZhAjEKBu7y+oYg94rpoI2U0Xx5g/I0nOTKxMUH8sxhRzEeR3k9+z6/YURFcHJoZFCVKHZTMJMSyfUj0u5I=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938435;
 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=7k+tEYKrr5XUuCj4cGmAGM2/Boaa8pNKMmysiZtXWvs=;
	b=EM5j+1qIjUI0RIIQcRAOloQPr06hJZbDEBCxAqni1LUY3uSByrZ+3/Hkb5mxXD2t5+BEn5s3uryFcYJ8lb8JASVruU4dQCy6Vx+1ue8/UkiWgt/hPfouPU55j0Mpgwikpbay7aYtZp3qQZtW8AFP0CwooQ14xN9jrsMwEVOvh0Q=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938435546891.3419098069003;
 Wed, 11 Dec 2024 09:33:55 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUW-0005TO-1o; Wed, 11 Dec 2024 12:27:16 -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 <berrange@redhat.com>)
 id 1tLQUM-0005Qu-MZ
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:06 -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 <berrange@redhat.com>)
 id 1tLQUK-00016P-P6
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:05 -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-607-0x1SKyuHO3Go-Mk4MbPj0A-1; Wed,
 11 Dec 2024 12:27:00 -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 05C7819560A7; Wed, 11 Dec 2024 17:26:59 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 6F4601956052; Wed, 11 Dec 2024 17:26:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938023;
 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=7k+tEYKrr5XUuCj4cGmAGM2/Boaa8pNKMmysiZtXWvs=;
 b=T0Kv9nWqWRF0VHeNRUkfqGRRxX0Z6JBswT1guOdLm6szzUwpRPHMcVThLMklSoph134l2z
 gJWKE6UOm4u5G736HRK0vnUZyXSjbwFYYjQRoS8ah4jdyth9haNDchkrI9pDj6SaK56S8b
 Dxr1PCOPKHfdviDFT52/LlakgXEZNqw=
X-MC-Unique: 0x1SKyuHO3Go-Mk4MbPj0A-1
X-Mimecast-MFC-AGG-ID: 0x1SKyuHO3Go-Mk4MbPj0A
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 02/31] tests/functional: resolve str(Asset) to cache file
 path
Date: Wed, 11 Dec 2024 17:26:18 +0000
Message-ID: <20241211172648.2893097-3-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938436588116600

Allow an Asset object to be used in place of a filename but
making its string representation resolve to the cache file
path.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 tests/functional/qemu_test/asset.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_te=
st/asset.py
index 559af0351f..c5d3e73c4b 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -39,6 +39,9 @@ def __repr__(self):
         return "Asset: url=3D%s hash=3D%s cache=3D%s" % (
             self.url, self.hash, self.cache_file)
=20
+    def __str__(self):
+        return str(self.cache_file)
+
     def _check(self, cache_file):
         if self.hash is None:
             return True
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938074; cv=none;
	d=zohomail.com; s=zohoarc;
	b=M2keAc5L0+qXkRjhAL0MOMk0t7xNoGK9/hA4bt8hMHA7yOA7D9unZyL/s+T0/bi9+B0f0xsl2k+sHLWVYqKwPoGDI5zQ7ydng91dqqqiy538d5bqcJ7BS4jiSAW/vliI8/JeZzkWy92DUdMqr5Fy1ePhSJwZcKu8lbENQr7AkSI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938074;
 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=fhKdokIULRGPGWSO9LdGxnmdKKDtG0WAE0bknPnTpHU=;
	b=ZLKFduVqYVCUd10ibGpxbZZ5kqL0BgbjXANcExfpNuNcQgpo/fxxUEoeYLHrt7bF4udaHkUO/+/u4816k5D8HcLeaB4EOJxR4hvkbqe/TR5t8oVZadylfWnGEZuGDj/hhiU2t3JUYcpx77PIr1fNIiot9Mzr/XTreiUfXujyLbw=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938074939329.7088384659585;
 Wed, 11 Dec 2024 09:27:54 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUX-0005U7-5G; Wed, 11 Dec 2024 12:27:17 -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 <berrange@redhat.com>)
 id 1tLQUS-0005Se-Fg
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:13 -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 <berrange@redhat.com>)
 id 1tLQUQ-00016x-Qg
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:12 -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-183-HCZBjY5rM-GuxLm6_rf1aQ-1; Wed,
 11 Dec 2024 12:27: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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 0E94319560A2; Wed, 11 Dec 2024 17:27:03 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id AD6851956048; Wed, 11 Dec 2024 17:26:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938030;
 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=fhKdokIULRGPGWSO9LdGxnmdKKDtG0WAE0bknPnTpHU=;
 b=JyK3IMsAP7SWi+2x2cE90FXH1MayRWC3qsbESkd+Ur6LiUzyUgXb+wEhJ0EQIXSg36kkGj
 56MWUi5WAt30otvdLP6HdOll08H8hDmP8Ej8zMGCOB2t9pzEA81KEPfbyjlXlkB4mI/Moo
 6VdEPEC+TYB4jrTDlTFpfTUiZRPQjnM=
X-MC-Unique: HCZBjY5rM-GuxLm6_rf1aQ-1
X-Mimecast-MFC-AGG-ID: HCZBjY5rM-GuxLm6_rf1aQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 Richard Henderson <richard.henderson@linaro.org>
Subject: [PATCH v2 03/31] tests/functional: remove duplicated 'which' function
 impl
Date: Wed, 11 Dec 2024 17:26:19 +0000
Message-ID: <20241211172648.2893097-4-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938076869116600

Put the 'which' function into shared code.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 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 3df9562394..1e6d082ecb 100755
--- a/tests/functional/test_acpi_bits.py
+++ b/tests/functional/test_acpi_bits.py
@@ -47,7 +47,7 @@
 )
 from qemu.machine import QEMUMachine
 from unittest import skipIf
-from qemu_test import QemuSystemTest, Asset
+from qemu_test import QemuSystemTest, Asset, which
=20
 deps =3D ["xorriso", "mformat"] # dependent tools needed in the test setup=
/box.
 supported_platforms =3D ['x86_64'] # supported test platforms.
@@ -55,17 +55,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 d97b62e364..7c6f8234f5 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
-from qemu_test import wait_for_console_pattern, exec_command
+from qemu_test import wait_for_console_pattern, 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 Fri May  9 15:16:40 2025
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=1733938237; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Uc4qskDF0ZIxgGt/Q7QzsrhTS+2t+0SLWtdAqUGaRsFR49fcRQclR1aJ40pkkpik/1sgqtH5BJnJs6iyvdTpcyoriuyexPrziHVN5/U7PjrK2xXCerDyNYIAeQF+ei5ZC5aKnBOZt5dj/0INeg2glkQtT99dKMaEF6gP/xyVSBY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938237;
 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=h9sJerS4yEPVJlavB03DPbVJGkb2MibXLdV/QCH/ooo=;
	b=EPS5n2hdLiLppNWcJ9FrHOL/AjrrUFbDhRNO2mQDagXz64zoAxKab9zjy7VVSB8azcsgN0CgVqqyuFMUrl8vcs3cLtgllf/7ZsLZZUfdndS96wNMJzRf9R46eW63NRQ4PRGtJBYkSgRNOb2/s8XclOYpxwNHrOwLM2U4WvXz2AY=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938237818391.04257210075946;
 Wed, 11 Dec 2024 09:30:37 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUW-0005Tw-KC; Wed, 11 Dec 2024 12:27:16 -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 <berrange@redhat.com>)
 id 1tLQUS-0005Sf-HQ
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:13 -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 <berrange@redhat.com>)
 id 1tLQUR-000173-7c
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:12 -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-35-_UpaONPPOuujFTSVrFw32g-1; Wed,
 11 Dec 2024 12:27: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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 1904019560B3; Wed, 11 Dec 2024 17:27:06 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id BB3FB1956048; Wed, 11 Dec 2024 17:27:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938030;
 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=h9sJerS4yEPVJlavB03DPbVJGkb2MibXLdV/QCH/ooo=;
 b=I2gUtBHzH/0/MkoHveUv78OJ9QglXlUhKgsmlOVyLv7vo1flgzVfhPiHRId0u7mkHBAME6
 gBc5vfUJ/cDUPj+JDgHb3flZI9wiuMPJQ/YGCSLrjbeXbaUn3Pjh4q4YgOeMAdKSZSQhbN
 cIG/c+aYf2WROQFzYfTKUXs60PTT8bA=
X-MC-Unique: _UpaONPPOuujFTSVrFw32g-1
X-Mimecast-MFC-AGG-ID: _UpaONPPOuujFTSVrFw32g
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 04/31] tests/functional: simplify 'which' implementation
Date: Wed, 11 Dec 2024 17:26:20 +0000
Message-ID: <20241211172648.2893097-5-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938239518116600

The 'access' check implies the file exists.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/cmd.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test=
/cmd.py
index 4106f1ee7c..600e0509db 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -25,7 +25,7 @@ def which(tool):
     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):
+        if os.access(p, os.X_OK):
             return p
     return None
=20
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938433; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Pb1rhLTFpnxi1JAyFhet3jJzGXMXgaFPUip3yTz2Bq2TmaVCtqJYd0yiDiq00VLtKjMBOhNA9ge7bLh5zMopKx+g/3aAoaphtEjkS77lopgoZjHOz5FtqNNHxWEe5pgDUoEp9bN3ANrFUdL4XKWoV0+heyl084nutC4LZv12xIQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938433;
 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=GesaMaCP8A+jV60eyf8gMVapN+rZ39KUbB/WS/tA1R8=;
	b=fIlQIZ5NAv0WiPgkEAk9RuMCLtDF6SH16egl0NtwT3X7xMQQqxdISDt8RREKlsaakjPruqys+8bqqkjZ8808yQZxF6AM1sokaRh8rc2uI67DTEvzMwbOs+xZCPWl/E1XhOF3B+BCombCeuKdXYgI1iyOjlDorGfHRIx5wRmJqds=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938433195131.42182294174404;
 Wed, 11 Dec 2024 09:33:53 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUa-0005Vp-9i; Wed, 11 Dec 2024 12:27:20 -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 <berrange@redhat.com>)
 id 1tLQUW-0005Tu-F7
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:16 -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 <berrange@redhat.com>)
 id 1tLQUV-00017L-1c
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27: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-452-kN4bHllcP1a72Kh2lvoSIQ-1; Wed,
 11 Dec 2024 12:27:10 -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 12C8F1955EB1; Wed, 11 Dec 2024 17:27:09 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 1E53A1956048; Wed, 11 Dec 2024 17:27:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938034;
 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=GesaMaCP8A+jV60eyf8gMVapN+rZ39KUbB/WS/tA1R8=;
 b=FBmAY+tNlirkJcS+UKQkZ3Y31d+/BpjNY0ODktlsNLOD6Wi7mXmN01jAfWZHvwUL5LSO1f
 DsvXQEjtY1iYJBVNEBkkTzk0P3BjHpJoKKllS0CYtPdvEaQBFpYyuylJfZ3QhaZPNA2DfA
 sA6eawfOU9Smd4oQrkYLz92FPDbeVp4=
X-MC-Unique: kN4bHllcP1a72Kh2lvoSIQ-1
X-Mimecast-MFC-AGG-ID: kN4bHllcP1a72Kh2lvoSIQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 05/31] tests/functional: drop 'tesseract_available' helper
Date: Wed, 11 Dec 2024 17:26:21 +0000
Message-ID: <20241211172648.2893097-6-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938434656116600

Platforms we target have new enough tesseract that it suffices to merely
check if the binary exists.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 tests/functional/qemu_test/tesseract.py | 12 +-----------
 tests/functional/test_m68k_nextcube.py  |  8 +++-----
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/tests/functional/qemu_test/tesseract.py b/tests/functional/qem=
u_test/tesseract.py
index ef1833139d..1b7818090a 100644
--- a/tests/functional/qemu_test/tesseract.py
+++ b/tests/functional/qemu_test/tesseract.py
@@ -7,17 +7,7 @@
=20
 import logging
=20
-from . import has_cmd, run_cmd
-
-def tesseract_available(expected_version):
-    (has_tesseract, _) =3D has_cmd('tesseract')
-    if not has_tesseract:
-        return False
-    (stdout, stderr, ret) =3D run_cmd([ 'tesseract', '--version'])
-    if ret:
-        return False
-    version =3D stdout.split()[1]
-    return int(version.split('.')[0]) >=3D expected_version
+from . import run_cmd
=20
 def tesseract_ocr(image_path, tesseract_args=3D''):
     console_logger =3D logging.getLogger('console')
diff --git a/tests/functional/test_m68k_nextcube.py b/tests/functional/test=
_m68k_nextcube.py
index 0124622c40..1022e8f468 100755
--- a/tests/functional/test_m68k_nextcube.py
+++ b/tests/functional/test_m68k_nextcube.py
@@ -13,7 +13,8 @@
 from qemu_test import QemuSystemTest, Asset
 from unittest import skipUnless
=20
-from qemu_test.tesseract import tesseract_available, tesseract_ocr
+from qemu_test import has_cmd
+from qemu_test.tesseract import tesseract_ocr
=20
 PIL_AVAILABLE =3D True
 try:
@@ -53,10 +54,7 @@ def test_bootrom_framebuffer_size(self):
         self.assertEqual(width, 1120)
         self.assertEqual(height, 832)
=20
-    # Tesseract 4 adds a new OCR engine based on LSTM neural networks. The
-    # new version is faster and more accurate than version 3. The drawback=
 is
-    # that it is still alpha-level software.
-    @skipUnless(tesseract_available(4), 'tesseract OCR tool not available')
+    @skipUnless(*has_cmd('tesseract') '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")
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938433; cv=none;
	d=zohomail.com; s=zohoarc;
	b=LYHRP3bxssZR2wT1GihRSrKnFCNbusTsX5pc1sN6ToarNv+NXc12dNcOlxJOz5QDBAWNRxvAOWcq+M/pEGJCV1RPb23b4Zomx9IMhqjdFJL9dO0CloyyaPXa3DgukVSzRPTNRATgmPvZTdlRhvMw1igwAlB1IKFNNOH8hmmVpwo=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938433;
 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=Vcs7YN/ny+zXz1tEXtE2SbkhC4Dub0dHTq8pTuAyxSA=;
	b=cpQ4lohf6CX5zk8zhq0UyYkwqPnU8Gv2ayZKcKDk1ddO97mjyRFdOAkD4droSKa15lF02No84k80ysKKLFMqdJ2a6TTtM5Ios7ofo05rwQDwOnUFBhPofZTazHj7g6gFyi88VCtEcUfKZJq2/d7sLURitqUYJyc67hgQ4DChnYs=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938433111774.4419350886218;
 Wed, 11 Dec 2024 09:33:53 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUc-0005WP-5H; Wed, 11 Dec 2024 12:27:22 -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 <berrange@redhat.com>)
 id 1tLQUb-0005W2-3O
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:21 -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 <berrange@redhat.com>)
 id 1tLQUZ-00017W-B2
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:20 -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-60-MHudrd8INoqmmEnsZK3yYw-1; Wed,
 11 Dec 2024 12:27: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 23864195606F; Wed, 11 Dec 2024 17:27:12 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id DCAF01956048; Wed, 11 Dec 2024 17:27:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938038;
 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=Vcs7YN/ny+zXz1tEXtE2SbkhC4Dub0dHTq8pTuAyxSA=;
 b=AVPD0oY0v1P5ZKOw+QbZ2tiyeKiHcXgQ+a3dDEwzcabrnSlWSK9eSBypAVW0nkXT1IQFRZ
 rXUDlAORx42CzBLDlnc1U85ch4O/W4CQmo9ThY1CA2yv+c3ZyOhWnYMk8zfi1SrhukmRP5
 v8pEDyXDRZoiTeWalo6KfMIvWk6Wicc=
X-MC-Unique: MHudrd8INoqmmEnsZK3yYw-1
X-Mimecast-MFC-AGG-ID: MHudrd8INoqmmEnsZK3yYw
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 06/31] tests/functional: introduce some helpful decorators
Date: Wed, 11 Dec 2024 17:26:22 +0000
Message-ID: <20241211172648.2893097-7-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938434721116600

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 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/__init__.py   |   3 +
 tests/functional/qemu_test/decorators.py | 107 +++++++++++++++++++++++
 2 files changed, 110 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..df088bc090
--- /dev/null
+++ b/tests/functional/qemu_test/decorators.py
@@ -0,0 +1,107 @@
+# 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 command(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 one of the required machine(s) "%s=
"' %
+                        ", ".join(args))
+
+'''
+Decorator to skip execution of flaky tests, unless
+the $QEMU_TEST_FLAKY_TESTS environment variable 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, unless 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 (over around 500MB-1GB mark) on the host,
+unless the $QEMU_TEST_ALLOW_LARGE_STORAGE environment
+variable is set
+
+Example:
+
+  @skipBigDataTest()
+'''
+def skipBigDataTest():
+    return skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'),
+                      'Test requires 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 import(s) "%s" not installed' %
+                      ", ".join(args))
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938095; cv=none;
	d=zohomail.com; s=zohoarc;
	b=mlCRUHWV1Fup/OP1ceu+OSUHmUrrUc4WVSF0VngL4wMuVOC8Apsp2HLxaHcZklR6hUJkr7674wE/3c9gm50QFsDA+lHocxSCjuxJhLAB/z9LFWOvlv3lyf1H5ULmJ7nx2id6nA/6vMcbNL0gudQw6jC2WIrFN50fHDhbQx7V5s0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938095;
 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=bdZMCyNNEj650P6pcGZDAfdsg+eyd2iCp4ettwWAcjE=;
	b=PJmNoHT+U/7lv3W61n2IFQ+uSIK+neHrapaZrLZtwI5c/0QHTDGgx3FKPhqVko6nugq82EjXDiprNNuBmIpS+yeaRl7/OOqIdJY1XgsPIenftVlWiLf0gKXjVKn2AkLj8mCNMffrbPd6cl45owgb/M8Z0rS5eV+kvQ23hhCOOqQ=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938095358382.16478955105026;
 Wed, 11 Dec 2024 09:28:15 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUe-0005Ww-Q8; Wed, 11 Dec 2024 12:27:24 -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 <berrange@redhat.com>)
 id 1tLQUd-0005Wl-TZ
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:23 -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 <berrange@redhat.com>)
 id 1tLQUb-00017b-7V
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:23 -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-516-5FUMXOBXNLWneUrcwkW_ZQ-1; Wed,
 11 Dec 2024 12:27: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 5F72A195FCD3; Wed, 11 Dec 2024 17:27:15 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id A632D1955EA3; Wed, 11 Dec 2024 17:27:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938040;
 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=bdZMCyNNEj650P6pcGZDAfdsg+eyd2iCp4ettwWAcjE=;
 b=VSMSK95bEtyJMeoGplHG4rkCBTiVgq3m/p0dl1El4ss1ByQA4Sa8KMYpaNY9LxOygBgI1g
 JY9GaRxFdeTEOnE+YGqYeDJekkThwO3WkR2uMxQGJSLUqZR9jf5pO3pPhNJRu6zR/nfoxZ
 +0nmkz6rqklUpPE5SYjb02SfnFAoH70=
X-MC-Unique: 5FUMXOBXNLWneUrcwkW_ZQ-1
X-Mimecast-MFC-AGG-ID: 5FUMXOBXNLWneUrcwkW_ZQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 Thomas Huth <thuth@redhat.com>
Subject: [PATCH v2 07/31] tests/functional: switch to new test skip decorators
Date: Wed, 11 Dec 2024 17:26:23 +0000
Message-ID: <20241211172648.2893097-8-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938097240116600

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.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 tests/functional/test_acpi_bits.py           | 25 +++--------------
 tests/functional/test_arm_aspeed.py          |  6 ++---
 tests/functional/test_arm_bflt.py            |  7 +++--
 tests/functional/test_arm_bpim2u.py          |  5 ++--
 tests/functional/test_arm_cubieboard.py      |  5 ++--
 tests/functional/test_arm_integratorcp.py    | 25 +++++------------
 tests/functional/test_arm_orangepi.py        |  8 +++---
 tests/functional/test_linux_initrd.py        |  7 +++--
 tests/functional/test_m68k_nextcube.py       | 15 +++--------
 tests/functional/test_mips64el_fuloong2e.py  |  4 +--
 tests/functional/test_mips64el_loongson3v.py |  8 +++---
 tests/functional/test_mips64el_malta.py      | 28 +++++++-------------
 tests/functional/test_ppc64_hv.py            | 18 +++----------
 tests/functional/test_ppc_40p.py             |  7 ++---
 tests/functional/test_rx_gdbsim.py           |  5 ++--
 tests/functional/test_sh4_r2d.py             |  8 +++---
 16 files changed, 61 insertions(+), 120 deletions(-)

diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acp=
i_bits.py
index 1e6d082ecb..8763ea0822 100755
--- a/tests/functional/test_acpi_bits.py
+++ b/tests/functional/test_acpi_bits.py
@@ -32,7 +32,6 @@
 """
=20
 import os
-import platform
 import re
 import shutil
 import subprocess
@@ -46,28 +45,13 @@
     Sequence,
 )
 from qemu.machine import QEMUMachine
-from unittest import skipIf
-from qemu_test import QemuSystemTest, Asset, which
+from qemu_test import (QemuSystemTest, 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
@@ -110,9 +94,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(QemuSystemTest): #pylint: disable=3Dtoo-many-instance-a=
ttributes
     """
     ACPI and SMBIOS tests using biosbits.
diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar=
m_aspeed.py
index 314201a439..dc4d067eb6 100755
--- a/tests/functional/test_arm_aspeed.py
+++ b/tests/functional/test_arm_aspeed.py
@@ -13,10 +13,10 @@
=20
 from qemu_test import LinuxKernelTest, Asset
 from qemu_test import exec_command_and_wait_for_pattern
-from qemu_test import has_cmd
+from qemu_test import skipIfMissingCommands
 from qemu_test.utils import archive_extract
 from zipfile import ZipFile
-from unittest import skipUnless
+
=20
 class AST1030Machine(LinuxKernelTest):
=20
@@ -218,7 +218,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 281925d11a..9095b08539 100755
--- a/tests/functional/test_arm_bflt.py
+++ b/tests/functional/test_arm_bflt.py
@@ -10,9 +10,8 @@
 import bz2
=20
 from qemu_test import QemuUserTest, Asset
-from qemu_test import has_cmd
+from qemu_test import skipIfMissingCommands, skipUntrustedTest
 from qemu_test.utils import cpio_extract
-from unittest import skipUnless
=20
=20
 class LoadBFLT(QemuUserTest):
@@ -21,8 +20,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 c9cf43c147..fcd111f59d 100755
--- a/tests/functional/test_arm_bpim2u.py
+++ b/tests/functional/test_arm_bpim2u.py
@@ -9,9 +9,10 @@
=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 skipBigDataTest
 from qemu_test.utils import gzip_uncompress, lzma_uncompress
 from qemu_test.utils import 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_cubieboard.py b/tests/functional/tes=
t_arm_cubieboard.py
index 9e42b72060..fdbd52a33c 100755
--- a/tests/functional/test_arm_cubieboard.py
+++ b/tests/functional/test_arm_cubieboard.py
@@ -8,8 +8,9 @@
=20
 from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pa=
ttern
 from qemu_test import interrupt_interactive_console_until_pattern
+from qemu_test import skipBigDataTest
 from qemu_test.utils import gzip_uncompress, image_pow2ceil_expand
-from unittest import skipUnless
+
=20
 class CubieboardMachine(LinuxKernelTest):
=20
@@ -105,7 +106,7 @@ def test_arm_cubieboard_sata(self):
         # Wait for VM to shut down gracefully
         self.vm.wait()
=20
-    @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited=
')
+    @skipBigDataTest()
     def test_arm_cubieboard_openwrt_22_03_2(self):
         # This test download a 7.5 MiB compressed image and expand it
         # to 126 MiB.
diff --git a/tests/functional/test_arm_integratorcp.py b/tests/functional/t=
est_arm_integratorcp.py
index 0fe083f661..54fa366ad4 100755
--- a/tests/functional/test_arm_integratorcp.py
+++ b/tests/functional/test_arm_integratorcp.py
@@ -17,20 +17,7 @@
=20
 from qemu_test import QemuSystemTest, Asset
 from qemu_test import 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 skipIfMissingImports, skipUntrustedTest
=20
=20
 class IntegratorMachine(QemuSystemTest):
@@ -63,7 +50,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
@@ -71,13 +58,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 a872305e93..b113adfe61 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
 from qemu_test import Asset, interrupt_interactive_console_until_pattern
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, skipBigDataTest
 from qemu_test.utils import gzip_uncompress, lzma_uncompress
 from qemu_test.utils import 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 <orangepipc>')
         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 1022e8f468..25a17d4794 100755
--- a/tests/functional/test_m68k_nextcube.py
+++ b/tests/functional/test_m68k_nextcube.py
@@ -11,17 +11,9 @@
 import time
=20
 from qemu_test import QemuSystemTest, Asset
-from unittest import skipUnless
-
-from qemu_test import has_cmd
+from qemu_test import skipIfMissingImports, skipIfMissingCommands
 from qemu_test.tesseract import tesseract_ocr
=20
-PIL_AVAILABLE =3D True
-try:
-    from PIL import Image
-except ImportError:
-    PIL_AVAILABLE =3D False
-
=20
 class NextCubeMachine(QemuSystemTest):
=20
@@ -44,17 +36,18 @@ 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)
=20
-    @skipUnless(*has_cmd('tesseract') 'tesseract OCR tool not available')
+    @skipIfMissingCommands('tesseract')
     def test_bootrom_framebuffer_ocr_with_tesseract(self):
         self.set_machine('next-cube')
         screenshot_path =3D os.path.join(self.workdir, "dump.ppm")
diff --git a/tests/functional/test_mips64el_fuloong2e.py b/tests/functional=
/test_mips64el_fuloong2e.py
index a32d5f9d08..531d16d8f6 100755
--- a/tests/functional/test_mips64el_fuloong2e.py
+++ b/tests/functional/test_mips64el_fuloong2e.py
@@ -13,7 +13,7 @@
 import subprocess
=20
 from qemu_test import LinuxKernelTest, Asset
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, skipUntrustedTest
 from unittest import skipUnless
=20
 class MipsFuloong2e(LinuxKernelTest):
@@ -39,7 +39,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..f85371e50c 100755
--- a/tests/functional/test_mips64el_loongson3v.py
+++ b/tests/functional/test_mips64el_loongson3v.py
@@ -9,11 +9,9 @@
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
-import os
-
-from unittest import skipUnless
 from qemu_test import QemuSystemTest, Asset
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, skipUntrustedTest
+
=20
 class MipsLoongson3v(QemuSystemTest):
     timeout =3D 60
@@ -23,7 +21,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 6d1195d362..52283e2dbd 100755
--- a/tests/functional/test_mips64el_malta.py
+++ b/tests/functional/test_mips64el_malta.py
@@ -14,20 +14,8 @@
=20
 from qemu_test import LinuxKernelTest, Asset
 from qemu_test import exec_command_and_wait_for_pattern
+from qemu_test import skipIfMissingImports, skipFlakyTest, skipUntrustedTe=
st
 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 7c6f8234f5..88f0f99f24 100755
--- a/tests/functional/test_ppc64_hv.py
+++ b/tests/functional/test_ppc64_hv.py
@@ -9,24 +9,14 @@
 # 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
-from qemu_test import wait_for_console_pattern, exec_command, which
+from qemu_test import wait_for_console_pattern, exec_command
+from qemu_test import skipIfMissingCommands, skipBigDataTest
 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 +24,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 67bcdae53a..7a74e0cca7 100755
--- a/tests/functional/test_ppc_40p.py
+++ b/tests/functional/test_ppc_40p.py
@@ -7,11 +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
-from qemu_test import wait_for_console_pattern
+from qemu_test import wait_for_console_pattern, skipUntrustedTest
=20
=20
 class IbmPrep40pMachine(QemuSystemTest):
@@ -37,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 5687f756bb..02d35f5234 100755
--- a/tests/functional/test_rx_gdbsim.py
+++ b/tests/functional/test_rx_gdbsim.py
@@ -15,7 +15,7 @@
 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 wait_for_console_pattern, skipFlakyTest
 from qemu_test.utils import gzip_uncompress
=20
=20
@@ -52,9 +52,10 @@ def test_uboot(self):
         wait_for_console_pattern(self, uboot_version)
         gcc_version =3D 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experi=
mental)'
         # FIXME limit baudrate on chardev, else we type too fast
+        #  https://gitlab.com/qemu-project/qemu/-/issues/2691
         #exec_command_and_wait_for_pattern(self, 'version', gcc_version)
=20
-    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G=
itLab')
+    @skipFlakyTest(bug_url=3D"https://gitlab.com/qemu-project/qemu/-/issue=
s/2691")
     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 Fri May  9 15:16:40 2025
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=1733938460; cv=none;
	d=zohomail.com; s=zohoarc;
	b=V/5leHMsdXaPZSy+JBjAtkMRyW6HFU8aj+DrRh33r8BDICxKtkX2IOJmcEN5Zkacnwtvvgxazp8eH05UvaRuFb16SUXdbxlLPqkk2ABZUtPDMAbEYqb3VyhFDywjpXjSnKL5oEtwAZmGtCnYAeWCKPKNJSSy9asQq/sSgohnc2c=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938460;
 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=z01igLdFUBXijPmUyFdU7/BlGo4KU92GfTPKf42FCLk=;
	b=URKL5a2y2dpxq7XX7S17WmuYYaX8jsbC1u3unHkMaQncOoY/lilHy8/Yn8hcw9JQAg5SnJlaoTJvUdUBP3hTw9ecgw36Pr1tN/AiSy9JSQXE6kNHCUmvIB3UeK8j8jLkszc3EhJs1DcbrFE7Rd9tZ+tgOUWnMVaFhyJPx0KWGtY=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 173393846026011.534182570880603;
 Wed, 11 Dec 2024 09:34:20 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUj-0005Yv-KO; Wed, 11 Dec 2024 12:27:30 -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 <berrange@redhat.com>)
 id 1tLQUh-0005YT-Cj
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27: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 <berrange@redhat.com>)
 id 1tLQUf-00017x-Q9
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:27 -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-94-lEx4QoUMNVuimppVpdyXjw-1; Wed,
 11 Dec 2024 12:27:21 -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 158D91954B3E; Wed, 11 Dec 2024 17:27:18 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id B0FD91956048; Wed, 11 Dec 2024 17:27:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938045;
 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=z01igLdFUBXijPmUyFdU7/BlGo4KU92GfTPKf42FCLk=;
 b=XPfEvmy6cbWp7MjFeGgq7PFO/cqkMHzrPp+PPjqXm/rZbYwaJXhgd+2QS+1jdEejczphO7
 DdenG8Jxei5mUWWJMKOhyj5z/LAIPRDhNCYLYqkdUd0G3wj0DB5cXs67hPPTt2Ro7xDsYY
 5ZjvQmZ6NI8dJO/5FIRQjx8dMM00NCA=
X-MC-Unique: lEx4QoUMNVuimppVpdyXjw-1
X-Mimecast-MFC-AGG-ID: lEx4QoUMNVuimppVpdyXjw
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 08/31] tests/functional: drop 'has_cmd' and 'has_cmds'
 helpers
Date: Wed, 11 Dec 2024 17:26:24 +0000
Message-ID: <20241211172648.2893097-9-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938460812116600

The 'which' helper is simpler and sufficient for test needs.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/__init__.py   |  2 +-
 tests/functional/qemu_test/cmd.py        | 54 ++----------------------
 tests/functional/qemu_test/tuxruntest.py | 10 ++---
 3 files changed, 9 insertions(+), 57 deletions(-)

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu=
_test/__init__.py
index 7dee3522f2..fe6cbe3a8a 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -8,7 +8,7 @@
=20
 from .asset import Asset
 from .config import BUILD_DIR
-from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \
+from .cmd import 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, which
 from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test=
/cmd.py
index 600e0509db..bebcd46dcf 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -29,52 +29,6 @@ def which(tool):
             return p
     return None
=20
-def has_cmd(name, args=3DNone):
-    """
-    This function is for use in a @skipUnless decorator, e.g.:
-
-        @skipUnless(*has_cmd('sudo -n', ('sudo', '-n', 'true')))
-        def test_something_that_needs_sudo(self):
-            ...
-    """
-
-    if args is None:
-        args =3D ('which', name)
-
-    try:
-        _, stderr, exitcode =3D run_cmd(args)
-    except Exception as e:
-        exitcode =3D -1
-        stderr =3D str(e)
-
-    if exitcode !=3D 0:
-        cmd_line =3D ' '.join(args)
-        err =3D f'{name} required, but "{cmd_line}" failed: {stderr.strip(=
)}'
-        return (False, err)
-    else:
-        return (True, '')
-
-def has_cmds(*cmds):
-    """
-    This function is for use in a @skipUnless decorator and
-    allows checking for the availability of multiple commands, e.g.:
-
-        @skipUnless(*has_cmds(('cmd1', ('cmd1', '--some-parameter')),
-                              'cmd2', 'cmd3'))
-        def test_something_that_needs_cmd1_and_cmd2(self):
-            ...
-    """
-
-    for cmd in cmds:
-        if isinstance(cmd, str):
-            cmd =3D (cmd,)
-
-        ok, errstr =3D has_cmd(*cmd)
-        if not ok:
-            return (False, errstr)
-
-    return (True, '')
-
 def run_cmd(args):
     subp =3D subprocess.Popen(args,
                             stdout=3Dsubprocess.PIPE,
@@ -254,7 +208,7 @@ def get_qemu_img(test):
     qemu_img =3D os.path.join(BUILD_DIR, 'qemu-img')
     if os.path.exists(qemu_img):
         return qemu_img
-    (has_system_qemu_img, errmsg) =3D has_cmd('qemu-img')
-    if has_system_qemu_img:
-        return 'qemu-img'
-    test.skipTest(errmsg)
+    qemu_img =3D which('qemu-img')
+    if qemu_img is not None:
+        return qemu_img
+    test.skipTest(f"qemu-img not found in {BUILD_DIR} or '$PATH'")
diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qe=
mu_test/tuxruntest.py
index d375f2713b..2e5c6d110c 100644
--- a/tests/functional/qemu_test/tuxruntest.py
+++ b/tests/functional/qemu_test/tuxruntest.py
@@ -15,7 +15,7 @@
 from qemu_test import QemuSystemTest
 from qemu_test import 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 which, run_cmd, get_qemu_img
=20
 class TuxRunBaselineTest(QemuSystemTest):
=20
@@ -38,10 +38,8 @@ def setUp(self):
         super().setUp()
=20
         # We need zstd for all the tuxrun tests
-        (has_zstd, msg) =3D has_cmd('zstd')
-        if has_zstd is False:
-            self.skipTest(msg)
-        self.zstd =3D 'zstd'
+        if which('zstd') is None:
+            self.skipTest("zstd not found in $PATH")
=20
         # Pre-init TuxRun specific settings: Most machines work with
         # reasonable defaults but we sometimes need to tweak the
@@ -78,7 +76,7 @@ def fetch_tuxrun_assets(self, kernel_asset, rootfs_asset,=
 dtb_asset=3DNone):
=20
         disk_image =3D self.workdir + "/rootfs.ext4"
=20
-        run_cmd([self.zstd, "-f", "-d", disk_image_zst,
+        run_cmd(['zstd', "-f", "-d", disk_image_zst,
                  "-o", disk_image])
         # zstd copies source archive permissions for the output
         # file, so must make this writable for QEMU
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938076; cv=none;
	d=zohomail.com; s=zohoarc;
	b=UWzUl/z/DSvcYnKukr+8aSDQVKoMHWSgHsee4+X+WE6Djl3rUvrwvWLxn/+H5orcCHYvCQ1i0D9XME9EKDhdriFULRiYcdCmNYbEyEAIwrXoOsKsEGqstu3TLAAunmYlE2Gk1PF6mgMqoo4TmdKeyVXa4t5VHkTHRaVuClXTxcQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938076;
 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=je0Q9NXkq5uthrqsKXN+C51FrUK7oicX8qQRoXsGIpA=;
	b=VpEf1O4uY4fDSKQjBm48IER+Ho2xtsOpqJOayxtUI7qTp9C1fj4lRLwuuXvdCSuw6ttuWqaO6bwll/IaucI7+K42H/a7hzvAaPJ6zmDF5XqdAfnlkH4JnOHagpLrOcfwdhwOe3sFbn+jjdfzkClDDFiEJAIrFsoTaMtOArvx/eo=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938076119246.747378163975;
 Wed, 11 Dec 2024 09:27:56 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUg-0005Xz-LY; Wed, 11 Dec 2024 12:27:26 -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 <berrange@redhat.com>)
 id 1tLQUf-0005XE-Od
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:25 -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 <berrange@redhat.com>)
 id 1tLQUe-00017m-5U
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:25 -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-199-x_HnDPWpN-qfU53UZfyGcA-1; Wed,
 11 Dec 2024 12:27:22 -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 D711E19560A3; Wed, 11 Dec 2024 17:27:20 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id BF49A1956048; Wed, 11 Dec 2024 17:27:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938043;
 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=je0Q9NXkq5uthrqsKXN+C51FrUK7oicX8qQRoXsGIpA=;
 b=AyoBAiriv0Vs8ZuzHJ7Az1jdpuh1t/B5Xkk6nuPqiZOeJt+1DgbWcw7ASCq3lUyxdKG6aU
 G88wsdLoTru3fr1VFZHnlqVV33AYlQzkX+yLmw/y2/haqgAVnFzGWoHmLovGvixBXfK6dZ
 18+MjfqqetdR2bcLc84pjaQMvRWSTc4=
X-MC-Unique: x_HnDPWpN-qfU53UZfyGcA-1
X-Mimecast-MFC-AGG-ID: x_HnDPWpN-qfU53UZfyGcA
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 09/31] tests/functional: add helpers for building file
 paths
Date: Wed, 11 Dec 2024 17:26:25 +0000
Message-ID: <20241211172648.2893097-10-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938076896116600

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 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/testcase.py | 95 ++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu=
_test/testcase.py
index 90ae59eb54..89425b737c 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,99 @@ class QemuBaseTest(unittest.TestCase):
     log =3D None
     logdir =3D None
=20
+    '''
+    Create a temporary directory suitable for storing UNIX
+    socket paths.
+
+    Returns: a tempfile.TemporaryDirectory instance
+    '''
+    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: string representing a file 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: string representing a file 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: string representing a file 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: string representing a file path
+    '''
+    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())
@@ -65,6 +157,9 @@ def setUp(self, bin_prefix):
     def tearDown(self):
         if "QEMU_TEST_KEEP_SCRATCH" not in os.environ:
             shutil.rmtree(self.workdir)
+        if self.socketdir is not None:
+            shutil.rmtree(self.socketdir.name)
+            self.socketdir =3D None
         self.machinelog.removeHandler(self._log_fh)
         self.log.removeHandler(self._log_fh)
=20
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938467; cv=none;
	d=zohomail.com; s=zohoarc;
	b=EvsMknKpuIYzRLHADZACns8lS1sKplPO8xmf6WB5CganlW0KScVKl5thL0FfW1/aIGA60Y4mwTKPBBI4CopDp6nQputBycTG68erHZUUufbUo3287YTFDkC1210wgMcTHFbWRENecCHAIpm4XldNXLe0OzBOXqm15yE5Lt7Cjq8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938467;
 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=U9esgIthrudvDaRJ+rEBiuyKD4+iIMzGIxm2i96hJI8=;
	b=WzYnafxEn4JPsy/sBg3WKXWTHL2w0EVEzG4VUEF8AGW1MKG+znmZpjfc6QFucnFR3F+oyrVkI+WqSoUnUWe/3/0PxN8fe9FMfV2YcinU6yElFeGkA7CXKQxPXgR7/RxKxmvVt/NpJdYpm485sRHp7M8i+psR4HGxjDPZiLebWmo=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938467950859.5090872986967;
 Wed, 11 Dec 2024 09:34:27 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUl-0005ZR-R0; Wed, 11 Dec 2024 12:27:31 -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 <berrange@redhat.com>)
 id 1tLQUk-0005ZB-1h
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:30 -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 <berrange@redhat.com>)
 id 1tLQUi-00018F-Cx
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:29 -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-329-spkdExBcP5W_tsLVYoYInA-1; Wed,
 11 Dec 2024 12:27:26 -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 7E63A195609D; Wed, 11 Dec 2024 17:27:23 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 5D4141956048; Wed, 11 Dec 2024 17:27:21 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938047;
 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=U9esgIthrudvDaRJ+rEBiuyKD4+iIMzGIxm2i96hJI8=;
 b=QVK0WJcKKJajbq8fZASaTZyGKLiVgPLpfn4WA9V0VgxqWeucmcfCMj51gJY65VgVdge7Re
 iFJ1e6p0b2S6oO8h/MONdedUJOoboD6RmsC0MXZGb8FPQCZ9CdLZOx0JR3/fHkshNoBbHW
 m3byMbdEepop5YXzTedaHvqogFOFLWg=
X-MC-Unique: spkdExBcP5W_tsLVYoYInA-1
X-Mimecast-MFC-AGG-ID: spkdExBcP5W_tsLVYoYInA
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 Thomas Huth <thuth@redhat.com>
Subject: [PATCH v2 10/31] tests/functional: switch over to using
 self.log_file(...)
Date: Wed, 11 Dec 2024 17:26:26 +0000
Message-ID: <20241211172648.2893097-11-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938468780116600

This removes direct access of the 'self.logdir' variable.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 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 89425b737c..2174fbb155 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -126,7 +126,7 @@ def scratch_file(self, *args):
     Returns: string representing a file path
     '''
     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')
@@ -138,8 +138,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')
@@ -215,7 +214,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)
@@ -269,7 +268,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 2d298b1f02..7654421e6b 100755
--- a/tests/functional/test_virtio_gpu.py
+++ b/tests/functional/test_virtio_gpu.py
@@ -100,9 +100,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 Fri May  9 15:16:40 2025
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=1733938435; cv=none;
	d=zohomail.com; s=zohoarc;
	b=g89d8Wh1anISuFoYMK+2GhHGo9nQjSpGmoVmAJh8Ew78dd4yb6qHoYfB0WWn+QhnaEdbk4WH2diWpLSd1mvItYyuJocyD67gOGEtYm8BzWx8Lg4r6ujFktqlpExOpi2/LqOtCYNLeZAXEdbT2PUbjcuGbZJrU+Ph6HKZJ8XCs7k=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938435;
 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=U8ebHiV+QzP2LdtUm3D2NUxYz3xyu6BTuJUExW4kMEA=;
	b=XN1brP3MQ7QzLq5GyGIM0+iC1jhMN964BaOAUSISAdXEX6UMaj9uO0uIBhYeoOyRMsHF99cZ84PgY3R02eX7uhCjMy3w0DXTRFcbRSBTtfebYQqor4G1v9z9PblCSrKSy5ryT+TbhrVlyWsR3k9StSpDPa00WEAObD+8BFTek8k=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938435740174.2293749503442;
 Wed, 11 Dec 2024 09:33:55 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUp-0005g1-E2; Wed, 11 Dec 2024 12:27:35 -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 <berrange@redhat.com>)
 id 1tLQUm-0005ZW-Ox
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:32 -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 <berrange@redhat.com>)
 id 1tLQUl-00018t-3R
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:32 -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-649-ITAQpqfnMlmswL5p1gfLrg-1; Wed,
 11 Dec 2024 12:27: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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 43DA719560A2; Wed, 11 Dec 2024 17:27:26 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 198331956048; Wed, 11 Dec 2024 17:27:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938050;
 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=U8ebHiV+QzP2LdtUm3D2NUxYz3xyu6BTuJUExW4kMEA=;
 b=djKq16lkXv86AwhqbKc4a0ZgcY++Vg+IL6cI6GphudNH/GqSc/pvIxqR5tEpQ+KPV5z4rf
 DAXHlg9MCWMzLdI0QDkHiCYdC4qk9UCGMoCgczBuosQYMQwy0h16M62xK41/V+kFusEa/I
 QtRvmppOhWX3zy9c56BtCiKcMX16wYA=
X-MC-Unique: ITAQpqfnMlmswL5p1gfLrg-1
X-Mimecast-MFC-AGG-ID: ITAQpqfnMlmswL5p1gfLrg
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 Thomas Huth <thuth@redhat.com>
Subject: [PATCH v2 11/31] tests/functional: switch over to using
 self.build_file(...)
Date: Wed, 11 Dec 2024 17:26:27 +0000
Message-ID: <20241211172648.2893097-12-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938436750116600

This removes direct access of the 'BUILD_DIR' variable.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 tests/functional/qemu_test/cmd.py      |  5 ++---
 tests/functional/qemu_test/testcase.py |  4 ++--
 tests/functional/test_aarch64_virt.py  |  5 ++---
 tests/functional/test_virtio_gpu.py    | 11 +++--------
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test=
/cmd.py
index bebcd46dcf..c8971de00a 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -16,7 +16,6 @@
 import os.path
 import subprocess
=20
-from .config import BUILD_DIR
=20
 def which(tool):
     """ looks up the full path for @tool, returns None if not found
@@ -205,10 +204,10 @@ def get_qemu_img(test):
=20
     # If qemu-img has been built, use it, otherwise the system wide one
     # will be used.
-    qemu_img =3D os.path.join(BUILD_DIR, 'qemu-img')
+    qemu_img =3D test.build_file('qemu-img')
     if os.path.exists(qemu_img):
         return qemu_img
     qemu_img =3D which('qemu-img')
     if qemu_img is not None:
         return qemu_img
-    test.skipTest(f"qemu-img not found in {BUILD_DIR} or '$PATH'")
+    test.skipTest(f"qemu-img not found in build dir or '$PATH'")
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu=
_test/testcase.py
index 2174fbb155..493938240c 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -133,8 +133,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 c967da41b4..5bc461b482 100755
--- a/tests/functional/test_aarch64_virt.py
+++ b/tests/functional/test_aarch64_virt.py
@@ -14,7 +14,6 @@
 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
@@ -54,8 +53,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 7654421e6b..630569bff8 100755
--- a/tests/functional/test_virtio_gpu.py
+++ b/tests/functional/test_virtio_gpu.py
@@ -6,7 +6,6 @@
 # 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
@@ -18,12 +17,8 @@
 import subprocess
=20
=20
-def pick_default_vug_bin():
-    relative_path =3D "./contrib/vhost-user-gpu/vhost-user-gpu"
-    if is_readable_executable_file(relative_path):
-        return relative_path
-
-    bld_dir_path =3D os.path.join(BUILD_DIR, relative_path)
+def pick_default_vug_bin(test):
+    bld_dir_path =3D test.build_file(relative_path)
     if is_readable_executable_file(bld_dir_path):
         return bld_dir_path
=20
@@ -86,7 +81,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 Fri May  9 15:16:40 2025
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=1733938134; cv=none;
	d=zohomail.com; s=zohoarc;
	b=PjPho/kVvt9w4W6vtVExBXyGAMgfUYgzhaebVUaqOq9/DnuC+EyrlIcR2COt6yrsdLgacpnz9SYnFoQ7SuAGgTSi2b8I6qsX98VFHoTlJr2r6TKaeLD7157OWHlHDRjMEH4n6FPpyxDFxfBM9m8qpcMpdSL5y7iZxkyNqO1dkE8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938134;
 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=joRaw0FxMPb99fJofIlwceyLs8ZRq3mk1I4L2cqj/UU=;
	b=X1BTwfHx/lJqChnfImxURN3RnP+4V6JB+7W50uHNXwBty81rC7exX1I++516OLZgVDT+DB7BH0E+3zJ9U7+Ko9JtxkdI1pm2s1y8OeEM/YXAKmE913eYwFfbRVncz2pZnSKNBBW0+AoMTveqaVQrRF75MXffRmVfXQgRtID8q7M=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 173393813449981.55035355025404;
 Wed, 11 Dec 2024 09:28:54 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUq-0005iq-PM; Wed, 11 Dec 2024 12:27:36 -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 <berrange@redhat.com>)
 id 1tLQUo-0005dg-Ad
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:34 -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 <berrange@redhat.com>)
 id 1tLQUm-00019E-Ge
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:33 -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-450-xVRbx5VXPyKxKhIC2V9P4A-1; Wed,
 11 Dec 2024 12:27:30 -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 0A1F1195608A; Wed, 11 Dec 2024 17:27:29 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id A511F1956048; Wed, 11 Dec 2024 17:27:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938051;
 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=joRaw0FxMPb99fJofIlwceyLs8ZRq3mk1I4L2cqj/UU=;
 b=BLNuR/WHN3j8PG3ZJBbLAfG17gqdlUgdTkv54nRfoINo3YYs4jnw5xbliiLN2eXIJprKcg
 CBsxpEsZEbczOnRlGObtkNZwodu6FqiWYuq/foLhk9BxRp4VA7Qzl62QsyeIRNymjHqG6m
 suANNpK6zduPbTpz+Q3rvGKDxZpLnh0=
X-MC-Unique: xVRbx5VXPyKxKhIC2V9P4A-1
X-Mimecast-MFC-AGG-ID: xVRbx5VXPyKxKhIC2V9P4A
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 Thomas Huth <thuth@redhat.com>
Subject: [PATCH v2 12/31] tests/functional: switch over to using
 self.data_file(...)
Date: Wed, 11 Dec 2024 17:26:28 +0000
Message-ID: <20241211172648.2893097-13-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938135147116600

This removes direct path manipulation to figure out the source dir

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 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 8763ea0822..59d0383563 100755
--- a/tests/functional/test_acpi_bits.py
+++ b/tests/functional/test_acpi_bits.py
@@ -38,7 +38,6 @@
 import tarfile
 import zipfile
=20
-from pathlib import Path
 from typing import (
     List,
     Optional,
@@ -119,7 +118,6 @@ class AcpiBitsTest(QemuSystemTest): #pylint: disable=3D=
too-many-instance-attribute
     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'
@@ -134,26 +132,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')
@@ -256,8 +250,6 @@ def setUp(self): # pylint: disable=3Darguments-differ
         super().setUp()
         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 Fri May  9 15:16:40 2025
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=1733938200; cv=none;
	d=zohomail.com; s=zohoarc;
	b=RsztX8aSOXPE/JWWqj6yg5QmmtCxy4qEKYwvW0W7PUp5/aZDZX+CWajA3nCUMxnPooGj5hOfOE6Ysm6bLdqzS0suWMQQ/88A0N5tREFBKLpIbExjgqzFVSoYtGd9ZH234O7KWRqsB5V6rSJASNpoRFc85DFtEsmD2yShB0oKGpw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938200;
 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=QgVzOMH9f6FOpP6YsMPJFJ/OfFUTLhGHpm5Sck6RmiM=;
	b=eZjVMoOCEmtWYgwL/xv0L0/tu5WQP2mEvnZLMj5lglZljdEcWbYUfqQWPxzjo/advOA4GHp2ehStsK+BfWLM1np3w8vsEhUH+aeLstClkypr9JvZJTx4UITKl2pouEa8ClEsBza0oM+X+jr8ACk+HXKJViW6Qh8yPbw8QBRsTOE=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938200150792.6505057491985;
 Wed, 11 Dec 2024 09:30:00 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUz-0005uw-7J; Wed, 11 Dec 2024 12:27: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 <berrange@redhat.com>)
 id 1tLQUt-0005nq-Ux
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27: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 <berrange@redhat.com>)
 id 1tLQUp-00019e-Qt
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:39 -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-338-qSi8vX38OIO22dXTrQiytQ-1; Wed,
 11 Dec 2024 12:27: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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id DEF7719560B2; Wed, 11 Dec 2024 17:27:31 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 836961956052; Wed, 11 Dec 2024 17:27:29 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938055;
 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=QgVzOMH9f6FOpP6YsMPJFJ/OfFUTLhGHpm5Sck6RmiM=;
 b=ZwuFZnbsTl0cfIjQFuxn92QNqbrjx2WN99LuWW5bQbLYb+8iiVC39tThAH15ezt3xNIWm1
 gQUgmb8A3mSYxLdFyQsgCTC/+HNenMVymh3rUojkTuvBP33vPXGlTXDqC1Fba87IGxXivC
 wMo/O/HTUoKT1cNJVKM6hfyGr4IgCLo=
X-MC-Unique: qSi8vX38OIO22dXTrQiytQ-1
X-Mimecast-MFC-AGG-ID: qSi8vX38OIO22dXTrQiytQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 13/31] tests/functional: switch over to using
 self.scratch_file()
Date: Wed, 11 Dec 2024 17:26:29 +0000
Message-ID: <20241211172648.2893097-14-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938201878116600

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 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 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      |  6 +--
 tests/functional/test_aarch64_virt.py         |  3 +-
 tests/functional/test_acpi_bits.py            | 49 +++++++++----------
 tests/functional/test_alpha_clipper.py        |  4 +-
 tests/functional/test_arm_aspeed.py           | 16 +++---
 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_cubieboard.py       |  6 +--
 tests/functional/test_arm_emcraft_sf2.py      |  2 +-
 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_smdkc210.py         |  2 +-
 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         |  6 +--
 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            |  5 +-
 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            |  8 +--
 tests/functional/test_sparc64_sun4u.py        |  5 +-
 tests/functional/test_sparc_sun4m.py          |  2 +-
 tests/functional/test_xtensa_lx60.py          |  3 +-
 43 files changed, 123 insertions(+), 141 deletions(-)

diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/q=
emu_test/linuxkernel.py
index 2b5b9a5fda..2e4f4e35fd 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 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, '/=
')))
=20
diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qe=
mu_test/tuxruntest.py
index 2e5c6d110c..0b1bb8f0ed 100644
--- a/tests/functional/qemu_test/tuxruntest.py
+++ b/tests/functional/qemu_test/tuxruntest.py
@@ -74,7 +74,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(['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 e196f88537..8ba2c67248 100644
--- a/tests/functional/test_aarch64_aspeed.py
+++ b/tests/functional/test_aarch64_aspeed.py
@@ -38,26 +38,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
@@ -74,7 +76,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 e5c9f77479..2cda03f86f 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
 from qemu_test import 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 6db08da522..533ca64407 100755
--- a/tests/functional/test_aarch64_sbsaref.py
+++ b/tests/functional/test_aarch64_sbsaref.py
@@ -8,8 +8,6 @@
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
-import os
-
 from qemu_test import QemuSystemTest, Asset
 from qemu_test import wait_for_console_pattern
 from qemu_test import interrupt_interactive_console_until_pattern
@@ -32,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 5bc461b482..cc49f8963d 100755
--- a/tests/functional/test_aarch64_virt.py
+++ b/tests/functional/test_aarch64_virt.py
@@ -11,7 +11,6 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
 import time
-import os
 import logging
=20
 from qemu_test import QemuSystemTest, Asset
@@ -95,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 59d0383563..3b99ecf3a4 100755
--- a/tests/functional/test_acpi_bits.py
+++ b/tests/functional/test_acpi_bits.py
@@ -135,9 +135,9 @@ 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_INTERNAL_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)
@@ -148,9 +148,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))
@@ -187,8 +186,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))
@@ -209,13 +208,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))
@@ -250,17 +247,18 @@ def setUp(self): # pylint: disable=3Darguments-differ
         super().setUp()
         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)
@@ -284,7 +282,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()
@@ -316,8 +314,7 @@ def test_acpi_smbios_bits(self):
         """The main test case implementation."""
=20
         self.set_machine('pc')
-        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 dc4d067eb6..9561129c51 100755
--- a/tests/functional/test_arm_aspeed.py
+++ b/tests/functional/test_arm_aspeed.py
@@ -33,7 +33,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')
@@ -55,7 +55,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')
@@ -224,14 +224,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_")
-        socket =3D os.path.join(tpmstate_dir.name, 'swtpm-socket')
+        tpmstate_dir =3D self.scratch_file('swtpmstate')
+        os.mkdir(tpmstate_dir)
+        socket_dir =3D tempfile.TemporaryDirectory(prefix=3D"qemu_")
+        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
         # 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}')
@@ -272,7 +274,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
@@ -292,7 +294,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 9095b08539..88ef7b1edc 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
@@ -25,7 +24,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 fcd111f59d..2af6d9a18d 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 65f1228296..b4e3633422 100755
--- a/tests/functional/test_arm_canona1100.py
+++ b/tests/functional/test_arm_canona1100.py
@@ -31,7 +31,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_cubieboard.py b/tests/functional/tes=
t_arm_cubieboard.py
index fdbd52a33c..d81c333d0c 100755
--- a/tests/functional/test_arm_cubieboard.py
+++ b/tests/functional/test_arm_cubieboard.py
@@ -44,7 +44,7 @@ def test_arm_cubieboard_initrd(self):
         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)
         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()
@@ -78,7 +78,7 @@ def test_arm_cubieboard_sata(self):
         dtb_path =3D self.extract_from_deb(deb_path, dtb_path)
=20
         rootfs_path_gz =3D self.ASSET_SATA_ROOTFS.fetch()
-        rootfs_path =3D os.path.join(self.workdir, 'rootfs.cpio')
+        rootfs_path =3D self.scratch_file('rootfs.cpio')
         gzip_uncompress(rootfs_path_gz, rootfs_path)
=20
         self.vm.set_console()
@@ -112,7 +112,7 @@ def test_arm_cubieboard_openwrt_22_03_2(self):
         # to 126 MiB.
         self.set_machine('cubieboard')
         image_path_gz =3D self.ASSET_OPENWRT.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_emcraft_sf2.py b/tests/functional/te=
st_arm_emcraft_sf2.py
index ada4dfd82e..f9f3f069e2 100755
--- a/tests/functional/test_arm_emcraft_sf2.py
+++ b/tests/functional/test_arm_emcraft_sf2.py
@@ -28,7 +28,7 @@ def test_arm_emcraft_sf2(self):
=20
         uboot_path =3D self.ASSET_UBOOT.fetch()
         spi_path =3D self.ASSET_SPI.fetch()
-        spi_path_rw =3D os.path.join(self.workdir, 'spi.bin')
+        spi_path_rw =3D self.scratch_file('spi.bin')
         shutil.copy(spi_path, spi_path_rw)
         os.chmod(spi_path_rw, 0o600)
=20
diff --git a/tests/functional/test_arm_integratorcp.py b/tests/functional/t=
est_arm_integratorcp.py
index 54fa366ad4..a85b339d77 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
@@ -67,7 +66,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 b113adfe61..bea67cfb6a 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 3bf079dc4d..075f6b3301 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
 from qemu_test import 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_smdkc210.py b/tests/functional/test_=
arm_smdkc210.py
index b3b39b069d..c6c8f9a5f4 100755
--- a/tests/functional/test_arm_smdkc210.py
+++ b/tests/functional/test_arm_smdkc210.py
@@ -32,7 +32,7 @@ def test_arm_exynos4210_initrd(self):
         dtb_path =3D self.extract_from_deb(deb_path, dtb_path)
=20
         initrd_path_gz =3D self.ASSET_ROOTFS.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()
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 25a17d4794..ff773a7994 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
@@ -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
@@ -50,7 +49,7 @@ def test_bootrom_framebuffer_size(self):
     @skipIfMissingCommands('tesseract')
     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 d452a0271c..61c4d6bbf8 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 faa3927f2e..926c885f63 100755
--- a/tests/functional/test_microblazeel_s3adsp1800.py
+++ b/tests/functional/test_microblazeel_s3adsp1800.py
@@ -27,8 +27,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 52283e2dbd..ea362cf335 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 b8dfddd856..77671e0081 100755
--- a/tests/functional/test_mipsel_malta.py
+++ b/tests/functional/test_mipsel_malta.py
@@ -9,8 +9,6 @@
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
-import os
-
 from qemu_test import QemuSystemTest, LinuxKernelTest, Asset
 from qemu_test import interrupt_interactive_console_until_pattern
 from qemu_test import wait_for_console_pattern
@@ -37,7 +35,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 +76,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 88f0f99f24..037dfdf87e 100755
--- a/tests/functional/test_ppc64_hv.py
+++ b/tests/functional/test_ppc64_hv.py
@@ -46,23 +46,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 f5faa0f0b3..9ed23a1f0f 100755
--- a/tests/functional/test_ppc_amiga.py
+++ b/tests/functional/test_ppc_amiga.py
@@ -29,13 +29,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 e72cbdee12..1ae2f47bcc 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 2b3f0894ae..87b5d4d12b 100755
--- a/tests/functional/test_ppc_mpc8544ds.py
+++ b/tests/functional/test_ppc_mpc8544ds.py
@@ -28,7 +28,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 ffa9a0633e..f297651e64 100755
--- a/tests/functional/test_ppc_virtex_ml507.py
+++ b/tests/functional/test_ppc_virtex_ml507.py
@@ -28,8 +28,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 02d35f5234..b0adb38a45 100755
--- a/tests/functional/test_rx_gdbsim.py
+++ b/tests/functional/test_rx_gdbsim.py
@@ -10,9 +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 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, skipFlakyTest
@@ -41,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 f7acd90a89..e5884a4dd0 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 c54c7a8177..82acff4e55 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
 from qemu_test import exec_command
 from qemu_test import exec_command_and_wait_for_pattern
@@ -89,7 +87,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 cd46007942..b8dadabf3c 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,12 @@ 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 32e245f4ad..e7f6db0f24 100755
--- a/tests/functional/test_sparc64_sun4u.py
+++ b/tests/functional/test_sparc64_sun4u.py
@@ -10,12 +10,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
-import os
-
 from qemu_test import QemuSystemTest, Asset
 from qemu_test import 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
@@ -32,7 +31,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 Fri May  9 15:16:40 2025
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=1733938237; cv=none;
	d=zohomail.com; s=zohoarc;
	b=bzzT3Uw5G4/ngJRzAR9uXsSNa5x1A/8ex4tiSOJuJH/QuNGWqutQMdE5jg9YwR8l7gxVRT3/ZVx0XzRE1Bp0VmBTl/V8mP035GDGeDI2e2ZxliL0b2kNb/V6dRJSmz7C0DwQhbNDwp9mCQikpt5Tkxjan0MZX1nY+k3KZf+GmMw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938237;
 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=qb8V/aQYbLIrxdTuncepi3lH2bYt4JVi2kewINYlyDI=;
	b=nxBTuBTpL1UVJD+4zMeqmAVBV38/JumeypJsL3cuEHXn6N1++BQQ+XIhlhyhgStywsl8CnfB5Of2rEQiC4mCUfB2tbaS72tJdumuhDDroeG/otDaOUixL3INQTZdy7dZTTeFmiENmgY8/KMNnTW90FrfJ/Mtq+gohYTUwnsXgxA=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938237347385.27915982236414;
 Wed, 11 Dec 2024 09:30:37 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQUz-0005uj-2J; Wed, 11 Dec 2024 12:27: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 <berrange@redhat.com>)
 id 1tLQUt-0005no-St
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:40 -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 <berrange@redhat.com>)
 id 1tLQUr-00019j-RG
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:38 -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-313-4ZRq53XHNPylUTFwLipGSQ-1; Wed,
 11 Dec 2024 12:27:35 -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 A428619560B3; Wed, 11 Dec 2024 17:27:34 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 7A2931956048; Wed, 11 Dec 2024 17:27:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938057;
 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=qb8V/aQYbLIrxdTuncepi3lH2bYt4JVi2kewINYlyDI=;
 b=JGBnsFArHLGDwnWnlomL5sO2tMH4QjlCFm+nNkr+x1DRyx0SUML29CDLkqLuaVT/XNmn8P
 28nVTkKenvAAI826dkCoDmCpVRjfN4FWqDUTmiswCmufHdEyl/E4XGmDsU8oLVnLoTavaE
 NyxngTKWuuVeemgxoOaJFT9Xj0x0n1g=
X-MC-Unique: 4ZRq53XHNPylUTFwLipGSQ-1
X-Mimecast-MFC-AGG-ID: 4ZRq53XHNPylUTFwLipGSQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 14/31] tests/functional: switch over to using
 self.socket_dir(...)
Date: Wed, 11 Dec 2024 17:26:30 +0000
Message-ID: <20241211172648.2893097-15-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938239548116600

This removes direct creation of temporary dirs

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/test_arm_aspeed.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_ar=
m_aspeed.py
index 9561129c51..5bd31e43ee 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
 from qemu_test import exec_command_and_wait_for_pattern
@@ -226,7 +225,7 @@ 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_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,
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938185; cv=none;
	d=zohomail.com; s=zohoarc;
	b=QCFSk12ILWUCv1Mxv9cam0eMSh0oC0Byjsblz9TemiF7dAVvBvs6NGWo4UDCatrI1Omuy+KsWKoE7jAv18cPclkm3pzPI3SxkQInCpekgIvyzMVZ+jEpYasHrm9mdmyj7hM8iIwts9/ngWrfuXgXPmPtiT1oudlB1LG+T+jAK04=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938185;
 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=2mGODSMuPQz9KoSxfoSlSzJp+nFYF+zH6/PXo6OcUQA=;
	b=RQyWgspbL79C1zD6tJ3Qklf6fLdBXgH3qoKQRM0wf0+HZcuub5+U82ULWUvrW/VL8Y5rRl+qPL7PX8BczYWNuvUl7a2VyD1NoG1saVu/JVvkTxtILXOebaMPkciBcPWNc/6z8nzLZHPYkTWg4ZyY/vfiNTwielnIdQXAGjRzTzE=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938185132824.8591901870351;
 Wed, 11 Dec 2024 09:29:45 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQV1-000655-Jh; Wed, 11 Dec 2024 12:27: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 <berrange@redhat.com>)
 id 1tLQUw-0005qh-Jw
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:43 -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 <berrange@redhat.com>)
 id 1tLQUu-0001AK-LH
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:42 -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-211-_t1uTGu2Mz6N66mkOYC5jA-1; Wed,
 11 Dec 2024 12:27:38 -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 9E20619560B6; Wed, 11 Dec 2024 17:27:37 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 4100C1956048; Wed, 11 Dec 2024 17:27:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938059;
 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=2mGODSMuPQz9KoSxfoSlSzJp+nFYF+zH6/PXo6OcUQA=;
 b=T7wonYdBomSMurgaqvFm+0JbuG75IGEpQeznsN8fIL8FWGuALdncOLhlLDDs99UA+XxHoO
 L+Dgvsx4vGIHz7XLllnBEqCDRhESNgCCVbUgvJz6LD5JllpkPRR4muORg2nQheORrbMivs
 gN+cM+G5NGuTqDqpXf9swiruB0IVfHs=
X-MC-Unique: _t1uTGu2Mz6N66mkOYC5jA-1
X-Mimecast-MFC-AGG-ID: _t1uTGu2Mz6N66mkOYC5jA
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>,
 Thomas Huth <thuth@redhat.com>
Subject: [PATCH v2 15/31] tests/functional: remove redundant 'rmtree' call
Date: Wed, 11 Dec 2024 17:26:31 +0000
Message-ID: <20241211172648.2893097-16-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938187262116600

Everything in the scratch directory is automatically purged. Calling
'rmtree' again breaks the ability to optionally preserve the scratch
directory contents.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
---
 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 b8dadabf3c..c8954c93eb 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
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test.utils import archive_extract
@@ -26,7 +24,6 @@ def test_sh4eb_r2d(self):
                                                     '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 Fri May  9 15:16:40 2025
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=1733938085; cv=none;
	d=zohomail.com; s=zohoarc;
	b=nKJ1goOC/WhJqfRsFnN/h0eGlwGJbrT9yDLGXH0sOx4fsZt1PLdK4joUTkN2gZ8LGkt8v1qrr6H9bYn6oSrqu7D2B9sSdDllKuae89ci8yj4GgkuA1XsXId0ZiDgjyqKuMHs5PMLmOB1hLP4Ld2T7VupYSyd6XaV0hY8dwU7aHQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938085;
 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=8LeXvOB9xMquXPo5jMHlLmrYHMbwsS6HaE0Cly9hmOQ=;
	b=IkMUdohVrk3DFP1qE1ZtF2Z/FglG0nBxUbHI24Ga5cggX2ReS2UTdacH+ca9UxGOdZ32n7cUiHHU5mkGxFXTjifa1nNwwuGEAqRqeO3FN91EsfPiTVo4a+DJykhiUwO2pNSsxlEpeIcnVTc2UcormaoWnE9FRGWY8ifg7yUecCM=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938085084279.9340723650755;
 Wed, 11 Dec 2024 09:28:05 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQV3-0006A9-4M; Wed, 11 Dec 2024 12:27:49 -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 <berrange@redhat.com>)
 id 1tLQV0-00060O-TR
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:46 -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 <berrange@redhat.com>)
 id 1tLQUz-0001Ay-Cs
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:46 -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-570-IccC5gFdPSe2YZwsDSxAOQ-1; Wed,
 11 Dec 2024 12:27: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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 7CE291955D45; Wed, 11 Dec 2024 17:27:40 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 39C911955F42; Wed, 11 Dec 2024 17:27:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938064;
 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=8LeXvOB9xMquXPo5jMHlLmrYHMbwsS6HaE0Cly9hmOQ=;
 b=OfHGnGZsHNiZLDeX8lHhnBn+l2jzEQvy8fhYUGZK7rtW9DT9UB+awaPMLMswOv9L/tsVAb
 3DlEiClqN6ouOpYDkWxKMTKzM06U5JTy/px2F8U2oM2iBg2bNGLZXrF5DbgaG8I4+dN0LF
 sBNY5jHTPvnYCiwY1sqQgwGqNvg4wzY=
X-MC-Unique: IccC5gFdPSe2YZwsDSxAOQ-1
X-Mimecast-MFC-AGG-ID: IccC5gFdPSe2YZwsDSxAOQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 16/31] tests/functional: move archive handling into new
 archive.py file
Date: Wed, 11 Dec 2024 17:26:32 +0000
Message-ID: <20241211172648.2893097-17-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938087140116600

More archive related code will be added shortly, so having a
separate file makes more sense.

The utils.py imports the functions from archive.py, so that
existing callers don't need to be modified. This avoids
redundant code churn until later in the series when all
calls will be adapted for other reasons.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/archive.py | 31 +++++++++++++++++++++++++++
 tests/functional/qemu_test/utils.py   | 23 +++-----------------
 2 files changed, 34 insertions(+), 20 deletions(-)
 create mode 100644 tests/functional/qemu_test/archive.py

diff --git a/tests/functional/qemu_test/archive.py b/tests/functional/qemu_=
test/archive.py
new file mode 100644
index 0000000000..9872f08d23
--- /dev/null
+++ b/tests/functional/qemu_test/archive.py
@@ -0,0 +1,31 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Utilities for python-based QEMU tests
+#
+# Copyright 2024 Red Hat, Inc.
+#
+# Authors:
+#  Thomas Huth <thuth@redhat.com>
+
+import os
+import subprocess
+import tarfile
+
+
+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',
+                                           (lambda member, path: member))
+        if member:
+            tf.extract(member=3Dmember, path=3Ddest_dir)
+        else:
+            tf.extractall(path=3Ddest_dir)
+
+def cpio_extract(cpio_handle, output_path):
+    cwd =3D os.getcwd()
+    os.chdir(output_path)
+    subprocess.run(['cpio', '-i'],
+                   input=3Dcpio_handle.read(),
+                   stderr=3Dsubprocess.DEVNULL)
+    os.chdir(cwd)
diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te=
st/utils.py
index 1bf1c410d5..5ce1c4388e 100644
--- a/tests/functional/qemu_test/utils.py
+++ b/tests/functional/qemu_test/utils.py
@@ -12,8 +12,9 @@
 import lzma
 import os
 import shutil
-import subprocess
-import tarfile
+
+from .archive import tar_extract as archive_extract
+from .archive import cpio_extract
=20
 """
 Round up to next power of 2
@@ -36,16 +37,6 @@ def image_pow2ceil_expand(path):
             with open(path, 'ab+') as fd:
                 fd.truncate(size_aligned)
=20
-def archive_extract(archive, dest_dir, member=3DNone):
-    with tarfile.open(archive) as tf:
-        if hasattr(tarfile, 'data_filter'):
-            tf.extraction_filter =3D getattr(tarfile, 'data_filter',
-                                           (lambda member, path: member))
-        if member:
-            tf.extract(member=3Dmember, path=3Ddest_dir)
-        else:
-            tf.extractall(path=3Ddest_dir)
-
 def gzip_uncompress(gz_path, output_path):
     if os.path.exists(output_path):
         return
@@ -67,11 +58,3 @@ def lzma_uncompress(xz_path, output_path):
         except:
             os.remove(output_path)
             raise
-
-def cpio_extract(cpio_handle, output_path):
-    cwd =3D os.getcwd()
-    os.chdir(output_path)
-    subprocess.run(['cpio', '-i'],
-                   input=3Dcpio_handle.read(),
-                   stderr=3Dsubprocess.DEVNULL)
-    os.chdir(cwd)
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938136; cv=none;
	d=zohomail.com; s=zohoarc;
	b=dvJ7PnAZZPGdNJJuNV9UAiAMb+bn5PSk2O48Cse0JrpB1FdRlf/HqGiU488GvuyCZ0YBMMmfyP4hcP6OKhDffFascwu7Bon6Qm5K5RncJR2KDy9GBVLcscqFjFKyP8gvXbrUAicTyIRh/jhNT5P4NsMTZ2qxpBHS9ha9o6B35yU=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938136;
 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=r25o1qatbYmjCO7cQ2lgcYNEu9/2GIEhQp0I9qEdjEA=;
	b=GQeHn/7fgeqdMdsYQhQZ4k6w4sKJEdo4MGhKteAOAtZMf5EALDSc90MNcyMebYV+hABUWRLpsFCIzyNMrHDFUxrtxQzJ5GKaFlzkfF4ZREagqtrN6oahB+/y7u6SREgsdRjUZY2etPiC7OCD+odRpaSj9ugm0kbhzPMj/hz38mQ=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938136733734.5504457001259;
 Wed, 11 Dec 2024 09:28:56 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQV3-0006Br-Ps; Wed, 11 Dec 2024 12:27:49 -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 <berrange@redhat.com>)
 id 1tLQV1-00066L-Me
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:47 -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 <berrange@redhat.com>)
 id 1tLQV0-0001BC-69
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:47 -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-646-EkxAPlhhNR6-eWfQ6TPsbA-1; Wed,
 11 Dec 2024 12:27: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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 2AA8A195604F; Wed, 11 Dec 2024 17:27:43 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 192D51956048; Wed, 11 Dec 2024 17:27:40 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938065;
 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=r25o1qatbYmjCO7cQ2lgcYNEu9/2GIEhQp0I9qEdjEA=;
 b=AW/UJ8MeNprANmCa0K/1HvJXCuhww+gkRY2Bip/WUhcLw3GElHvHZgr+ktAZxt8AbsC6dR
 wlK9q0Y+LOMhsw7PjKaZpkY6PxtSJZjMCtLTITEzNhHoSTqbJxsKKo81I09zN0vJB6eZYj
 dTfVJVSHZT2dK5MXzriMfmNIueFrjmc=
X-MC-Unique: EkxAPlhhNR6-eWfQ6TPsbA-1
X-Mimecast-MFC-AGG-ID: EkxAPlhhNR6-eWfQ6TPsbA
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 17/31] tests/functional: move uncompress handling into new
 uncompress.py file
Date: Wed, 11 Dec 2024 17:26:33 +0000
Message-ID: <20241211172648.2893097-18-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938137075116600

More uncompress related code will be added shortly, so having a
separate file makes more sense.

The utils.py imports the functions from archive.py, so that
existing callers don't need to be modified. This avoids
redundant code churn until later in the series when all
calls will be adapted for other reasons.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/uncompress.py | 36 ++++++++++++++++++++++++
 tests/functional/qemu_test/utils.py      | 27 ++----------------
 2 files changed, 38 insertions(+), 25 deletions(-)
 create mode 100644 tests/functional/qemu_test/uncompress.py

diff --git a/tests/functional/qemu_test/uncompress.py b/tests/functional/qe=
mu_test/uncompress.py
new file mode 100644
index 0000000000..955170df65
--- /dev/null
+++ b/tests/functional/qemu_test/uncompress.py
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Utilities for python-based QEMU tests
+#
+# Copyright 2024 Red Hat, Inc.
+#
+# Authors:
+#  Thomas Huth <thuth@redhat.com>
+
+import gzip
+import lzma
+import os
+import shutil
+
+
+def gzip_uncompress(gz_path, output_path):
+    if os.path.exists(output_path):
+        return
+    with gzip.open(gz_path, 'rb') as gz_in:
+        try:
+            with open(output_path, 'wb') as raw_out:
+                shutil.copyfileobj(gz_in, raw_out)
+        except:
+            os.remove(output_path)
+            raise
+
+def lzma_uncompress(xz_path, output_path):
+    if os.path.exists(output_path):
+        return
+    with lzma.open(xz_path, 'rb') as lzma_in:
+        try:
+            with open(output_path, 'wb') as raw_out:
+                shutil.copyfileobj(lzma_in, raw_out)
+        except:
+            os.remove(output_path)
+            raise
diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te=
st/utils.py
index 5ce1c4388e..6b87af4414 100644
--- a/tests/functional/qemu_test/utils.py
+++ b/tests/functional/qemu_test/utils.py
@@ -8,13 +8,12 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
=20
-import gzip
-import lzma
 import os
-import shutil
=20
 from .archive import tar_extract as archive_extract
 from .archive import cpio_extract
+from .uncompress import gzip_uncompress
+from .uncompress import lzma_uncompress
=20
 """
 Round up to next power of 2
@@ -36,25 +35,3 @@ def image_pow2ceil_expand(path):
         if size !=3D size_aligned:
             with open(path, 'ab+') as fd:
                 fd.truncate(size_aligned)
-
-def gzip_uncompress(gz_path, output_path):
-    if os.path.exists(output_path):
-        return
-    with gzip.open(gz_path, 'rb') as gz_in:
-        try:
-            with open(output_path, 'wb') as raw_out:
-                shutil.copyfileobj(gz_in, raw_out)
-        except:
-            os.remove(output_path)
-            raise
-
-def lzma_uncompress(xz_path, output_path):
-    if os.path.exists(output_path):
-        return
-    with lzma.open(xz_path, 'rb') as lzma_in:
-        try:
-            with open(output_path, 'wb') as raw_out:
-                shutil.copyfileobj(lzma_in, raw_out)
-        except:
-            os.remove(output_path)
-            raise
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938085; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Uax/axmXTB/T2L5QJAZPhgxuefjGt7cX6/qSVWN2b5JOEBC+HcgcCPJj1DchxljoCeJ+M5wT3mjqVA6spxXu9NOKYGUM3smxxW12Pbk7oMeizGkwHfhhMFCwjM9Pup3KeuOLeGewF/W7v0ic7y5/OUK2GEyh5oG77+L9HT3exUw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938085;
 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=THfwWIwm5IfUOAdPy+n5ZqBsoUQt3B9YQI/Wm81rhfk=;
	b=J9QX8zH5YkU0skrzrXbDa5gP8YhQW/8Mm2msZSGs/Mty5qQiiqq6RYfVtbWlp+orf39JnYnKcaCoRjv8iepRMiLjEkOCRnfFHzrzRYk9L1j7J7pkVbUwUJkMmK/c5ll3Y8xlclBgOSrLenxVm3y08CgC83Fk1F3YFPnUP38wSVg=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938085210463.8891170387086;
 Wed, 11 Dec 2024 09:28:05 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQV8-0006YN-CA; Wed, 11 Dec 2024 12:27: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 <berrange@redhat.com>)
 id 1tLQV6-0006P7-J1
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:52 -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 <berrange@redhat.com>)
 id 1tLQV5-0001C6-1v
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:52 -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-183-L85i6pg8Nj6yK3aP8yOyLQ-1; Wed,
 11 Dec 2024 12:27:46 -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 CBEC21955DC1; Wed, 11 Dec 2024 17:27:45 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id ADA331956048; Wed, 11 Dec 2024 17:27:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938070;
 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=THfwWIwm5IfUOAdPy+n5ZqBsoUQt3B9YQI/Wm81rhfk=;
 b=TFIOimnwooQ9AEB16WgFhPx8CZVdnL7WWmWL/bnBwS8Njt5fG/C/eEX7RPTqDVI34z+roP
 IqeyJr5/O9Uifkh4d8/C3g0Sgx9vHcmnz/kp8zjfw0xeShs3qZAVZsrYAwovmEq6N+H4HN
 EB5BVGmbc+tN8grrChu9wdxLPfcQkCU=
X-MC-Unique: L85i6pg8Nj6yK3aP8yOyLQ-1
X-Mimecast-MFC-AGG-ID: L85i6pg8Nj6yK3aP8yOyLQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 18/31] tests/functional: add common zip_extract helper
Date: Wed, 11 Dec 2024 17:26:34 +0000
Message-ID: <20241211172648.2893097-19-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938087079116600

This mirrors the existing archive_extract and cpio_extract helpers

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/archive.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/functional/qemu_test/archive.py b/tests/functional/qemu_=
test/archive.py
index 9872f08d23..06b66701c0 100644
--- a/tests/functional/qemu_test/archive.py
+++ b/tests/functional/qemu_test/archive.py
@@ -10,6 +10,7 @@
 import os
 import subprocess
 import tarfile
+import zipfile
=20
=20
 def tar_extract(archive, dest_dir, member=3DNone):
@@ -29,3 +30,10 @@ def cpio_extract(cpio_handle, output_path):
                    input=3Dcpio_handle.read(),
                    stderr=3Dsubprocess.DEVNULL)
     os.chdir(cwd)
+
+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)
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938237; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ZRo4EJyoIRuq8Ze+Xb6Ql4lcqtFJWNraf93q3ld7FBMyvgbUt37AV+jbcqJy2Eyh9AufsEnum27u5fb6VifdDx0YOzSQZDAEltp4OoqCnZtX6ZdpSMT2o/Wu45i1s6iiJIMmcfPR/lFrYc4Zw+bEb2B/DSYf8N8VOxFzTnu4TsY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938237;
 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=19d1rFYwA8ktJMGhG/dmH3QFpC81HYZ9wSnuVDPNnXI=;
	b=dXOqOP2cZxijeyKbDRTfjdSWa+45eamTgBXnseq0Sd37uPL8u4BidvPEDcxJX8nVDwclNDQKa5Qs1ENCVu4km4BvlsEr666Bm4e2MRZ1UMZMUmbi72Y1LtVQeQa+KC/MyD/dPkdoRWJF1S0DFoTZSFGKAsuIoAYE9X7iZX1xxIM=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938237243655.599325665947;
 Wed, 11 Dec 2024 09:30:37 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVG-0006fX-AB; Wed, 11 Dec 2024 12:28:02 -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 <berrange@redhat.com>)
 id 1tLQV8-0006XV-4A
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:54 -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 <berrange@redhat.com>)
 id 1tLQV6-0001CA-F2
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:53 -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-16-ORXrsbb_NSyGayoP01yIHQ-1; Wed,
 11 Dec 2024 12:27: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 79D0D1955EB1; Wed, 11 Dec 2024 17:27:48 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 68C321956048; Wed, 11 Dec 2024 17:27:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938071;
 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=19d1rFYwA8ktJMGhG/dmH3QFpC81HYZ9wSnuVDPNnXI=;
 b=FJmTYwYi8b4sNm9koZG3hwpyKQWfklGmY+PrQJEGlwPLGO4zRSGKVggBcWZSfHU5Rf+dXr
 sApBRkG9vJEMHI/Ee8BwjKylx81hSya/2suXnN7JQ79oAQq/90f6XIyqXn7BQ07ao055N/
 Rxtcwtn6rYFxAnveQkwHRhqhMiffO+o=
X-MC-Unique: ORXrsbb_NSyGayoP01yIHQ-1
X-Mimecast-MFC-AGG-ID: ORXrsbb_NSyGayoP01yIHQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 19/31] tests/functional: add common deb_extract helper
Date: Wed, 11 Dec 2024 17:26:35 +0000
Message-ID: <20241211172648.2893097-20-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938237648116600

This mirrors the existing archive_extract, cpio_extract and zip_extract
helpers

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/archive.py     | 13 +++++++++++++
 tests/functional/qemu_test/linuxkernel.py | 13 ++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/tests/functional/qemu_test/archive.py b/tests/functional/qemu_=
test/archive.py
index 06b66701c0..a6fc97a557 100644
--- a/tests/functional/qemu_test/archive.py
+++ b/tests/functional/qemu_test/archive.py
@@ -12,6 +12,8 @@
 import tarfile
 import zipfile
=20
+from .cmd import run_cmd
+
=20
 def tar_extract(archive, dest_dir, member=3DNone):
     with tarfile.open(archive) as tf:
@@ -37,3 +39,14 @@ def zip_extract(archive, dest_dir, member=3DNone):
             zf.extract(member=3Dmember, path=3Ddest_dir)
         else:
             zf.extractall(path=3Ddest_dir)
+
+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])
+        tar_extract(file_path, dest_dir, member)
+    finally:
+        os.chdir(cwd)
diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/q=
emu_test/linuxkernel.py
index 2e4f4e35fd..8f2810f3af 100644
--- a/tests/functional/qemu_test/linuxkernel.py
+++ b/tests/functional/qemu_test/linuxkernel.py
@@ -6,8 +6,9 @@
 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 .archive import deb_extract
+
=20
 class LinuxKernelTest(QemuSystemTest):
     KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 '
@@ -37,13 +38,7 @@ 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)
+        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()
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938441; cv=none;
	d=zohomail.com; s=zohoarc;
	b=lBcSfCM2KB1F7LwHmi50N3HPnV7oDcajsW7nzRGNiPWjMVSybpi7cEnqn4NQUdPhZdAKBXI6DJxmacinaM7PvQj2kyAtCGK3rHszhnxnzDS0PQ0YshFYW6G6dyYejOZPX0FXPLiuH+PL3wXlhGRvFdzD6s//UE0R7bhMtxpkK2I=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938441;
 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=pFRZUnduo0mfXw0WSEjpBJNDUH2EtB314dtfKFV/3CQ=;
	b=Fz6yr6RNlSkXep1Y9mj2mUKwjTuHVbSoV/HGL5+FLqqMLz7cM3er0bqk4JTPS/dCfq8lXFMhIv8syaI5y1EBP3nIyL9JBMQnn2VV1rK+jWwtPFqxzRCY9JXFeIYcsXKGCYDKpiA8w1Z/waqhrvKNr58NcG1EuyAKTcQOMVOdhec=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938441087797.9097487666257;
 Wed, 11 Dec 2024 09:34:01 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVH-0006mW-VB; Wed, 11 Dec 2024 12:28:04 -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 <berrange@redhat.com>)
 id 1tLQVB-0006ey-J9
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27: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 <berrange@redhat.com>)
 id 1tLQVA-0001D7-6v
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:27:57 -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-192-xRsZ9Q_xNP-NS7RI6Na3aQ-1; Wed,
 11 Dec 2024 12:27: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 27F6719541BC; Wed, 11 Dec 2024 17:27:51 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id F10861956052; Wed, 11 Dec 2024 17:27:48 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938075;
 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=pFRZUnduo0mfXw0WSEjpBJNDUH2EtB314dtfKFV/3CQ=;
 b=gIAbSRIfLwusYwZKKPVXJVsLK+WAPSk2+scX1LxhG2ABcZMKmf9EgkRE5btWqOvRuGg+mE
 5GoN6zFbZFbkKmRO3vufeXBNbSKxEHOFhVtEm7bi87npk1svbAUY9NkycI4WTSyRw8Vp6q
 26aNdtBNhImSwly9yACYnxZR3g8KCWk=
X-MC-Unique: xRsZ9Q_xNP-NS7RI6Na3aQ-1
X-Mimecast-MFC-AGG-ID: xRsZ9Q_xNP-NS7RI6Na3aQ
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 20/31] tests/functional: let cpio_extract accept filenames
Date: Wed, 11 Dec 2024 17:26:36 +0000
Message-ID: <20241211172648.2893097-21-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938442601116600

Currently cpio_extract differs from tar_extract/zip_extract
in that it only allows a file-like object as input. Adapt it
to also support filenames.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/archive.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/functional/qemu_test/archive.py b/tests/functional/qemu_=
test/archive.py
index a6fc97a557..bc448dee4a 100644
--- a/tests/functional/qemu_test/archive.py
+++ b/tests/functional/qemu_test/archive.py
@@ -8,7 +8,7 @@
 #  Thomas Huth <thuth@redhat.com>
=20
 import os
-import subprocess
+from subprocess import check_call, run, DEVNULL
 import tarfile
 import zipfile
=20
@@ -25,12 +25,18 @@ def tar_extract(archive, dest_dir, member=3DNone):
         else:
             tf.extractall(path=3Ddest_dir)
=20
-def cpio_extract(cpio_handle, output_path):
+def cpio_extract(archive, output_path):
     cwd =3D os.getcwd()
     os.chdir(output_path)
-    subprocess.run(['cpio', '-i'],
-                   input=3Dcpio_handle.read(),
-                   stderr=3Dsubprocess.DEVNULL)
+    # Not passing 'check=3DTrue' as cpio exits with non-zero
+    # status if the archive contains any device nodes :-(
+    if type(archive) =3D=3D str:
+        run(['cpio', '-i', '-F', archive],
+            stdout=3DDEVNULL, stderr=3DDEVNULL)
+    else:
+        run(['cpio', '-i'],
+            input=3Darchive.read(),
+            stdout=3DDEVNULL, stderr=3DDEVNULL)
     os.chdir(cwd)
=20
 def zip_extract(archive, dest_dir, member=3DNone):
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938140; cv=none;
	d=zohomail.com; s=zohoarc;
	b=gdX8zs1MfoSq/vl67XmSA0U+NqEu3HfHsTWoEtjsyS4g+A1byTdDNGyNNLSkGiUkCcvdHcXXFCq5aw5+vbW5jDa97cJhW5r51nQHRR28NzJmIa92ozafFVEeskB0PMe+WdiN/Q04KyJtMUSjiD2fUZaPnvMkThNdWGn4sLnde7Y=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938140;
 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=wRAg+ecU2fQgJvt3zts9WwuvnhsBR5JkwUhpt9zQUzE=;
	b=OHClLtuEUi5CIcQd9NGEz6peevTWwubAKMoDKnf+Rla5+sUjvAtcwycT+Jt9T7lZZ96+EkmteuYgmGQ7BjSpN97NCdRHnTL7s/0ar8SyORWt3k4Wejg9Gw7QXrCfYLn4ngdjyGl+cKObFKNdtr/BlFCpVkR019BrDODI8cgMve4=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938140351659.6337802577792;
 Wed, 11 Dec 2024 09:29:00 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVL-0006yi-IO; Wed, 11 Dec 2024 12:28:08 -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 <berrange@redhat.com>)
 id 1tLQVH-0006nM-VP
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:04 -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 <berrange@redhat.com>)
 id 1tLQVG-0001EV-B5
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:03 -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-17-oXETMg3bMsGO-iBhTQQ5zw-1; Wed,
 11 Dec 2024 12:27:54 -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 967991956058; Wed, 11 Dec 2024 17:27:53 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 9E9BB1956048; Wed, 11 Dec 2024 17:27:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938081;
 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=wRAg+ecU2fQgJvt3zts9WwuvnhsBR5JkwUhpt9zQUzE=;
 b=V2LxhR3E+LbPbanCtA2XBWW58Tak5rvVixmpymZwJRh1Glvqjd4NgB2mkozfqJeudPV1PI
 YysEQUg/pvHtq4GFZhvNFVNe1zhfyPwItzsG2G3PdpOL4BBBjtGm5+P+C8Um7HJpZQxTEc
 Uo9SOSNLg4jqNJ4VdAY8Y/Xh1Ahbg24=
X-MC-Unique: oXETMg3bMsGO-iBhTQQ5zw-1
X-Mimecast-MFC-AGG-ID: oXETMg3bMsGO-iBhTQQ5zw
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 21/31] tests/functional: add a generalized archive_extract
Date: Wed, 11 Dec 2024 17:26:37 +0000
Message-ID: <20241211172648.2893097-22-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938141110116600

There are many types of archives that the tests deal with. Provide
a generalized 'archive_extract' that can detect the format and
delegate to the appropriate helper for extraction. This ensures
that all archive extraction code follows the same design pattern.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/__init__.py |  1 +
 tests/functional/qemu_test/archive.py  | 58 ++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu=
_test/__init__.py
index fe6cbe3a8a..665c482d13 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -16,3 +16,4 @@
 from .decorators import skipIfMissingCommands, skipIfNotMachine, \
     skipFlakyTest, skipUntrustedTest, skipBigDataTest, \
     skipIfMissingImports
+from .archive import archive_extract
diff --git a/tests/functional/qemu_test/archive.py b/tests/functional/qemu_=
test/archive.py
index bc448dee4a..c439d9413a 100644
--- a/tests/functional/qemu_test/archive.py
+++ b/tests/functional/qemu_test/archive.py
@@ -10,8 +10,10 @@
 import os
 from subprocess import check_call, run, DEVNULL
 import tarfile
+from urllib.parse import urlparse
 import zipfile
=20
+from .asset import Asset
 from .cmd import run_cmd
=20
=20
@@ -56,3 +58,59 @@ def deb_extract(archive, dest_dir, member=3DNone):
         tar_extract(file_path, dest_dir, member)
     finally:
         os.chdir(cwd)
+
+'''
+@params archive: filename, Asset, or file-like object to extract
+@params dest_dir: target directory to extract into
+@params member: optional member file to limit extraction to
+
+Extracts @archive into @dest_dir. All files are extracted
+unless @member specifies a limit.
+
+If @format is None, heuristics will be applied to guess the format
+from the filename or Asset URL. @format must be non-None if @archive
+is a file-like object.
+'''
+def archive_extract(archive, dest_dir, format=3DNone, member=3DNone):
+    if format is None:
+        format =3D guess_archive_format(archive)
+    if type(archive) =3D=3D Asset:
+        archive =3D str(archive)
+
+    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":
+        if type(archive) !=3D str:
+            raise Exception("Unable to use file-like object with deb archi=
ves")
+        deb_extract(archive, dest_dir, "./" + member)
+    else:
+        raise Exception(f"Unknown archive format {format}")
+
+'''
+@params archive: filename, or Asset to guess
+
+Guess the format of @compressed, raising an exception if
+no format can be determined
+'''
+def guess_archive_format(archive):
+    if type(archive) =3D=3D Asset:
+        archive =3D urlparse(archive.url).path
+    elif type(archive) !=3D str:
+        raise Exception(f"Unable to guess archive format for {archive}")
+
+    if ".tar." in archive or archive.endswith("tgz"):
+        return "tar"
+    elif archive.endswith(".zip"):
+        return "zip"
+    elif archive.endswith(".cpio"):
+        return "cpio"
+    elif archive.endswith(".deb") or archive.endswith(".udeb"):
+        return "deb"
+    else:
+        raise Exception(f"Unknown archive format for {archive}")
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938236; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ny1sCuC4s8/dMdL2PmQku9IdCXIb2XXPQum4xxcKT/rjWoQoeMGXbfHS2o8uyh+t7qB3YZfbZqx8m8VeDBaUuFw64SE3pie+OKEVWDIgvmjcnilnXxTXomUnjq6kgiGOBP+VnpEDnDtm4C2zAeAAIvAIyd3/PzomDAshttHwDbw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938236;
 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=ddv86qZJr20tnipF27e1O9UMnzOCqzdZZCTwkM3/Ixk=;
	b=fFVw9NOGSutvh0lNRpAzlXvF9xxPEQgjxOaqxSO4xCamtIwWRwzEa8R4eoaPLt6dmZZ8LGXXUyJeFraW4SREdK2tWYV/9dhzikVCNrQzWTjYLUQ866ilLX1gsqYVAUq7QNU5yuFHKsA6bD2mKKpv8lmyKkgcfzaIrj8sA9T1gk8=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938236190570.3599194435592;
 Wed, 11 Dec 2024 09:30:36 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVK-0006uP-8l; Wed, 11 Dec 2024 12:28:06 -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 <berrange@redhat.com>)
 id 1tLQVH-0006n7-Og
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:03 -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 <berrange@redhat.com>)
 id 1tLQVG-0001E2-7k
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:03 -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-269-pmgumwAsOA638pPfLF3E5Q-1; Wed,
 11 Dec 2024 12:27: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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 5E2FF195420C; Wed, 11 Dec 2024 17:27:56 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 3300E1956048; Wed, 11 Dec 2024 17:27:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938079;
 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=ddv86qZJr20tnipF27e1O9UMnzOCqzdZZCTwkM3/Ixk=;
 b=DQjLShuoDap1MnJ+8Ytl+W9u+IthN9K1QulLRFjhJI2dGxll7U+pUMxOHG2lqS5F8fjJIw
 dcQxZ1rXvWwKuOQb3F0Ky4Hs6pOeZC5Pl9ts3qnwfwhCAvM0F2EMp/EPUrzlKgzouUXRYi
 cQ8WznjNnQ6hg8uE63wWPdsGFJ1PCOg=
X-MC-Unique: pmgumwAsOA638pPfLF3E5Q-1
X-Mimecast-MFC-AGG-ID: pmgumwAsOA638pPfLF3E5Q
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 22/31] tests/functional: add 'archive_extract' to
 QemuBaseTest
Date: Wed, 11 Dec 2024 17:26:38 +0000
Message-ID: <20241211172648.2893097-23-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938237674116600

This helper wrappers archive.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 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/testcase.py | 32 ++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu=
_test/testcase.py
index 493938240c..19fb1d0c07 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -25,6 +25,7 @@
 from qemu.machine import QEMUMachine
 from qemu.utils import kvm_available, tcg_available
=20
+from .archive import archive_extract
 from .asset import Asset
 from .cmd import run_cmd
 from .config import BUILD_DIR
@@ -39,6 +40,37 @@ class QemuBaseTest(unittest.TestCase):
     log =3D None
     logdir =3D None
=20
+    '''
+    @params archive: filename, Asset, or file-like object to extract
+    @params format: optional archive format (tar, zip, deb, cpio)
+    @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 @format is None, heuristics will be applied to guess the format
+    from the filename or Asset URL. @format must be non-None if @archive
+    is a file-like object.
+
+    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):
+        self.log.debug(f"Extract {archive} format=3D{format}" +
+                       f"sub_dir=3D{sub_dir} member=3D{member}")
+        if type(archive) =3D=3D Asset:
+            archive.fetch()
+        if sub_dir is None:
+            archive_extract(archive, self.scratch_file(), format, member)
+        else:
+            archive_extract(archive, self.scratch_file(sub_dir),
+                            format, member)
+
+        if member is not None:
+            return self.scratch_file(member)
+        return None
+
     '''
     Create a temporary directory suitable for storing UNIX
     socket paths.
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938117; cv=none;
	d=zohomail.com; s=zohoarc;
	b=cw+fSofrkrZuc1jZg11v6UbRGZtkKBdABGBXIbJ7twG6tvPBYdT8cfk8F0uh2l2bbUkUMAwa23E4auriFl1gC0iJkxSo7p6XemMXU+f9rxeqH3Z1UXfd6wm9lb7q2phElda7kLbEehjqWcYnroP2M1JxLGNQnaCQ1cdSuPGzdBk=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938117;
 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=jU1EBdft0WiNh37UzwzIwlEiR2vCWs03nT8CW0m/JvM=;
	b=Ws7AunwifEBzFlIlWec72TbOyhSKqlA4526ASvW20WKj1j6EBd1Ntqx60VP6xQ0sSFVY7gOzX2frmc02XGR5q1PhBhgOJrzURMXQHczh/tlCMsbFt0OO4uWONhH1c/Pt6CcqCtbx/PJt+GuczqaFJaP6Fn21iywXZfa8X5Ed42o=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938117186309.15645884334253;
 Wed, 11 Dec 2024 09:28:37 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVS-0007YL-Rw; Wed, 11 Dec 2024 12:28:14 -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 <berrange@redhat.com>)
 id 1tLQVP-0007PU-TL
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:12 -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 <berrange@redhat.com>)
 id 1tLQVK-0001FL-2H
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:11 -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-636-CeIVoTCqMtayrEJ9g0W-fg-1; Wed,
 11 Dec 2024 12:28:00 -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 0AE571955E8E; Wed, 11 Dec 2024 17:27:59 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id EDC141956052; Wed, 11 Dec 2024 17:27:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938084;
 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=jU1EBdft0WiNh37UzwzIwlEiR2vCWs03nT8CW0m/JvM=;
 b=i6qrsvMML33hAdl8Cr+eu+B9ZsPu5q1cQpGA0R4MSAvArGkTUhTSSxx/y/lx+EeRzgrhMl
 GxOQj8XA1WzHqnCJ21FuDavGdv8lNXqQgVCYgiRgzcLC4BkRgiNMc9QMslWfbf9p92aDS7
 yywWp781y+NKtcGJ09NCorCyzF7L1tk=
X-MC-Unique: CeIVoTCqMtayrEJ9g0W-fg-1
X-Mimecast-MFC-AGG-ID: CeIVoTCqMtayrEJ9g0W-fg
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 23/31] tests/functional: convert tests to new
 archive_extract helper
Date: Wed, 11 Dec 2024 17:26:39 +0000
Message-ID: <20241211172648.2893097-24-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938119531116600

Replace use of utils.archive_extract and extract_from_deb with the
new archive_extract helper.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/linuxkernel.py     | 20 +----------
 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.py           | 26 ++++----------
 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 ++-
 34 files changed, 127 insertions(+), 201 deletions(-)

diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/q=
emu_test/linuxkernel.py
index 8f2810f3af..155855541f 100644
--- a/tests/functional/qemu_test/linuxkernel.py
+++ b/tests/functional/qemu_test/linuxkernel.py
@@ -3,11 +3,9 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
=20
-import os
-
 from .testcase import QemuSystemTest
 from .cmd import wait_for_console_pattern
-from .archive import deb_extract
+
=20
=20
 class LinuxKernelTest(QemuSystemTest):
@@ -29,19 +27,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 100644
--- 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.py b/tests/functional/test_ar=
m_aspeed.py
index 5bd31e43ee..dddb07fd12 100755
--- a/tests/functional/test_arm_aspeed.py
+++ b/tests/functional/test_arm_aspeed.py
@@ -13,8 +13,6 @@
 from qemu_test import LinuxKernelTest, Asset
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test import skipIfMissingCommands
-from qemu_test.utils import archive_extract
-from zipfile import ZipFile
=20
=20
 class AST1030Machine(LinuxKernelTest):
@@ -27,12 +25,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')
@@ -49,12 +43,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')
@@ -268,9 +258,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'))
@@ -284,9 +272,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 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


From nobody Fri May  9 15:16:40 2025
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=1733938184; cv=none;
	d=zohomail.com; s=zohoarc;
	b=nXaXQQU0VSkvZMrOJVilt/Av/yZzN52RaY5HnZeTNer3/iExnSN1PkGl3WvnueZJSM44I3WPacSznFnAxUo7cWQt1lPHYtzam8CZ10IW6JhXigPZQSHuj2V0uApYNT1TVKwNHCm/tZvyTB6jr1jaDBejNCFxxLgrWDJ5aFkVMo0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938184;
 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=yniLMEVLs++mgedoC3GIgzPwGodSupdOnSSR8cftK30=;
	b=dzuhW5F9h5VwK+00CpjJDjRoulClI+5QWJ+N5mrDno6w9yjcAVO2GEK/kBv8EQlM/q4J5Ja4cmWbhdVKTCZS0w6xnSBkY/qe/1jWTl2EGLU4PNwYSI6/pbOpRK/U7epXKl6d1/MdvVxDYxgSbyPUFvzTZlRM7sUXE/o0YT6YGYw=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938184489716.6389031450612;
 Wed, 11 Dec 2024 09:29:44 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVN-0007Aq-QD; Wed, 11 Dec 2024 12:28:10 -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 <berrange@redhat.com>)
 id 1tLQVK-0006vd-Gp
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:06 -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 <berrange@redhat.com>)
 id 1tLQVI-0001F3-Ed
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:05 -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-335-y-2QIQQjMHWqgY84pbddDg-1; Wed,
 11 Dec 2024 12:28: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 7C5F91954213; Wed, 11 Dec 2024 17:28:01 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 8418C1956048; Wed, 11 Dec 2024 17:27:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938083;
 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=yniLMEVLs++mgedoC3GIgzPwGodSupdOnSSR8cftK30=;
 b=f3VTaMkA+0ZRB/pem708L9MB7qf/oHOZk4Wqo6PnysCB0B7G5M2zuccjLwUM6UDvP0hApD
 t+LBAXgke7NjfyyAqEEph+TKPNEz7xJ7UdmtCneLgx16JC2v9QOogAP+L0DHgO/dCPjG8E
 CL2Du+PSn66B7ph2mVPHX70+bfitCCs=
X-MC-Unique: y-2QIQQjMHWqgY84pbddDg-1
X-Mimecast-MFC-AGG-ID: y-2QIQQjMHWqgY84pbddDg
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 24/31] tests/functional: add a generalized uncompress
 helper
Date: Wed, 11 Dec 2024 17:26:40 +0000
Message-ID: <20241211172648.2893097-25-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938185490116600

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 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/__init__.py   |  1 +
 tests/functional/qemu_test/uncompress.py | 47 ++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu=
_test/__init__.py
index 665c482d13..3bd043e608 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -17,3 +17,4 @@
     skipFlakyTest, skipUntrustedTest, skipBigDataTest, \
     skipIfMissingImports
 from .archive import archive_extract
+from .uncompress import uncompress
diff --git a/tests/functional/qemu_test/uncompress.py b/tests/functional/qe=
mu_test/uncompress.py
index 955170df65..6d02ded066 100644
--- a/tests/functional/qemu_test/uncompress.py
+++ b/tests/functional/qemu_test/uncompress.py
@@ -11,6 +11,9 @@
 import lzma
 import os
 import shutil
+from urllib.parse import urlparse
+
+from .asset import Asset
=20
=20
 def gzip_uncompress(gz_path, output_path):
@@ -34,3 +37,47 @@ def lzma_uncompress(xz_path, output_path):
         except:
             os.remove(output_path)
             raise
+
+'''
+@params compressed: filename, Asset, or file-like object to uncompress
+@params uncompressed: filename to uncompress into
+@params format: optional compression format (gzip, lzma)
+
+Uncompresses @compressed into @uncompressed
+
+If @format is None, heuristics will be applied to guess the format
+from the filename or Asset URL. @format must be non-None if @uncompressed
+is a file-like object.
+
+Returns the fully qualified path to the uncompessed file
+'''
+def uncompress(compressed, uncompressed, format=3DNone):
+    if format is None:
+        format =3D guess_uncompress_format(compressed)
+
+    if format =3D=3D "xz":
+        lzma_uncompress(str(compressed), uncompressed)
+    elif format =3D=3D "gz":
+        gzip_uncompress(str(compressed), uncompressed)
+    else:
+        raise Exception(f"Unknown compression format {format}")
+
+'''
+@params compressed: filename, Asset, or file-like object to guess
+
+Guess the format of @compressed, raising an exception if
+no format can be determined
+'''
+def guess_uncompress_format(compressed):
+    if type(compressed) =3D=3D Asset:
+        compressed =3D urlparse(compressed.url).path
+    elif type(compressed) !=3D str:
+        raise Exception(f"Unable to guess compression cformat for {compres=
sed}")
+
+    (name, ext) =3D os.path.splitext(compressed)
+    if ext =3D=3D ".xz":
+        return "xz"
+    elif ext =3D=3D ".gz":
+        return "gz"
+    else:
+        raise Exception(f"Unknown compression format for {compressed}")
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938338; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Vr0im0oeC7+IYg3uqLHXX9dM7K0sG61uy/QYPF/1u+5YZWYWJYzvRUN8A9VLJ9d2rkvjugCQSGuIX8uZNTTzzlPpXa5Pp3sqK8YBFmSweps27EEhCQ5r/iIIqtIWepZFQHezKz5WXunGHwn3hCVSPUC0tLHbu6hq2L7J+bZRYI8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938338;
 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=nioRd6M+Uzwz4yo+fCuaFy8NqnPE9AyRUsyusqHVRWA=;
	b=LWYINcfeP0GIruBJVSoBg0Ym867Odc6AdRwElsRenjFYOMDykmcY7zpf9QYoqdAOid9GDyU+I8lUU6kSBgigmHPJpPl7N1gsRVMpx10h+wY3PEgQcIGchpNkJZxDPKnsKuM7LkQmfHWXV6qpOROfcMDM7yH3UNHJSLMG7Qrg7pY=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938338399617.3281738135895;
 Wed, 11 Dec 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 <qemu-devel-bounces@nongnu.org>)
	id 1tLQVQ-0007PR-6x; Wed, 11 Dec 2024 12:28:12 -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 <berrange@redhat.com>)
 id 1tLQVO-0007H9-Ad
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:10 -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 <berrange@redhat.com>)
 id 1tLQVM-0001Fy-SG
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:10 -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-692-5D2KRfdIPl6hMxdv4dOggA-1; Wed,
 11 Dec 2024 12:28:05 -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 EBEF81956061; Wed, 11 Dec 2024 17:28:03 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id F3FE71956048; Wed, 11 Dec 2024 17:28:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938088;
 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=nioRd6M+Uzwz4yo+fCuaFy8NqnPE9AyRUsyusqHVRWA=;
 b=OCZTXDz251QE63zzhhcnhPXB1RoGxNFxgb+lJVfryAlLh/AAPKLNKq0WOZiY8h5YDH+HR+
 /PTecsgboikTK6FkG6ddHmNT3FoIC7N+uK0uUyiWxFuScLcS1lUpY5DxgJZ5NXHDtqVctM
 TXW4sTFmKqrLGarefBRrCAp5KRyd+Mo=
X-MC-Unique: 5D2KRfdIPl6hMxdv4dOggA-1
X-Mimecast-MFC-AGG-ID: 5D2KRfdIPl6hMxdv4dOggA
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 25/31] tests/functional: add 'uncompress' to QemuBaseTest
Date: Wed, 11 Dec 2024 17:26:41 +0000
Message-ID: <20241211172648.2893097-26-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938340222116600

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 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/testcase.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu=
_test/testcase.py
index 19fb1d0c07..684c94d45f 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -29,6 +29,7 @@
 from .asset import Asset
 from .cmd import run_cmd
 from .config import BUILD_DIR
+from .uncompress import uncompress
=20
=20
 class QemuBaseTest(unittest.TestCase):
@@ -40,6 +41,30 @@ class QemuBaseTest(unittest.TestCase):
     log =3D None
     logdir =3D None
=20
+    '''
+    @params compressed: filename, Asset, or file-like object to uncompress
+    @params format: optional compression format (gzip, lzma)
+
+    Uncompresses @compressed into the scratch directory.
+
+    If @format is None, heuristics will be applied to guess the format
+    from the filename or Asset URL. @format must be non-None if @uncompres=
sed
+    is a file-like object.
+
+    Returns the fully qualified path to the uncompessed file
+    '''
+    def uncompress(self, compressed, format=3DNone):
+        self.log.debug(f"Uncompress {compressed} format=3D{format}")
+        if type(compressed) =3D=3D Asset:
+            compressed.fetch()
+
+        (name, ext) =3D os.path.splitext(str(compressed))
+        uncompressed =3D self.scratch_file(os.path.basename(name))
+
+        uncompress(compressed, uncompressed, format)
+
+        return uncompressed
+
     '''
     @params archive: filename, Asset, or file-like object to extract
     @params format: optional archive format (tar, zip, deb, cpio)
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938436; cv=none;
	d=zohomail.com; s=zohoarc;
	b=V/hJv4mx0P3IVJxkaQqS8LO3J3Ev3MubR4nfzEYI5bpnS7C5UqcFVqlrmxj9BswH511TC/K+WZHQaycm+j5lZHiIjWgJmfotOvQ0e6QXaUey+G10Jwqb1zENbzDumrXlFduaT4scH0zOB7EGiWQwCDZBj93igAF/ocX1f5hgP60=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938436;
 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=9yneVDltJTaU77I+U7BXUc83y9S+dnWOL65wnDJbgkE=;
	b=i8OkpimeFHnxuI0E2ocxZiwqq8+G6fTrFFCC21saEYt+itGpNeKcDsKvzul+9FWsG5N0nWS41MgwU+tH4DLY4Ev8hslkU9AN7P7gFYC/mAihnQLOSHRXmWO50NVCBkvjNy+kL4+2jLis+Gul6k7EuXr7QfdBLLCwJoqBLvvk2Bo=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 17339384368931017.7202584883628;
 Wed, 11 Dec 2024 09:33:56 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVW-0007os-DV; Wed, 11 Dec 2024 12:28: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 <berrange@redhat.com>)
 id 1tLQVS-0007aw-T5
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28: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 <berrange@redhat.com>)
 id 1tLQVQ-0001Gl-5E
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:14 -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-578-YP43w4krPW2vvbn5u73_8Q-1; Wed,
 11 Dec 2024 12:28:08 -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 E312F1956058; Wed, 11 Dec 2024 17:28:06 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 8AC1C1956048; Wed, 11 Dec 2024 17:28:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938091;
 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=9yneVDltJTaU77I+U7BXUc83y9S+dnWOL65wnDJbgkE=;
 b=f2mN/QGGtBpY1o6LtwHdV3Ze0xqYd29FOmpVDv7KVaxZFn9JjUGCLQFprciiT4vQly203p
 9yu604FrwGGE1CLj6eTj/ocQuo55JpMWRzlW+Q4RPUEJIheR/NF5EZ8C/RoruIXPTSXheo
 XRtEaXe/BuPbKj4ZyshV0K8L8HbczRM=
X-MC-Unique: YP43w4krPW2vvbn5u73_8Q-1
X-Mimecast-MFC-AGG-ID: YP43w4krPW2vvbn5u73_8Q
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 26/31] tests/functional: convert tests to new uncompress
 helper
Date: Wed, 11 Dec 2024 17:26:42 +0000
Message-ID: <20241211172648.2893097-27-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938439114116600

Replace use of lzma_uncompress and gzip_uncompress with the
new uncompress helper.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/test_aarch64_raspi4.py   |  5 +----
 tests/functional/test_aarch64_sbsaref.py  | 10 +++-------
 tests/functional/test_alpha_clipper.py    |  4 +---
 tests/functional/test_arm_bpim2u.py       | 13 +++----------
 tests/functional/test_arm_cubieboard.py   | 14 ++++----------
 tests/functional/test_arm_orangepi.py     | 17 ++++-------------
 tests/functional/test_arm_raspi2.py       |  5 +----
 tests/functional/test_arm_smdkc210.py     |  6 ++----
 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 +----
 14 files changed, 31 insertions(+), 88 deletions(-)

diff --git a/tests/functional/test_aarch64_raspi4.py b/tests/functional/tes=
t_aarch64_raspi4.py
index 3918e35e82..7a4302b0c5 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
 from qemu_test import 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.dtb=
')
-        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 533ca64407..2d756efdab 100755
--- a/tests/functional/test_aarch64_sbsaref.py
+++ b/tests/functional/test_aarch64_sbsaref.py
@@ -11,7 +11,7 @@
 from qemu_test import QemuSystemTest, Asset
 from qemu_test import wait_for_console_pattern
 from qemu_test import interrupt_interactive_console_until_pattern
-from qemu_test.utils import lzma_uncompress
+
=20
 def fetch_firmware(test):
     """
@@ -29,14 +29,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 91c56b0930..12cd359746 100755
--- a/tests/functional/test_arm_bpim2u.py
+++ b/tests/functional/test_arm_bpim2u.py
@@ -10,7 +10,6 @@
 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 skipBigDataTest
-from qemu_test.utils import gzip_uncompress, lzma_uncompress
 from qemu_test.utils import image_pow2ceil_expand
=20
=20
@@ -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_cubieboard.py b/tests/functional/tes=
t_arm_cubieboard.py
index 32db303253..423db710e8 100755
--- a/tests/functional/test_arm_cubieboard.py
+++ b/tests/functional/test_arm_cubieboard.py
@@ -9,7 +9,7 @@
 from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pa=
ttern
 from qemu_test import interrupt_interactive_console_until_pattern
 from qemu_test import skipBigDataTest
-from qemu_test.utils import gzip_uncompress, image_pow2ceil_expand
+from qemu_test.utils import image_pow2ceil_expand
=20
=20
 class CubieboardMachine(LinuxKernelTest):
@@ -43,9 +43,7 @@ def test_arm_cubieboard_initrd(self):
         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)
+        initrd_path =3D self.uncompress(self.ASSET_INITRD)
=20
         self.vm.set_console()
         kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE +
@@ -77,9 +75,7 @@ def test_arm_cubieboard_sata(self):
                     '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')
-        gzip_uncompress(rootfs_path_gz, rootfs_path)
+        rootfs_path =3D self.uncompress(self.ASSET_SATA_ROOTFS)
=20
         self.vm.set_console()
         kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE +
@@ -111,9 +107,7 @@ def test_arm_cubieboard_openwrt_22_03_2(self):
         # This test download a 7.5 MiB compressed image and expand it
         # to 126 MiB.
         self.set_machine('cubieboard')
-        image_path_gz =3D self.ASSET_OPENWRT.fetch()
-        image_path =3D self.scratch_file('sdcard.img')
-        gzip_uncompress(image_path_gz, image_path)
+        image_path =3D self.uncompress(self.ASSET_OPENWRT)
         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 aa2d9d19a4..18ee50216b 100755
--- a/tests/functional/test_arm_orangepi.py
+++ b/tests/functional/test_arm_orangepi.py
@@ -11,7 +11,6 @@
 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, skipBigDataTest
-from qemu_test.utils import gzip_uncompress, lzma_uncompress
 from qemu_test.utils import image_pow2ceil_expand
=20
=20
@@ -76,9 +75,7 @@ def test_arm_orangepi_initrd(self):
         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)
+        initrd_path =3D self.uncompress(self.ASSET_INITRD)
=20
         self.vm.set_console()
         kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE +
@@ -112,9 +109,7 @@ def test_arm_orangepi_sd(self):
         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)
+        rootfs_path =3D self.uncompress(self.ASSET_ROOTFS)
         image_pow2ceil_expand(rootfs_path)
=20
         self.vm.set_console()
@@ -155,9 +150,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)
+        image_path =3D self.uncompress(self.ASSET_ARMBIAN)
         image_pow2ceil_expand(image_path)
=20
         self.vm.set_console()
@@ -195,9 +188,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-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)
+        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 5e38d1a937..d3c7aaa39b 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
 from qemu_test import 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.dtb=
')
-        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_arm_smdkc210.py b/tests/functional/test_=
arm_smdkc210.py
index f4e86f7e2b..0fda45c63a 100755
--- a/tests/functional/test_arm_smdkc210.py
+++ b/tests/functional/test_arm_smdkc210.py
@@ -7,7 +7,7 @@
 import os
=20
 from qemu_test import LinuxKernelTest, Asset
-from qemu_test.utils import gzip_uncompress
+
=20
 class Smdkc210Machine(LinuxKernelTest):
=20
@@ -30,9 +30,7 @@ def test_arm_exynos4210_initrd(self):
         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')
-        gzip_uncompress(initrd_path_gz, initrd_path)
+        initrd_path =3D self.uncompress(self.ASSET_ROOTFS)
=20
         self.vm.set_console()
         kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE +
diff --git a/tests/functional/test_mips64el_malta.py b/tests/functional/tes=
t_mips64el_malta.py
index 39fafb8bf1..a8da15a26b 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
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test import skipIfMissingImports, skipFlakyTest, skipUntrustedTe=
st
-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 6ab6c0832a..3b15038d89 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 1f44881c78..fe9c3a172e 100755
--- a/tests/functional/test_mipsel_malta.py
+++ b/tests/functional/test_mipsel_malta.py
@@ -12,7 +12,6 @@
 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.utils import lzma_uncompress
=20
=20
 class MaltaMachineConsole(LinuxKernelTest):
@@ -33,9 +32,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()
@@ -51,16 +49,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 b0adb38a45..20623aa51c 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
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test import 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 e5884a4dd0..453711aa0f 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
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test import wait_for_console_pattern
-from qemu_test.utils import lzma_uncompress
+
=20
 class S390CCWVirtioMachine(QemuSystemTest):
     KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 '
@@ -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 82acff4e55..eefd9729cb 100755
--- a/tests/functional/test_s390x_topology.py
+++ b/tests/functional/test_s390x_topology.py
@@ -14,7 +14,6 @@
 from qemu_test import exec_command
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test import wait_for_console_pattern
-from qemu_test.utils import lzma_uncompress
=20
=20
 class S390CPUTopology(QemuSystemTest):
@@ -86,9 +85,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


From nobody Fri May  9 15:16:40 2025
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=1733938434; cv=none;
	d=zohomail.com; s=zohoarc;
	b=jc4BYcrH9/kpygaRPS2b7dOHtVCJjsPSdMhHC7VTVM/A98RCySDLl7VESd91ImfKoMsuJmn5PDZRSPQpFHFRBitqLKX/1mNAJQhw1ugBQWh55PYu1UPJhech7TddOtfSdz5Nlc5zoz/lsZOIiVwNTmhOdav9eMnvWbA46x5MNBE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938434;
 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=Vhq5UCMuSErzt9k+eyZ5LtpNZsOEIKGkvh/6OZYZdv8=;
	b=X1Gr+rXRBNY8KfJj58d1eOu0Ely/8v+lAHpKHlJ3q3SeRYhodTtrkGWVBDq618DKLgnmmRrYXDxA4OpZHmOujjiQc1TgAYnvHVr8bhOHKMF7uzmHkWfCkbfU9dTritL8xScpIOEpOEyDFRL799I1YxSJi4CQsSSODuRXQuhWNFw=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938434088319.84511075532464;
 Wed, 11 Dec 2024 09:33:54 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVk-0008Jh-Hg; Wed, 11 Dec 2024 12:28:32 -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 <berrange@redhat.com>)
 id 1tLQVU-0007h1-HS
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:16 -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 <berrange@redhat.com>)
 id 1tLQVT-0001HA-5h
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28: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-436-nFeby-7cMNiRsK8WTBzxcg-1; Wed,
 11 Dec 2024 12:28: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS
 id 4D7FF1954211; Wed, 11 Dec 2024 17:28:10 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 8247F1956048; Wed, 11 Dec 2024 17:28:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938094;
 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=Vhq5UCMuSErzt9k+eyZ5LtpNZsOEIKGkvh/6OZYZdv8=;
 b=T6dIFl4uRqSyWIUmAJsROvIX5zXLj1r6qZE8jd8kR1BuVQP/Pt1MGAHXM3JB1DkSLgjOEw
 HgWw53dgJkwrijv9mWClYFn4+oTHvHw9IFmpfJzH65ixS/JEfES5d/3gdAHCfz1F4BLrKD
 abXJMlDeERNyMDi0RSu3L1A3DE4fY9M=
X-MC-Unique: nFeby-7cMNiRsK8WTBzxcg-1
X-Mimecast-MFC-AGG-ID: nFeby-7cMNiRsK8WTBzxcg
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 27/31] tests/functional: drop back compat imports from
 utils.py
Date: Wed, 11 Dec 2024 17:26:43 +0000
Message-ID: <20241211172648.2893097-28-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938434573116600

Now that all tests are converted over to the higher level wrapper
functions, the back compat imports from utils.py are redundant.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/utils.py | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te=
st/utils.py
index 6b87af4414..43853b4366 100644
--- a/tests/functional/qemu_test/utils.py
+++ b/tests/functional/qemu_test/utils.py
@@ -10,11 +10,6 @@
=20
 import os
=20
-from .archive import tar_extract as archive_extract
-from .archive import cpio_extract
-from .uncompress import gzip_uncompress
-from .uncompress import lzma_uncompress
-
 """
 Round up to next power of 2
 """
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938128; cv=none;
	d=zohomail.com; s=zohoarc;
	b=KTmIf4XVOTKPkUddqbaqORKAyiqxISUbkafv7zFZqUhidFlnzLiSfcdIR7DWgZrLLclAHpn5rG8FBVL1Sr8a003nKNw9MaIgxqYlX+1E32GKkeAW94HeDItB6bY8SmlGNR4uTMb6rDwG9LXWTmpIm4+J5KqMDuATMalA2k45akE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938128;
 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=vOzKQVZOZ/+VHfbCjlSNMjVwOIJdTjM8Ad+SBr+PYYM=;
	b=QoNUSYV5XcvcYXAUoi30l8g5oHInVSXCErpUYcrMdVS0hAushLopERNbEv/a/Grb44u6/uJjiL0aPFiwsCyamRbiM93Dns8I24EhbklcA1LnLvu054SsVswUjpmEac17FXghbb7vEiDhXy31O5Y/Rrsx/kF0QJ130yGaQyHGdLc=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938128735292.0346940449215;
 Wed, 11 Dec 2024 09:28:48 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVb-0007zO-4p; Wed, 11 Dec 2024 12:28:24 -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 <berrange@redhat.com>)
 id 1tLQVV-0007ot-P9
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28: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 <berrange@redhat.com>)
 id 1tLQVT-0001HK-Of
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:17 -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-537-EqKv7I7pMEC2plRUdzKD8w-1; Wed,
 11 Dec 2024 12:28:13 -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 BAFBD19560B6; Wed, 11 Dec 2024 17:28:12 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id ACA881956048; Wed, 11 Dec 2024 17:28:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938095;
 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=vOzKQVZOZ/+VHfbCjlSNMjVwOIJdTjM8Ad+SBr+PYYM=;
 b=hx6kyS0NfWIe41F+VUatgbONjt/aVS0pHlETk99firvgAcXxXOx6o6goYDMX/HJ3GVBziI
 4Kh5ol3qD4pN9LsGHdTnTHfH/7hdF2PtgmRElKN4nXg3q7qNkJMR2rZwrecPQX2OIpDKZF
 narkvw+x8sYHSVccdwLHX/mSTQsLZsQ=
X-MC-Unique: EqKv7I7pMEC2plRUdzKD8w-1
X-Mimecast-MFC-AGG-ID: EqKv7I7pMEC2plRUdzKD8w
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 28/31] tests/functional: replace 'run_cmd' with subprocess
 helpers
Date: Wed, 11 Dec 2024 17:26:44 +0000
Message-ID: <20241211172648.2893097-29-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938129560116600

The 'run_cmd' helper is re-implementing a convenient helper that
already exists in the form of the 'run' and 'check_call' methods
provided by 'subprocess'.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/archive.py    |  9 ++++---
 tests/functional/qemu_test/tesseract.py  | 10 ++++----
 tests/functional/qemu_test/testcase.py   | 31 +++++++++++++-----------
 tests/functional/qemu_test/tuxruntest.py |  8 +++---
 tests/functional/test_aarch64_virt.py    |  6 +++--
 tests/functional/test_ppc64_tuxrun.py    |  7 ++++--
 6 files changed, 41 insertions(+), 30 deletions(-)

diff --git a/tests/functional/qemu_test/archive.py b/tests/functional/qemu_=
test/archive.py
index c439d9413a..c803fdaf6d 100644
--- a/tests/functional/qemu_test/archive.py
+++ b/tests/functional/qemu_test/archive.py
@@ -14,7 +14,6 @@
 import zipfile
=20
 from .asset import Asset
-from .cmd import run_cmd
=20
=20
 def tar_extract(archive, dest_dir, member=3DNone):
@@ -52,9 +51,11 @@ 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])
+        proc =3D run(['ar', 't', archive],
+                   check=3DTrue, capture_output=3DTrue, encoding=3D'utf8')
+        file_path =3D proc.stdout.split()[2]
+        check_call(['ar', 'x', archive, file_path],
+                   stdout=3DDEVNULL, stderr=3DDEVNULL)
         tar_extract(file_path, dest_dir, member)
     finally:
         os.chdir(cwd)
diff --git a/tests/functional/qemu_test/tesseract.py b/tests/functional/qem=
u_test/tesseract.py
index 1b7818090a..ede6c6501e 100644
--- a/tests/functional/qemu_test/tesseract.py
+++ b/tests/functional/qemu_test/tesseract.py
@@ -6,18 +6,18 @@
 # later. See the COPYING file in the top-level directory.
=20
 import logging
+from subprocess import run
=20
-from . import run_cmd
=20
 def tesseract_ocr(image_path, tesseract_args=3D''):
     console_logger =3D logging.getLogger('console')
     console_logger.debug(image_path)
-    (stdout, stderr, ret) =3D run_cmd(['tesseract', image_path,
-                                     'stdout'])
-    if ret:
+    proc =3D run(['tesseract', image_path, 'stdout'],
+               capture_output=3DTrue, encoding=3D'utf8')
+    if proc.returncode:
         return None
     lines =3D []
-    for line in stdout.split('\n'):
+    for line in proc.stdout.split('\n'):
         sline =3D line.strip()
         if len(sline):
             console_logger.debug(sline)
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu=
_test/testcase.py
index 684c94d45f..7bece8738a 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -16,7 +16,7 @@
 from pathlib import Path
 import pycotap
 import shutil
-import subprocess
+from subprocess import run
 import sys
 import tempfile
 import unittest
@@ -27,7 +27,6 @@
=20
 from .archive import archive_extract
 from .asset import Asset
-from .cmd import run_cmd
 from .config import BUILD_DIR
 from .uncompress import uncompress
=20
@@ -251,11 +250,11 @@ def add_ldpath(self, ldpath):
         self._ldpath.append(os.path.abspath(ldpath))
=20
     def run_cmd(self, bin_path, args=3D[]):
-        return subprocess.run([self.qemu_bin]
-                              + ["-L %s" % ldpath for ldpath in self._ldpa=
th]
-                              + [bin_path]
-                              + args,
-                              text=3DTrue, capture_output=3DTrue)
+        return run([self.qemu_bin]
+                   + ["-L %s" % ldpath for ldpath in self._ldpath]
+                   + [bin_path]
+                   + args,
+                   text=3DTrue, capture_output=3DTrue)
=20
 class QemuSystemTest(QemuBaseTest):
     """Facilitates system emulation tests."""
@@ -282,7 +281,9 @@ def setUp(self):
     def set_machine(self, machinename):
         # TODO: We should use QMP to get the list of available machines
         if not self._machinehelp:
-            self._machinehelp =3D run_cmd([self.qemu_bin, '-M', 'help'])[0=
];
+            self._machinehelp =3D run(
+                [self.qemu_bin, '-M', 'help'],
+                capture_output=3DTrue, check=3DTrue, encoding=3D'utf8').st=
dout
         if self._machinehelp.find(machinename) < 0:
             self.skipTest('no support for machine ' + machinename)
         self.machine =3D machinename
@@ -310,15 +311,17 @@ def require_accelerator(self, accelerator):
                           "available" % accelerator)
=20
     def require_netdev(self, netdevname):
-        netdevhelp =3D run_cmd([self.qemu_bin,
-                             '-M', 'none', '-netdev', 'help'])[0];
-        if netdevhelp.find('\n' + netdevname + '\n') < 0:
+        help =3D run([self.qemu_bin,
+                    '-M', 'none', '-netdev', 'help'],
+                   capture_output=3DTrue, check=3DTrue, encoding=3D'utf8')=
.stdout;
+        if help.find('\n' + netdevname + '\n') < 0:
             self.skipTest('no support for " + netdevname + " networking')
=20
     def require_device(self, devicename):
-        devhelp =3D run_cmd([self.qemu_bin,
-                           '-M', 'none', '-device', 'help'])[0];
-        if devhelp.find(devicename) < 0:
+        help =3D run([self.qemu_bin,
+                    '-M', 'none', '-device', 'help'],
+                   capture_output=3DTrue, check=3DTrue, encoding=3D'utf8')=
.stdout;
+        if help.find(devicename) < 0:
             self.skipTest('no support for device ' + devicename)
=20
     def _new_vm(self, name, *args):
diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qe=
mu_test/tuxruntest.py
index 0b1bb8f0ed..7227a83757 100644
--- a/tests/functional/qemu_test/tuxruntest.py
+++ b/tests/functional/qemu_test/tuxruntest.py
@@ -11,11 +11,12 @@
=20
 import os
 import stat
+from subprocess import check_call, DEVNULL
=20
 from qemu_test import QemuSystemTest
 from qemu_test import exec_command_and_wait_for_pattern
 from qemu_test import wait_for_console_pattern
-from qemu_test import which, run_cmd, get_qemu_img
+from qemu_test import which, get_qemu_img
=20
 class TuxRunBaselineTest(QemuSystemTest):
=20
@@ -76,8 +77,9 @@ def fetch_tuxrun_assets(self, kernel_asset, rootfs_asset,=
 dtb_asset=3DNone):
=20
         disk_image =3D self.scratch_file("rootfs.ext4")
=20
-        run_cmd(['zstd', "-f", "-d", disk_image_zst,
-                 "-o", disk_image])
+        check_call(['zstd', "-f", "-d", disk_image_zst,
+                    "-o", disk_image],
+                   stdout=3DDEVNULL, stderr=3DDEVNULL)
         # zstd copies source archive permissions for the output
         # file, so must make this writable for QEMU
         os.chmod(disk_image, stat.S_IRUSR | stat.S_IWUSR)
diff --git a/tests/functional/test_aarch64_virt.py b/tests/functional/test_=
aarch64_virt.py
index cc49f8963d..08576b0694 100755
--- a/tests/functional/test_aarch64_virt.py
+++ b/tests/functional/test_aarch64_virt.py
@@ -12,10 +12,11 @@
=20
 import time
 import logging
+from subprocess import check_call, DEVNULL
=20
 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 get_qemu_img
=20
=20
 class Aarch64VirtMachine(QemuSystemTest):
@@ -96,7 +97,8 @@ def common_aarch64_virt(self, machine):
         logger.info('creating scratch qcow2 image')
         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'])
+        check_call([qemu_img, 'create', '-f', 'qcow2', image_path, '8M'],
+                   stdout=3DDEVNULL, stderr=3DDEVNULL)
=20
         # Add the device
         self.vm.add_args('-blockdev',
diff --git a/tests/functional/test_ppc64_tuxrun.py b/tests/functional/test_=
ppc64_tuxrun.py
index 03b47e07f2..8a98d18ab3 100755
--- a/tests/functional/test_ppc64_tuxrun.py
+++ b/tests/functional/test_ppc64_tuxrun.py
@@ -11,9 +11,10 @@
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
=20
+from subprocess import check_call, DEVNULL
 import tempfile
=20
-from qemu_test import run_cmd, Asset
+from qemu_test import Asset
 from qemu_test.tuxruntest import TuxRunBaselineTest
=20
 class TuxRunPPC64Test(TuxRunBaselineTest):
@@ -70,7 +71,9 @@ def ppc64_common_tuxrun(self, kernel_asset, rootfs_asset,=
 prefix):
         # Create a temporary qcow2 and launch the test-case
         with tempfile.NamedTemporaryFile(prefix=3Dprefix,
                                          suffix=3D'.qcow2') as qcow2:
-            run_cmd([self.qemu_img, 'create', '-f', 'qcow2', qcow2.name, '=
 1G'])
+            check_call([self.qemu_img, 'create', '-f', 'qcow2',
+                        qcow2.name, ' 1G'],
+                       stdout=3DDEVNULL, stderr=3DDEVNULL)
=20
             self.vm.add_args('-drive', 'file=3D' + qcow2.name +
                          ',format=3Dqcow2,if=3Dnone,id=3D'
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938338; cv=none;
	d=zohomail.com; s=zohoarc;
	b=MCdlg9vCKn3Yf26hnIGX9mSBo6JhXJXy9OFuAuqrSesYbJrF4k7xvq5ATwQGdY1K7nc3sxh4EAkgf/ikU0fUqxk/sXRdvoij/lDv5Mhk7iCoolCQdnaSSL96XQvkvxJlhzzSX7UjnufhFl74M0Eb7A9grPA9LQrNCxHdFNaMUyQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938338;
 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=KQGI40MtBxhldG8cyDQWKABUKEKka80gIvP1a2++EW8=;
	b=gBQ7lecBAAyjL2WFQw5PgDE/5RJ0d+R6aak3p/ZssjXl+2jNxukLiqKBBLpFRIWcg8PeiSRLMAOD9kgMsFD5+tcRkD694P64w1bhnuemHJuy9yEODsJMLa+DrHGJqPyEhR0Vxb7hMYehsrbIeDYZ4wdDoZaLuh1hj3k8xWZnQnE=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938338511109.65722857182914;
 Wed, 11 Dec 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 <qemu-devel-bounces@nongnu.org>)
	id 1tLQVk-0008Cj-Ez; Wed, 11 Dec 2024 12:28:32 -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 <berrange@redhat.com>)
 id 1tLQVZ-00080P-Sm
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:22 -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 <berrange@redhat.com>)
 id 1tLQVY-0001Hg-8i
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:21 -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-653-J9byPsOWPhaZCeTlQvNCHw-1; Wed,
 11 Dec 2024 12:28:16 -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 681441955F39; Wed, 11 Dec 2024 17:28:15 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 57C0F1956048; Wed, 11 Dec 2024 17:28:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938099;
 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=KQGI40MtBxhldG8cyDQWKABUKEKka80gIvP1a2++EW8=;
 b=WeWtUtP4iZY5S6NeOaP+vXevtnXy8c3ZuwS5lIgHcMH1rIElh3gJaBGCE0Y5c5d0qIPdHQ
 eQqWg1Zg3DMwQoHLFR27b2YYYZD6/Iv3p+mALVdmHt/z+FwfX0pXFQcGvmQdxQKjijsuQK
 pppLJuFSTWslZEmepZMmGamX9Ovp/1w=
X-MC-Unique: J9byPsOWPhaZCeTlQvNCHw-1
X-Mimecast-MFC-AGG-ID: J9byPsOWPhaZCeTlQvNCHw
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 29/31] tests/functional: remove now unused 'run_cmd' helper
Date: Wed, 11 Dec 2024 17:26:45 +0000
Message-ID: <20241211172648.2893097-30-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938340270116600

All usage has been replaced by direct 'subprocess' helpers.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/__init__.py |  2 +-
 tests/functional/qemu_test/cmd.py      | 11 -----------
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu=
_test/__init__.py
index 3bd043e608..da1830286d 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -8,7 +8,7 @@
=20
 from .asset import Asset
 from .config import BUILD_DIR
-from .cmd import run_cmd, is_readable_executable_file, \
+from .cmd import is_readable_executable_file, \
     interrupt_interactive_console_until_pattern, wait_for_console_pattern,=
 \
     exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
 from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test=
/cmd.py
index c8971de00a..dc5f422b77 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -14,7 +14,6 @@
 import logging
 import os
 import os.path
-import subprocess
=20
=20
 def which(tool):
@@ -28,16 +27,6 @@ def which(tool):
             return p
     return None
=20
-def run_cmd(args):
-    subp =3D subprocess.Popen(args,
-                            stdout=3Dsubprocess.PIPE,
-                            stderr=3Dsubprocess.PIPE,
-                            universal_newlines=3DTrue)
-    stdout, stderr =3D subp.communicate()
-    ret =3D subp.returncode
-
-    return (stdout, stderr, ret)
-
 def is_readable_executable_file(path):
     return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
=20
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938424; cv=none;
	d=zohomail.com; s=zohoarc;
	b=haLlBblbHnG0ybvqjST/Ml7iDMOmu1WdcXa+AM23BJuqa71W5iWQnDqjNDtfjI3IJwpS9FpaA8V8v3cjM39DpwAJKUmiqCfYqtaVq+TFASYZBDh/ueWOYOXQld8R1a2V8SIkqeKwMgGTfy0OayJZ2Hk+LZ2f7/0wvZhbigOML7w=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938424;
 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=2B9efyg/XJXnrAr7NcVHk3DmFD/z/92OgMGMRhNIwOQ=;
	b=czUaRvs3xrAYYJdK3/KzoT8+sfW+7R5GGBZzMEXOrm01ZvcaAckMiKkzxcTXqOqbd12c/03RK+mqFhbePYL7PrMgjwNdrtU/VG71U3GlT5akauzePsU5aNwtLZ3CwEqdyL6q+e4uTfao9s7lRs2apbkW6GOpU4ca/QjG/2qGJww=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938424951846.0644904228589;
 Wed, 11 Dec 2024 09:33:44 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVk-0008Hh-Ei; Wed, 11 Dec 2024 12:28:32 -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 <berrange@redhat.com>)
 id 1tLQVb-00082l-CQ
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28: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 <berrange@redhat.com>)
 id 1tLQVZ-0001Hl-Q7
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:23 -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-272-9PgO28wZOmOYtQwpVDbfbA-1; Wed,
 11 Dec 2024 12:28:19 -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 092DF1955D86; Wed, 11 Dec 2024 17:28:18 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 09E3F1956052; Wed, 11 Dec 2024 17:28:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938101;
 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=2B9efyg/XJXnrAr7NcVHk3DmFD/z/92OgMGMRhNIwOQ=;
 b=TxNv3augt6RJJzmcFWF/kKc87ez082duLLnMyWGfwnoXGn43gLWe7ykvE9gSd053ccKWfl
 X/miXF0nx+0HUsKIvbY1FiXy20g0cNRqvBIEKXgVl9DO9qEb7qoFWcRRBtgcouIZZJxUMm
 McEpRDHIbS6VUK4dFHf/unlx320BrO4=
X-MC-Unique: 9PgO28wZOmOYtQwpVDbfbA-1
X-Mimecast-MFC-AGG-ID: 9PgO28wZOmOYtQwpVDbfbA
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 30/31] tests/functional: skip tests if assets are not
 available
Date: Wed, 11 Dec 2024 17:26:46 +0000
Message-ID: <20241211172648.2893097-31-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938426616116600

If downloading of assets has been disabled, then skip running a
test if the assets it has registered are not already downloaded.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/asset.py    |  8 +++++++-
 tests/functional/qemu_test/testcase.py | 11 +++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_te=
st/asset.py
index c5d3e73c4b..39832b2587 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -65,6 +65,12 @@ def _check(self, cache_file):
     def valid(self):
         return self.cache_file.exists() and self._check(self.cache_file)
=20
+    def fetchable(self):
+        return not os.environ.get("QEMU_TEST_NO_DOWNLOAD", False)
+
+    def available(self):
+        return self.valid() or self.fetchable()
+
     def _wait_for_other_download(self, tmp_cache_file):
         # Another thread already seems to download the asset, so wait until
         # it is done, while also checking the size to see whether it is st=
uck
@@ -103,7 +109,7 @@ def fetch(self):
                            self.cache_file, self.url)
             return str(self.cache_file)
=20
-        if os.environ.get("QEMU_TEST_NO_DOWNLOAD", False):
+        if not self.fetchable():
             raise Exception("Asset cache is invalid and downloads disabled=
")
=20
         self.log.info("Downloading %s to %s...", self.url, self.cache_file)
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu=
_test/testcase.py
index 7bece8738a..6c67a9459c 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -184,6 +184,14 @@ def scratch_file(self, *args):
     def log_file(self, *args):
         return str(Path(self.outputdir, *args))
=20
+    def assets_available(self):
+        for name, asset in vars(self.__class__).items():
+            if name.startswith("ASSET_") and type(asset) =3D=3D Asset:
+                if not asset.available():
+                    self.log.debug(f"Asset {asset.url} not available")
+                    return False
+        return True
+
     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]
@@ -209,6 +217,9 @@ def setUp(self, bin_prefix):
         self.machinelog.setLevel(logging.DEBUG)
         self.machinelog.addHandler(self._log_fh)
=20
+        if not self.assets_available():
+            self.skipTest('One or more assets is not available')
+
     def tearDown(self):
         if "QEMU_TEST_KEEP_SCRATCH" not in os.environ:
             shutil.rmtree(self.workdir)
--=20
2.46.0


From nobody Fri May  9 15:16:40 2025
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=1733938382; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Kcw2cvEIABdBjadovZVxH+sOMA1IdGLqvyJF86bh/32au9bt20NStxqWmFAHxKW6/rt8rx3fP5M5Mra2n0DsVDadj6B9EoVMBa8f9rcQDhiHGSibaDqzRIebm6QGzfie/T38Y7okaOXvb9qXTLtnr655Rb+RxdhC+e87uLq4ZHo=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1733938382;
 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=Dbk0iGQiY7GXvpl15dvjY7TjSGw5954t/S6EZF9IGYA=;
	b=d70TPQT/mR2Ztc3uVlaplPYfM3bjhP+u8K7IrqkNdgcjJdywt+SO8KUOW9MsLGW6ZsSzeQ/TM5QxS2jLkMr0TDJgcJCB34uLArnw3N/PSObz7QdLyLNNZhGwaK9npxiFzmVHdca1/XWViV9GV+tdlfy9J3livSMKbuGi2sc4tWU=
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=<berrange@redhat.com> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1733938382381431.86865917953924;
 Wed, 11 Dec 2024 09:33:02 -0800 (PST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces@nongnu.org>)
	id 1tLQVl-0008RV-WA; Wed, 11 Dec 2024 12:28:34 -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 <berrange@redhat.com>)
 id 1tLQVe-0008BH-Sa
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:28 -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 <berrange@redhat.com>)
 id 1tLQVd-0001I5-Is
 for qemu-devel@nongnu.org; Wed, 11 Dec 2024 12:28:26 -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-117-fnB_8M3ZPPmesj-F2gDr1g-1; Wed,
 11 Dec 2024 12:28:21 -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 9E6BC1955D4E; Wed, 11 Dec 2024 17:28:20 +0000 (UTC)
Received: from toolbox.redhat.com (unknown [10.42.28.49])
 by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP
 id 8E47B1956048; Wed, 11 Dec 2024 17:28:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1733938104;
 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=Dbk0iGQiY7GXvpl15dvjY7TjSGw5954t/S6EZF9IGYA=;
 b=HAkaYL2n6B2hJkFAsUnd2aE4jGVxtvaUzH9xh3pQvL1bhiPDlL5eQFO0qFrQnKNyTiONl/
 1jrqETaFAS5ijLtcMYvsIPnlzWWj/3Ic4ZsMCyE1wYHdM3+xnln1qMjweeUvniPKZlRFfS
 99WoMx7WxHThD4eympV7s8k6Giu7Amc=
X-MC-Unique: fnB_8M3ZPPmesj-F2gDr1g-1
X-Mimecast-MFC-AGG-ID: fnB_8M3ZPPmesj-F2gDr1g
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>,
 =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>,
 Thomas Huth <huth@tuxfamily.org>,
 =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Subject: [PATCH v2 31/31] tests/functional: ignore errors when caching assets,
 except for 404
Date: Wed, 11 Dec 2024 17:26:47 +0000
Message-ID: <20241211172648.2893097-32-berrange@redhat.com>
In-Reply-To: <20241211172648.2893097-1-berrange@redhat.com>
References: <20241211172648.2893097-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: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.472,
 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.001,
 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=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: 1733938384343116600

We see periodic errors caching assets due to a combination of transient
networking and server problems. With the previous patch to skip running
a test when it has missing assets, we can now treat most cache download
errors as non-fatal.

Only HTTP 404 is retained as fatal, since it is a strong indicator of
a fully broken test rather than a transient error.

Signed-off-by: Daniel P. Berrang=C3=A9 <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/asset.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_te=
st/asset.py
index 39832b2587..f0730695f0 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -15,6 +15,7 @@
 from time import sleep
 from pathlib import Path
 from shutil import copyfileobj
+from urllib.error import HTTPError
=20
=20
 # Instances of this class must be declared as class level variables
@@ -170,7 +171,18 @@ def precache_test(test):
         for name, asset in vars(test.__class__).items():
             if name.startswith("ASSET_") and type(asset) =3D=3D Asset:
                 log.info("Attempting to cache '%s'" % asset)
-                asset.fetch()
+                try:
+                    asset.fetch()
+                except HTTPError as e:
+                    # Treat 404 as fatal, since it is highly likely to
+                    # indicate a broken test rather than a transient
+                    # server or networking problem
+                    if e.code =3D=3D 404:
+                        raise
+
+                    log.debug(f"HTTP error {e.code} from {asset.url} " +
+                              "skipping asset precache")
+
         log.removeHandler(handler)
=20
     def precache_suite(suite):
--=20
2.46.0