qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu-iotests: Test qcow2 image creation options


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qemu-iotests: Test qcow2 image creation options
Date: Tue, 29 Jan 2013 09:12:12 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 01/29/2013 03:01 AM, Kevin Wolf wrote:
> Just create lots of images and try out each of the creation options that
> qcow2 provides (except backing_file/fmt for now)
> 
> I'm not totally happy with the behaviour of qemu-img in each of the
> cases, but let's be explicit and update the test when we do change
> things later.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---

> @@ -0,0 +1,117 @@
> +#!/bin/bash

Good, because you definitely used some bash-isms (such as sizes+="more").

> +# creator
> address@hidden
> +
> +seq=`basename $0`

Since you are already using a capable shell, why not go all the way and
use $() instead of ``?  And in this case, why not:

seq=${0##*/}

to avoid a fork?

> +echo "QA output created by $seq"
> +
> +here=`pwd`

Likewise, since you are using a capable shell, you can avoid a fork:

here=$PWD

> +tmp=/tmp/$$

And since you are using a capable shell, it would be more secure to use:

tmp=/tmp/$$.$RANDOM

> +status=1     # failure is the default!
> +
> +_cleanup()
> +{

POSIX-style declaration,...

> +     _cleanup_test_img
> +}
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +# get standard environment, filters and checks
> +. ./common.rc
> +. ./common.filter
> +
> +_supported_fmt qcow2
> +_supported_proto file
> +_supported_os Linux
> +
> +function test_qemu_img()

...bash-style declaration.  I generally frown on the use of 'function'
in shell scripts, as it is not portable, and takes up more screen-space
than the POSIX style.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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