qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Maxim Levitsky <mlevitsk@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 04/18] iotests: Let _make_test_img parse its parameters
Date: Sun, 29 Sep 2019 19:32:21 +0300	[thread overview]
Message-ID: <b55869998d7f35096615cf5f011b7104ee36940b.camel@redhat.com> (raw)
In-Reply-To: <20190927094242.11152-5-mreitz@redhat.com>

On Fri, 2019-09-27 at 11:42 +0200, Max Reitz wrote:
> This will allow us to add more options than just -b.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/common.rc | 28 ++++++++++++++++++++--------
>  1 file changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 12b4751848..3e7adc4834 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -282,12 +282,12 @@ _make_test_img()
>      # extra qemu-img options can be added by tests
>      # at least one argument (the image size) needs to be added
>      local extra_img_options=""
> -    local image_size=$*
>      local optstr=""
>      local img_name=""
>      local use_backing=0
>      local backing_file=""
>      local object_options=""
> +    local misc_params=()
>  
>      if [ -n "$TEST_IMG_FILE" ]; then
>          img_name=$TEST_IMG_FILE
> @@ -303,11 +303,23 @@ _make_test_img()
>          optstr=$(_optstr_add "$optstr" "key-secret=keysec0")
>      fi
>  
> -    if [ "$1" = "-b" ]; then
> -        use_backing=1
> -        backing_file=$2
> -        image_size=$3
> -    fi
> +    for param; do
> +        if [ "$use_backing" = "1" -a -z "$backing_file" ]; then
> +            backing_file=$param
> +            continue
> +        fi
> +
> +        case "$param" in
> +            -b)
> +                use_backing=1
> +                ;;
> +
> +            *)
> +                misc_params=("${misc_params[@]}" "$param")
> +                ;;
> +        esac
> +    done
> +
>      if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
>          optstr=$(_optstr_add "$optstr" "cluster_size=$CLUSTER_SIZE")
>      fi
> @@ -323,9 +335,9 @@ _make_test_img()
>      # XXX(hch): have global image options?
>      (
>       if [ $use_backing = 1 ]; then
> -        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" $image_size 2>&1
> +        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" "${misc_params[@]}" 2>&1
>       else
> -        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options "$img_name" $image_size 2>&1
> +        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options "$img_name" "${misc_params[@]}" 2>&1
>       fi
>      ) | _filter_img_create
>  

Look all right as far as I understand that code, and this is a very welcome change.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky




  reply	other threads:[~2019-09-29 16:42 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27  9:42 [PATCH 00/18] iotests: Allow ./check -o data_file Max Reitz
2019-09-27  9:42 ` [PATCH 01/18] iotests: Filter refcount_order in 036 Max Reitz
2019-09-29 16:31   ` Maxim Levitsky
2019-09-30 12:43     ` Max Reitz
2019-09-30 13:40       ` Maxim Levitsky
2019-09-30 13:44         ` Max Reitz
2019-09-30 13:58           ` Maxim Levitsky
2019-09-30 14:04             ` Max Reitz
2019-09-30 14:14               ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 02/18] iotests: Replace IMGOPTS by _unsupported_imgopts Max Reitz
2019-09-29 16:31   ` Maxim Levitsky
2019-09-30 12:59     ` Max Reitz
2019-09-30 14:47       ` Maxim Levitsky
2019-09-30 14:59         ` Max Reitz
2019-09-27  9:42 ` [PATCH 03/18] iotests: Drop compat=1.1 in 050 Max Reitz
2019-09-29 16:32   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 04/18] iotests: Let _make_test_img parse its parameters Max Reitz
2019-09-29 16:32   ` Maxim Levitsky [this message]
2019-09-27  9:42 ` [PATCH 05/18] iotests: Add -o and --no-opts to _make_test_img Max Reitz
2019-09-29 16:32   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 06/18] iotests: Inject space into -ocompat=0.10 in 051 Max Reitz
2019-09-29 16:32   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 07/18] iotests: Replace IMGOPTS= by -o Max Reitz
2019-09-29 16:33   ` Maxim Levitsky
2019-09-30 13:00     ` Max Reitz
2019-09-30 14:30       ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 08/18] iotests: Replace IMGOPTS='' by --no-opts Max Reitz
2019-09-29 16:33   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 09/18] iotests: Drop IMGOPTS use in 267 Max Reitz
2019-09-29 16:33   ` Maxim Levitsky
2019-09-30 13:01     ` Max Reitz
2019-09-30 14:32       ` Maxim Levitsky
2019-09-30 15:01         ` Max Reitz
2019-09-30 15:06           ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 10/18] iotests: Avoid qemu-img create Max Reitz
2019-09-29 16:33   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 11/18] iotests: Use _rm_test_img for deleting test images Max Reitz
2019-09-29 16:33   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 12/18] iotests: Avoid cp/mv of " Max Reitz
2019-09-29 16:33   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 13/18] iotests: Make 091 work with data_file Max Reitz
2019-09-29 16:34   ` Maxim Levitsky
2019-09-30 13:07     ` Max Reitz
2019-09-27  9:42 ` [PATCH 14/18] iotests: Make 110 " Max Reitz
2019-09-29 16:34   ` Maxim Levitsky
2019-09-30 13:34     ` Max Reitz
2019-09-30 13:41       ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 15/18] iotests: Make 137 " Max Reitz
2019-09-29 16:38   ` Maxim Levitsky
2019-09-30 13:38     ` Max Reitz
2019-09-30 13:46       ` Maxim Levitsky
2019-09-30 13:57         ` Max Reitz
2019-09-30 14:06           ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 16/18] iotests: Make 198 " Max Reitz
2019-09-29 16:38   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 17/18] iotests: Disable data_file where it cannot be used Max Reitz
2019-09-29 16:39   ` Maxim Levitsky
2019-09-27  9:42 ` [PATCH 18/18] iotests: Allow check -o data_file Max Reitz
2019-09-29 16:39   ` Maxim Levitsky
2019-09-30 13:43     ` Max 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=b55869998d7f35096615cf5f011b7104ee36940b.camel@redhat.com \
    --to=mlevitsk@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).