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 3/3] iotests: Use stat -c %b in 125
Date: Wed, 25 Sep 2019 16:31:25 -0500	[thread overview]
Message-ID: <0930fbf9-a3cb-dd1a-81fe-5c8710ee0c46@redhat.com> (raw)
In-Reply-To: <20190925183231.11196-4-mreitz@redhat.com>

On 9/25/19 1:32 PM, Max Reitz wrote:
> 125 should not use qemu-img to get the on-disk image size, because that
> reports it in a human-readable format that is useless to us.  Just use
> stat instead (like we do to get the image file length).
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   tests/qemu-iotests/125 | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125
> index 0ef51f1e21..4e31aa4e5f 100755
> --- a/tests/qemu-iotests/125
> +++ b/tests/qemu-iotests/125
> @@ -34,8 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
>   
>   get_image_size_on_host()
>   {
> -    $QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep "disk size" \
> -        | sed -e 's/^[^0-9]*\([0-9]\+\).*$/\1/'
> +    echo $(($(stat -c '%b * %B' "$TEST_IMG_FILE")))

Cute use of $(()) around $().

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:[~2019-09-25 21:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 18:32 [PATCH 0/3] iotests: Fix 125 Max Reitz
2019-09-25 18:32 ` [PATCH 1/3] iotests: Fix 125 for growth_mode = metadata Max Reitz
2019-09-25 21:29   ` Eric Blake
2019-09-25 18:32 ` [PATCH 2/3] iotests: Disable 125 on broken XFS versions Max Reitz
2019-09-25 21:28   ` Eric Blake
2019-09-26 10:58     ` Max Reitz
2019-09-25 18:32 ` [PATCH 3/3] iotests: Use stat -c %b in 125 Max Reitz
2019-09-25 21:31   ` Eric Blake [this message]
2019-09-27  9:29 ` [PATCH 0/3] iotests: Fix 125 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=0930fbf9-a3cb-dd1a-81fe-5c8710ee0c46@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).