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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] qemu-iotests: Test qcow2 image creation options
Date: Tue, 29 Jan 2013 15:16:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Kevin Wolf <address@hidden> writes:

> Am 29.01.2013 14:43, schrieb Markus Armbruster:
>>> +echo "=== Check correct interpretation of suffixes for image size ==="
>>> +echo
>>> +sizes="1024 1024b 1k 1K 1M 1G 1T "
>>> +sizes+="1024.0 1024.0b 1.5k 1.5K 1.5M 1.5G 1.5T"
>>> +
>>> +echo "== 1. Traditional size parameter =="
>>> +echo
>>> +for s in $sizes; do
>>> +    test_qemu_img create -f $IMGFMT $TEST_IMG $s
>>> +done
>> 
>> Do we have a qemu-option.c unit test?  If not, should we have one?
>
> Not that I am aware of. Writing unit tests for QemuOpts would probably
> make sense, but I suppose it's not worth the effort for the
> QemuOptionParameters stuff that we're going to remove anyway.

Yes.

>> Even if yes, testing qemu-img like this still makes sense.  But fewer
>> test cases could do.
>
> Not sure. This test case is mainly meant to ensure that the behaviour
> stays consistent even if we move to a different infrastructure
> (QemuOptionParameter -> QemuOpts). It wouldn't be enough to test that
> each of these is working correctly for itself.

Makes sense.

>>> +
>>> +echo "== 2. Specifying size via -o =="
>>> +echo
>>> +for s in $sizes; do
>>> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
>>> +done
>>> +
>>> +echo "== 3. Invalid sizes =="
>>> +echo
>>> +sizes="-1024 -1k 1kilobyte foobar"
>>> +
>>> +for s in $sizes; do
>>> +    test_qemu_img create -f $IMGFMT $TEST_IMG -- $s
>>> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
>>> +done
>> 
>> Valid sizes are tested in two loops, one for size parameter, one for -o,
>> invalid sizes in a single combined loop.  I don't mind, I just find it
>> odd.
>
> The reason for having separate loops for valid sizes is mostly to keep
> the output readable. There are much more valid sizes tested than invalid
> ones.
>
>>> diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out
>>> new file mode 100644
>>> index 0000000..8569f3e
>>> --- /dev/null
>>> +++ b/tests/qemu-iotests/048.out
>> [...]
>> 
>> I figure this is simply current output, and we assume it's good.
>
> Yes, it is. And for some values of good (for example, the output for
> negative sizes is creative, to say the least)

"-o size=-1" is good one, too :)



reply via email to

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