All of lore.kernel.org
 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 2/2] iotests: Test snapshot -l field separation
Date: Fri, 17 Jan 2020 07:54:45 -0600	[thread overview]
Message-ID: <3d082b5a-fc94-1370-a6f1-3acd27a73f5c@redhat.com> (raw)
In-Reply-To: <20200117105859.241818-3-mreitz@redhat.com>

On 1/17/20 4:58 AM, Max Reitz wrote:
> Add a test that all fields in "qemu-img snapshot -l"s output are
> separated by spaces.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   tests/qemu-iotests/284     | 76 ++++++++++++++++++++++++++++++++++++++
>   tests/qemu-iotests/284.out |  8 ++++
>   tests/qemu-iotests/group   |  1 +
>   3 files changed, 85 insertions(+)
>   create mode 100755 tests/qemu-iotests/284
>   create mode 100644 tests/qemu-iotests/284.out
> 

> +# Check that all fields are separated by spaces.
> +# We first collapse all space sequences into one space each;
> +# then we turn every space-separated field into a '.';
> +# and finally, we name the '.'s so the output is not just a confusing
> +# sequence of dots.
> +
> +echo 'Output structure:'
> +$QEMU_IMG snapshot -l "$TEST_IMG" | tail -n 1 | tr -s ' ' \
> +    | sed -e 's/\S\+/./g' \
> +    | sed -e 's/\./(snapshot ID)/' \
> +          -e 's/\./(snapshot name)/' \
> +          -e 's/\./(VM state size value)/' \
> +          -e 's/\./(VM state size unit)/' \
> +          -e 's/\./(snapshot date)/' \
> +          -e 's/\./(snapshot time)/' \
> +          -e 's/\./(VM clock)/'

Cute conversion.  If you had picked some other character (like 
s/\S\+/=/g), you wouldn't have to use \. everywhere in the second sed, 
for less typing, but that's aesthetic, so no need to change if you don't 
want.

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

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



  reply	other threads:[~2020-01-17 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 10:58 [PATCH 0/2] block: Fix VM size field width in snapshot dump Max Reitz
2020-01-17 10:58 ` [PATCH 1/2] " Max Reitz
2020-01-17 13:52   ` Eric Blake
2020-01-17 10:58 ` [PATCH 2/2] iotests: Test snapshot -l field separation Max Reitz
2020-01-17 13:54   ` Eric Blake [this message]
2020-02-19 10:43 ` [PATCH 0/2] block: Fix VM size field width in snapshot dump 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=3d082b5a-fc94-1370-a6f1-3acd27a73f5c@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 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.