qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Beraldo Leal" <bleal@redhat.com>,
	"Ed Maste" <emaste@freebsd.org>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	qemu-ppc@nongnu.org, "John Snow" <jsnow@redhat.com>,
	"Radoslaw Biernacki" <rad@semihalf.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Leif Lindholm" <quic_llindhol@quicinc.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Bin Meng" <bmeng.cn@gmail.com>,
	"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	qemu-riscv@nongnu.org,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	qemu-s390x@nongnu.org,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Weiwei Li" <liwei1518@gmail.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	qemu-arm@nongnu.org, "Li-Wen Hsu" <lwhsu@freebsd.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Joel Stanley" <joel@jms.id.au>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Bernhard Beschow" <shentey@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v3 19/29] tests/functional: add zstd support to uncompress utility
Date: Wed, 8 Jan 2025 07:41:55 +0100	[thread overview]
Message-ID: <b7618b1d-a48d-459d-9768-40830c866560@redhat.com> (raw)
In-Reply-To: <20250107165208.743958-20-alex.bennee@linaro.org>

On 07/01/2025 17.51, Alex Bennée wrote:
> Rather than using the python library (which has a different API
> anyway) lets just call the binary. zstdtools is already in out
> qemu.yml so all test containers should have it around. Tests should
> still use @skipIfMissingCommands('zstd') to gracefully handle when
> only minimal dependencies have been installed.

Thanks, sounds like a good idea to have a common function for this. Just a 
comment below...

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   tests/functional/qemu_test/uncompress.py | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/tests/functional/qemu_test/uncompress.py b/tests/functional/qemu_test/uncompress.py
> index 6d02ded066..404eee1f83 100644
> --- a/tests/functional/qemu_test/uncompress.py
> +++ b/tests/functional/qemu_test/uncompress.py
> @@ -12,6 +12,7 @@
>   import os
>   import shutil
>   from urllib.parse import urlparse
> +from subprocess import check_call, CalledProcessError
>   
>   from .asset import Asset
>   
> @@ -38,6 +39,18 @@ def lzma_uncompress(xz_path, output_path):
>               os.remove(output_path)
>               raise
>   
> +def zstd_uncompress(zstd_path, output_path):
> +    if os.path.exists(output_path):
> +        return
> +
> +    try:
> +        check_call(['zstd', "-f", "-d", zstd_path,
> +                    "-o", output_path])
> +    except CalledProcessError as e:
> +        os.remove(output_path)
> +        raise Exception(
> +            f"Unable to decompress zstd file {zstd_path} with {e}") from e

In tests/functional/qemu_test/tuxruntest.py we had to add a

   os.chmod(..., stat.S_IRUSR | stat.S_IWUSR)

to make sure that the write-protected compressed assets are usable 
afterwards... Would it make sense to add this here, too, so that the callers 
don't have to do it on their own?

Also, could you maybe change tests/functional/qemu_test/tuxruntest.py 
accordingly to use this new function here?

  Thanks,
   Thomas


>   '''
>   @params compressed: filename, Asset, or file-like object to uncompress
>   @params uncompressed: filename to uncompress into
> @@ -59,6 +72,8 @@ def uncompress(compressed, uncompressed, format=None):
>           lzma_uncompress(str(compressed), uncompressed)
>       elif format == "gz":
>           gzip_uncompress(str(compressed), uncompressed)
> +    elif format == "zstd":
> +        zstd_uncompress(str(compressed), uncompressed)
>       else:
>           raise Exception(f"Unknown compression format {format}")
>   
> @@ -79,5 +94,7 @@ def guess_uncompress_format(compressed):
>           return "xz"
>       elif ext == ".gz":
>           return "gz"
> +    elif ext == ".zstd":
> +        return "zstd"
>       else:
>           raise Exception(f"Unknown compression format for {compressed}")



  reply	other threads:[~2025-01-08  6:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 16:51 [PATCH v3 00/29] testing/next: functional tests, qtest clocks, vm and keymaps (pre-PR) Alex Bennée
2025-01-07 16:51 ` [PATCH v3 01/29] tests/functional: update the arm tuxrun tests Alex Bennée
2025-01-07 16:51 ` [PATCH v3 02/29] tests/functional: update the i386 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 03/29] tests/functional: add a m68k " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 04/29] tests/functional: update the mips32 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 05/29] tests/functional: update the mips32el " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 06/29] tests/functional: update the mips64 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 07/29] tests/functional: update the mips64el " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 08/29] tests/functional: update the ppc32 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 09/29] tests/functional: update the ppc64 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 10/29] tests/functional: update the riscv32 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 11/29] tests/functional: update the riscv64 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 12/29] tests/functional: update the s390x " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 13/29] tests/functional: update the sparc64 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 14/29] tests/functional: update the x86_64 " Alex Bennée
2025-01-07 16:51 ` [PATCH v3 15/29] tests/functional/aarch64: add tests for FEAT_RME Alex Bennée
2025-01-07 16:51 ` [PATCH v3 16/29] tests/qtest: remove clock_steps from virtio tests Alex Bennée
2025-01-07 20:12   ` Fabiano Rosas
2025-01-07 16:51 ` [PATCH v3 17/29] system/qtest: properly feedback results of clock_[step|set] Alex Bennée
2025-01-07 16:51 ` [PATCH v3 18/29] tests/functional: remove hacky sleep from the tests Alex Bennée
2025-01-07 16:51 ` [PATCH v3 19/29] tests/functional: add zstd support to uncompress utility Alex Bennée
2025-01-08  6:41   ` Thomas Huth [this message]
2025-01-07 16:51 ` [PATCH v3 20/29] tests/functional: extend test_aarch64_virt with vulkan test Alex Bennée
2025-01-08  7:03   ` Thomas Huth
2025-01-07 16:51 ` [PATCH v3 21/29] tests/lcitool: bump to latest version of libvirt-ci Alex Bennée
2025-01-07 16:52 ` [PATCH v3 22/29] tests/docker: move riscv64 cross container from sid to trixie Alex Bennée
2025-01-07 16:52 ` [PATCH v3 23/29] tests/lcitool: remove temp workaround for debian mips64el Alex Bennée
2025-01-07 16:52 ` [PATCH v3 24/29] tests/vm: fix build_path based path Alex Bennée
2025-01-07 16:52 ` [PATCH v3 25/29] tests/vm: partially un-tabify help output Alex Bennée
2025-01-07 16:52 ` [PATCH v3 26/29] tests/vm: allow interactive login as root Alex Bennée
2025-01-07 16:52 ` [PATCH v3 27/29] pc-bios: ensure keymaps dependencies set vnc tests Alex Bennée
2025-01-07 16:52 ` [PATCH v3 28/29] dockerfiles: Remove 'MAINTAINER' entry in debian-tricore-cross.docker Alex Bennée
2025-01-07 16:52 ` [PATCH v3 29/29] MAINTAINERS: Remove myself from reviewers Alex Bennée

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=b7618b1d-a48d-459d-9768-40830c866560@redhat.com \
    --to=thuth@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=bmeng.cn@gmail.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=crosa@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=emaste@freebsd.org \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=harshpb@linux.ibm.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=joel@jms.id.au \
    --cc=jsnow@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=liwei1518@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=lwhsu@freebsd.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=marcin.juszkiewicz@linaro.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pasic@linux.ibm.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=quic_llindhol@quicinc.com \
    --cc=rad@semihalf.com \
    --cc=richard.henderson@linaro.org \
    --cc=shentey@gmail.com \
    --cc=wainersm@redhat.com \
    --cc=zhiwei_liu@linux.alibaba.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).