qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img
@ 2012-03-14 18:57 Stefan Weil
  2012-03-14 18:57 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Fix call syntax for qemu-io Stefan Weil
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stefan Weil @ 2012-03-14 18:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Weil

qemu-img requires first options, then file name, then size.

GNU getopt also allows options at the end, but POSIX getopt
doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
behaviour with GNU getopt, too.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 tests/qemu-iotests/common.rc |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 26811ca..4cb8dae 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -57,16 +57,21 @@ _make_test_img()
 {
     # extra qemu-img options can be added by tests
     # at least one argument (the image size) needs to be added
-    local extra_img_options=$*
+    local extra_img_options=""
     local cluster_size_filter="s# cluster_size=[0-9]\\+##g"
+    local image_size=$*
 
+    if [ "$1" = "-b" ]; then
+        extra_img_options="$1 $2"
+        image_size=$3
+    fi
     if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
         extra_img_options="-o cluster_size=$CLUSTER_SIZE $extra_img_options"
         cluster_size_filter=""
     fi
 
     # XXX(hch): have global image options?
-    $QEMU_IMG create -f $IMGFMT $TEST_IMG $extra_img_options | \
+    $QEMU_IMG create -f $IMGFMT $extra_img_options $TEST_IMG $image_size | \
     	sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" | \
     	sed -e "s#$TEST_DIR#TEST_DIR#g" | \
     	sed -e "s#$IMGFMT#IMGFMT#g" | \
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 2/2] qemu-iotests: Fix call syntax for qemu-io
  2012-03-14 18:57 [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Stefan Weil
@ 2012-03-14 18:57 ` Stefan Weil
  2012-03-14 19:08 ` [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Eric Blake
  2012-04-05 13:11 ` Kevin Wolf
  2 siblings, 0 replies; 7+ messages in thread
From: Stefan Weil @ 2012-03-14 18:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Weil

qemu-io requires options first, then fixed parameters.

GNU getopt also allows options at the end, but POSIX getopt
doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
behaviour with GNU getopt, too.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 tests/qemu-iotests/009 |    4 ++--
 tests/qemu-iotests/010 |    6 +++---
 tests/qemu-iotests/011 |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/qemu-iotests/009 b/tests/qemu-iotests/009
index f7262b5..25368c8 100755
--- a/tests/qemu-iotests/009
+++ b/tests/qemu-iotests/009
@@ -53,10 +53,10 @@ _make_test_img $size
 echo
 echo "creating pattern"
 $QEMU_IO \
-	-c "write 2048k 4k -P 65" \
+	-c "write -P 65 2048k 4k" \
 	-c "write 4k 4k" \
 	-c "write 9M 4k" \
-	-c "read 2044k 8k -P 65 -s 4k -l 4k" \
+	-c "read -P 65 -s 4k -l 4k 2044k 8k" \
 $TEST_IMG | _filter_qemu_io
 
 echo
diff --git a/tests/qemu-iotests/010 b/tests/qemu-iotests/010
index e3205aa..7b57929 100755
--- a/tests/qemu-iotests/010
+++ b/tests/qemu-iotests/010
@@ -53,11 +53,11 @@ _make_test_img $size
 echo
 echo "creating pattern"
 $QEMU_IO \
-	-c "write 2048k 4k -P 165" \
+	-c "write -P 165 2048k 4k" \
 	-c "write 64k 4k" \
 	-c "write 9M 4k" \
-	-c "write 2044k 4k -P 165" \
-	-c "write 8M 4k -P 99" \
+	-c "write -P 165 2044k 4k" \
+	-c "write -P 99 8M 4k" \
 	-c "read -P 165 2044k 8k" \
 $TEST_IMG | _filter_qemu_io
 
diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011
index 59df1ae..b03df68 100755
--- a/tests/qemu-iotests/011
+++ b/tests/qemu-iotests/011
@@ -60,7 +60,7 @@ for i in `seq 1 10`; do
     # Note that we filter away the actual offset.  That's because qemu
     # may re-order the two aio requests.  We only want to make sure the
     # filesystem isn't corrupted afterwards anyway.
-    $QEMU_IO $TEST_IMG -c "aio_write $off1 1M" -c "aio_write $off2 1M" | \
+    $QEMU_IO -c "aio_write $off1 1M" -c "aio_write $off2 1M" $TEST_IMG | \
     	_filter_qemu_io | \
 	sed -e 's/bytes at offset [0-9]*/bytes at offset XXX/g'
 done
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img
  2012-03-14 18:57 [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Stefan Weil
  2012-03-14 18:57 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Fix call syntax for qemu-io Stefan Weil
@ 2012-03-14 19:08 ` Eric Blake
  2012-03-14 20:48   ` Stefan Weil
  2012-04-05 13:11 ` Kevin Wolf
  2 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2012-03-14 19:08 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Kevin Wolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

On 03/14/2012 12:57 PM, Stefan Weil wrote:
> qemu-img requires first options, then file name, then size.
> 
> GNU getopt also allows options at the end, but POSIX getopt
> doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
> behaviour with GNU getopt, too.

That's a heavy sledgehammer, that has the potential to affect a lot of
other programs called alongside qemu-img.  Simpler would be to just pass
-- in the command line at the point where you want to force qemu to
treat all further arguments without getopt reordering them, as in:

>      # XXX(hch): have global image options?
> -    $QEMU_IMG create -f $IMGFMT $TEST_IMG $extra_img_options | \
> +    $QEMU_IMG create -f $IMGFMT $extra_img_options $TEST_IMG $image_size | \

$QEMU_IMG -- create -f $IMGFMT $extra_img_options $TEST_IMG $image_size

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img
  2012-03-14 19:08 ` [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Eric Blake
@ 2012-03-14 20:48   ` Stefan Weil
  2012-03-27 20:56     ` Stefan Weil
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2012-03-14 20:48 UTC (permalink / raw)
  To: Eric Blake; +Cc: Kevin Wolf, qemu-devel

Am 14.03.2012 20:08, schrieb Eric Blake:
> On 03/14/2012 12:57 PM, Stefan Weil wrote:
>> qemu-img requires first options, then file name, then size.
>>
>> GNU getopt also allows options at the end, but POSIX getopt
>> doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
>> behaviour with GNU getopt, too.
>
> That's a heavy sledgehammer, that has the potential to affect a lot of
> other programs called alongside qemu-img. Simpler would be to just pass
> -- in the command line at the point where you want to force qemu to
> treat all further arguments without getopt reordering them, as in:

I did not want to suggest that POSIXLY_CORRECT should always
be set. It's just a way how maintainers can test that there is
a problem with the current code, and that this problem is
fixed by my patch.

Passing -- in the command line will not only stop argument
reordering, it also stops argument parsing which is not
what we need here.

Regards,

Stefan W.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img
  2012-03-14 20:48   ` Stefan Weil
@ 2012-03-27 20:56     ` Stefan Weil
  2012-03-28 10:32       ` Stefan Hajnoczi
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2012-03-27 20:56 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Eric Blake, qemu-devel

Am 14.03.2012 21:48, schrieb Stefan Weil:
> Am 14.03.2012 20:08, schrieb Eric Blake:
>> On 03/14/2012 12:57 PM, Stefan Weil wrote:
>>> qemu-img requires first options, then file name, then size.
>>>
>>> GNU getopt also allows options at the end, but POSIX getopt
>>> doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
>>> behaviour with GNU getopt, too.
>>
>> That's a heavy sledgehammer, that has the potential to affect a lot of
>> other programs called alongside qemu-img. Simpler would be to just pass
>> -- in the command line at the point where you want to force qemu to
>> treat all further arguments without getopt reordering them, as in:
>
> I did not want to suggest that POSIXLY_CORRECT should always
> be set. It's just a way how maintainers can test that there is
> a problem with the current code, and that this problem is
> fixed by my patch.
>
> Passing -- in the command line will not only stop argument
> reordering, it also stops argument parsing which is not
> what we need here.
>
> Regards,
>
> Stefan W.

Ping? These two patches for qemu-iotests are still missing
in QEMU git master. Are there any open questions, or can
they be committed? Should they go through qemu-trivial?

Cheers,
Stefan W.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img
  2012-03-27 20:56     ` Stefan Weil
@ 2012-03-28 10:32       ` Stefan Hajnoczi
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2012-03-28 10:32 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Kevin Wolf, Eric Blake, qemu-devel

On Tue, Mar 27, 2012 at 9:56 PM, Stefan Weil <sw@weilnetz.de> wrote:
> Am 14.03.2012 21:48, schrieb Stefan Weil:
>
>> Am 14.03.2012 20:08, schrieb Eric Blake:
>>>
>>> On 03/14/2012 12:57 PM, Stefan Weil wrote:
>>>>
>>>> qemu-img requires first options, then file name, then size.
>>>>
>>>> GNU getopt also allows options at the end, but POSIX getopt
>>>> doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
>>>> behaviour with GNU getopt, too.
>>>
>>>
>>> That's a heavy sledgehammer, that has the potential to affect a lot of
>>> other programs called alongside qemu-img. Simpler would be to just pass
>>> -- in the command line at the point where you want to force qemu to
>>> treat all further arguments without getopt reordering them, as in:
>>
>>
>> I did not want to suggest that POSIXLY_CORRECT should always
>> be set. It's just a way how maintainers can test that there is
>> a problem with the current code, and that this problem is
>> fixed by my patch.
>>
>> Passing -- in the command line will not only stop argument
>> reordering, it also stops argument parsing which is not
>> what we need here.
>>
>> Regards,
>>
>> Stefan W.
>
>
> Ping? These two patches for qemu-iotests are still missing
> in QEMU git master. Are there any open questions, or can
> they be committed? Should they go through qemu-trivial?

Kevin on IRC yesterday:

<kwolf> Last week was rather busy, and I'll be on vacation from
tomorrow until Friday, so don't expect feedback from me before some
time next week

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img
  2012-03-14 18:57 [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Stefan Weil
  2012-03-14 18:57 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Fix call syntax for qemu-io Stefan Weil
  2012-03-14 19:08 ` [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Eric Blake
@ 2012-04-05 13:11 ` Kevin Wolf
  2 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2012-04-05 13:11 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Am 14.03.2012 19:57, schrieb Stefan Weil:
> qemu-img requires first options, then file name, then size.
> 
> GNU getopt also allows options at the end, but POSIX getopt
> doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
> behaviour with GNU getopt, too.
> 
> Cc: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Thanks, applied both to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-05 13:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 18:57 [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Stefan Weil
2012-03-14 18:57 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Fix call syntax for qemu-io Stefan Weil
2012-03-14 19:08 ` [Qemu-devel] [PATCH 1/2] qemu-iotests: Fix call syntax for qemu-img Eric Blake
2012-03-14 20:48   ` Stefan Weil
2012-03-27 20:56     ` Stefan Weil
2012-03-28 10:32       ` Stefan Hajnoczi
2012-04-05 13:11 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).