qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"John Snow" <jsnow@redhat.com>, "Cédric Le Goater" <clg@kaod.org>,
	"Fabiano Rosas" <farosas@suse.de>
Subject: Re: [PATCH 10/11] tests/functional: Convert the s390x avocado tests into standalone tests
Date: Tue, 16 Jul 2024 19:24:21 +0100	[thread overview]
Message-ID: <Zpa61bWr-ojr50Vi@redhat.com> (raw)
In-Reply-To: <20240716112614.1755692-11-thuth@redhat.com>

On Tue, Jul 16, 2024 at 01:26:13PM +0200, Thomas Huth wrote:
> These tests use archive.lzma_uncompress() from the Avocado utils,
> so provide a small helper function for this, based on the
> standard lzma module from Python instead.
> 
> And while we're at it, replace the MD5 hashes in the topology test
> with proper SHA256 hashes, since MD5 should not be used anymore
> nowadays.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  MAINTAINERS                                   |  4 +-
>  tests/functional/meson.build                  |  6 ++
>  tests/functional/qemu_test/utils.py           |  7 ++
>  .../test_s390x_ccw_virtio.py}                 | 32 ++++-----
>  .../test_s390x_topology.py}                   | 70 +++++++------------
>  5 files changed, 52 insertions(+), 67 deletions(-)
>  rename tests/{avocado/machine_s390_ccw_virtio.py => functional/test_s390x_ccw_virtio.py} (95%)
>  mode change 100644 => 100755
>  rename tests/{avocado/s390_topology.py => functional/test_s390x_topology.py} (90%)
>  mode change 100644 => 100755
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 025227954c..cbefb6fb81 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1739,7 +1739,7 @@ S: Supported
>  F: hw/s390x/
>  F: include/hw/s390x/
>  F: configs/devices/s390x-softmmu/default.mak
> -F: tests/avocado/machine_s390_ccw_virtio.py
> +F: tests/functional/test_s390x_ccw_virtio.py
>  T: git https://github.com/borntraeger/qemu.git s390-next
>  L: qemu-s390x@nongnu.org
>  
> @@ -1802,7 +1802,7 @@ F: hw/s390x/cpu-topology.c
>  F: target/s390x/kvm/stsi-topology.c
>  F: docs/devel/s390-cpu-topology.rst
>  F: docs/system/s390x/cpu-topology.rst
> -F: tests/avocado/s390_topology.py
> +F: tests/functional/test_s390x_topology.py
>  
>  X86 Machines
>  ------------
> diff --git a/tests/functional/meson.build b/tests/functional/meson.build
> index c8fc9f6c07..f6de9af8a2 100644
> --- a/tests/functional/meson.build
> +++ b/tests/functional/meson.build
> @@ -13,6 +13,7 @@ endif
>  test_timeouts = {
>    'netdev_ethtool' : 180,
>    'ppc_74xx' : 90,
> +  's390x_ccw_virtio' : 180,
>  }
>  
>  tests_generic = [
> @@ -47,6 +48,11 @@ tests_ppc_thorough = [
>    'ppc_bamboo',
>  ]
>  
> +tests_s390x_thorough = [
> +  's390x_ccw_virtio',
> +  's390x_topology',
> +]
> +
>  tests_sparc64_thorough = [
>    'sparc64_sun4u',
>  ]
> diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_test/utils.py
> index 4eb5e5d5e5..8115d9d1da 100644
> --- a/tests/functional/qemu_test/utils.py
> +++ b/tests/functional/qemu_test/utils.py
> @@ -8,6 +8,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.
>  
> +import lzma
> +import shutil
>  import tarfile
>  
>  def archive_extract(archive, dest_dir, member=None):
> @@ -19,3 +21,8 @@ def archive_extract(archive, dest_dir, member=None):
>              tf.extract(member=member, path=dest_dir)
>          else:
>              tf.extractall(path=dest_dir)
> +
> +def lzma_uncompress(xz_path, output_path):
> +    with lzma.open(xz_path, 'rb') as lzma_in:
> +        with open(output_path, 'wb') as raw_out:
> +            shutil.copyfileobj(lzma_in, raw_out)

Avocado short-circuited if output_path already existed
for speed. Worth doing the same.

The inner 'with' should be surrounded by a try/except
that does os.remove(output_path) on error. Avocado
didn't have this safety net either, but we should add
it.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2024-07-16 18:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16 11:26 [PATCH v1 00/11] Convert avocado tests to normal Python unittests Thomas Huth
2024-07-16 11:26 ` [PATCH 01/11] tests/functional: Add base classes for the upcoming pytest-based tests Thomas Huth
2024-07-16 11:26 ` [PATCH 02/11] tests/functional: Convert simple avocado tests into standalone python tests Thomas Huth
2024-07-16 18:14   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 03/11] tests/functional: Convert avocado tests that just need a small adjustment Thomas Huth
2024-07-16 18:15   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 04/11] tests/functional: Add python-based tests to the meson build system Thomas Huth
2024-07-16 15:15   ` Fabiano Rosas
2024-07-17  9:20     ` Thomas Huth
2024-07-16 16:55   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 05/11] tests/functional: Implement fetch_asset() method for downloading assets Thomas Huth
2024-07-16 18:17   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 06/11] tests/functional: Convert some tests that download files via fetch_asset() Thomas Huth
2024-07-16 18:19   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 07/11] tests/functional: Add a function for extracting files from an archive Thomas Huth
2024-07-16 18:20   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 08/11] tests/functional: Convert some avocado tests that needed avocado.utils.archive Thomas Huth
2024-07-16 18:20   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 09/11] tests/functional: Set up logging Thomas Huth
2024-07-16 18:22   ` Daniel P. Berrangé
2024-07-16 11:26 ` [PATCH 10/11] tests/functional: Convert the s390x avocado tests into standalone tests Thomas Huth
2024-07-16 18:24   ` Daniel P. Berrangé [this message]
2024-07-16 11:26 ` [PATCH 11/11] gitlab-ci: Add "check-functional" to the build tests Thomas Huth
2024-07-16 18:25   ` Daniel P. Berrangé
2024-07-16 16:51 ` [PATCH v1 00/11] Convert avocado tests to normal Python unittests Daniel P. Berrangé
2024-07-16 17:03   ` Thomas Huth
2024-07-17  8:04     ` Thomas Huth
2024-07-17  8:37       ` Daniel P. Berrangé
2024-07-17  8:53         ` Thomas Huth
2024-07-16 17:57 ` Paolo Bonzini
2024-07-24 11:43   ` Thomas Huth
2024-07-25 14:21 ` Cleber Rosa
2024-07-26 10:07   ` Thomas Huth
2024-07-26 13:56     ` Cleber Rosa
2024-07-29 12:44   ` Daniel P. Berrangé
2024-07-29 14:01     ` Cleber Rosa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zpa61bWr-ojr50Vi@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=anisinha@redhat.com \
    --cc=clg@kaod.org \
    --cc=farosas@suse.de \
    --cc=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).