On 2/27/19 11:22 AM, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <[email protected]>
> ---

> +++ 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 <[email protected]>

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

Reply via email to