[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 01/20] qemu-iotests: Test qcow2 preallocation mo

From: Eric Blake
Subject: Re: [Qemu-block] [PATCH 01/20] qemu-iotests: Test qcow2 preallocation modes
Date: Fri, 1 Mar 2019 10:43:18 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 2/27/19 11:22 AM, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <address@hidden>
> ---

> +++ b/tests/qemu-iotests/243
> @@ -0,0 +1,63 @@

> +
> +    echo -n "File size: "

echo -n is non-portable (bash has shopt -s xpg_echo); better is to just
use printf.  See commit b43671f8

> +    du -b $TEST_IMG | cut -f1
> +
> +    # Can't use precise numbers here because they differ between filesystems
> +    echo -n "Disk usage: "

and again

> +    [ $(du -B1 $TEST_IMG | cut -f1) -lt 1048576 ] && echo "low" || echo 
> "high"

du -b/-B are not portable to POSIX, but you did limit the test to just
Linux where they are fairly likely, so I don't have any better
suggestions.  I like the masking into high/low to work around file
system granularity quirks as well as image metadata size differences.

As using printf instead of echo -n is trivial,
Reviewed-by: Eric Blake <address@hidden>

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]