qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] iotests: Consistent $IMGOPTS boundary matching
Date: Wed, 10 Feb 2021 09:03:41 -0600	[thread overview]
Message-ID: <38cd02af-e462-4411-e201-1c9aa11ec848@redhat.com> (raw)
In-Reply-To: <20210210095128.22732-1-mreitz@redhat.com>

On 2/10/21 3:51 AM, Max Reitz wrote:
> To disallow certain refcount_bits values, some _unsupported_imgopts
> invocations look like "refcount_bits=1[^0-9]", i.e. they match an
> integer boundary with [^0-9].  This expression does not match the end of
> the string, though, so it breaks down when refcount_bits is the last
> option (which it tends to be after the rewrite of the check script in
> Python).
> 
> Those invocations could use \b or \> instead, but those are not
> portable.  They could use something like \([^0-9]\|$\), but that would
> be cumbersome.  To make it simple and keep the existing invocations
> working, just let _unsupported_imgopts match the regex against $IMGOPTS
> plus a trailing space.
> 
> Suggested-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> Supersedes "iotests: Fix unsupported_imgopts for refcount_bits", and can
> be reproduced in the same way:
> 
> $ ./check -qcow2 -o refcount_bits=1 7 15 29 58 62 66 68 80
> 
> (those tests should be skipped)
> ---
>  tests/qemu-iotests/common.rc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Much smaller fix ;)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 77c37e8312..65cdba5723 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -885,7 +885,9 @@ _unsupported_imgopts()
>  {
>      for bad_opt
>      do
> -        if echo "$IMGOPTS" | grep -q 2>/dev/null "$bad_opt"
> +        # Add a space so tests can match for whitespace that marks the
> +        # end of an option (\b or \> are not portable)
> +        if echo "$IMGOPTS " | grep -q 2>/dev/null "$bad_opt"
>          then
>              _notrun "not suitable for image option: $bad_opt"
>          fi
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2021-02-10 15:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10  9:51 [PATCH] iotests: Consistent $IMGOPTS boundary matching Max Reitz
2021-02-10 15:03 ` Eric Blake [this message]
2021-02-12 12:32 ` Kevin Wolf

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=38cd02af-e462-4411-e201-1c9aa11ec848@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).