All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
To: Hanna Reitz <hreitz@redhat.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Thomas Huth <thuth@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH v3 1/3] iotests.py: Add supports_qcow2_zstd_compression()
Date: Wed, 23 Mar 2022 14:47:42 +0300	[thread overview]
Message-ID: <81cfdffb-42b9-bb52-7352-f0163eaa744a@mail.ru> (raw)
In-Reply-To: <20220323105522.53660-2-hreitz@redhat.com>

23.03.2022 13:55, Hanna Reitz wrote:
> Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---
>   tests/qemu-iotests/iotests.py | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index fcec3e51e5..fe10a6cf05 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -1471,6 +1471,26 @@ def verify_working_luks():
>       if not working:
>           notrun(reason)
>   
> +def supports_qcow2_zstd_compression() -> bool:
> +    img_file = f'{test_dir}/qcow2-zstd-test.qcow2'
> +    res = qemu_img('create', '-f', 'qcow2', '-o', 'compression_type=zstd',
> +                   img_file, '0',
> +                   check=False)

check=False may be squashed into previous line

> +    try:
> +        os.remove(img_file)
> +    except OSError:
> +        pass
> +
> +    if res.returncode == 1 and \
> +            "'compression-type' does not accept value 'zstd'" in res.stdout:
> +        return False
> +    else:
> +        return True

May be:

return not(res.returncode == 1 and
    "'compression-type' does not accept value 'zstd'" in res.stdout)

> +
> +def verify_qcow2_zstd_compression():
> +    if not supports_qcow2_zstd_compression():
> +        notrun('zstd compression not supported')
> +
>   def qemu_pipe(*args: str) -> str:
>       """
>       Run qemu with an option to print something and exit (e.g. a help option).

anyway:
Reviewed-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>

-- 
Best regards,
Vladimir


  reply	other threads:[~2022-03-23 12:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 10:55 [PATCH v3 0/3] iotests: Check for zstd support Hanna Reitz
2022-03-23 10:55 ` [PATCH v3 1/3] iotests.py: Add supports_qcow2_zstd_compression() Hanna Reitz
2022-03-23 11:47   ` Vladimir Sementsov-Ogievskiy [this message]
2022-03-23 10:55 ` [PATCH v3 2/3] iotests/065: Check for zstd support Hanna Reitz
2022-03-23 11:48   ` Vladimir Sementsov-Ogievskiy
2022-03-23 10:55 ` [PATCH v3 3/3] iotests/303: " Hanna Reitz

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=81cfdffb-42b9-bb52-7352-f0163eaa744a@mail.ru \
    --to=v.sementsov-og@mail.ru \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.