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: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] qemu-iotests: Test qcow2 image creation options
Date: Tue, 29 Jan 2013 14:55:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

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.

> 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.

>> +
>> +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)

Kevin



reply via email to

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