qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] iotests: Add test 221 to catch qemu-img map regression
Date: Mon, 11 Jun 2018 17:03:19 -0500	[thread overview]
Message-ID: <ff47b198-c6a7-a2f5-86d0-93e3b431806e@redhat.com> (raw)
In-Reply-To: <20180611213927.141894-3-eblake@redhat.com>

On 06/11/2018 04:39 PM, Eric Blake wrote:
> Although qemu-img creates aligned files (by rounding up), it
> must also gracefully handle files that are not sector-aligned.
> Test that the bug fixed in the previous patch does not recur.
> 
> It's a bit annoying that we can see the (implicit) hole past
> the end of the file on to the next sector boundary, so if we
> ever reach the point where we report a byte-accurate size rather
> than our current behavior of always rounding up, this test will
> probably need a slight modification.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---

> +
> +$QEMU_IO -c 'w 43008 1' "$TEST_IMG" # writing also rounds up

Shoot - missing a filter...

> +++ b/tests/qemu-iotests/221.out
> @@ -0,0 +1,16 @@
> +QA output created by 221
> +
> +=== Check mapping of unaligned raw image ===
> +
> +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=43009
> +[{ "start": 0, "length": 43520, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
> +[{ "start": 0, "length": 43520, "depth": 0, "zero": true, "data": false, "offset": OFFSET}]
> +wrote 1/1 bytes at offset 43008
> +1 bytes, 1 ops; 0.0001 sec (7.512 KiB/sec and 7692.3077 ops/sec)

...which leaks volatile output.  Squash this in:

diff --git i/tests/qemu-iotests/221 w/tests/qemu-iotests/221
index f2cd3c2210e..41c4e4bdf88 100755
--- i/tests/qemu-iotests/221
+++ w/tests/qemu-iotests/221
@@ -48,7 +48,7 @@ $QEMU_IMG map --output=json "$TEST_IMG" | 
_filter_qemu_img_map
  truncate --size=43009 "$TEST_IMG" # so we resize it and check again
  $QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map

-$QEMU_IO -c 'w 43008 1' "$TEST_IMG" # writing also rounds up
+$QEMU_IO -c 'w 43008 1' "$TEST_IMG" | _filter_qemu_io # writing also 
rounds up
  $QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map

  truncate --size=43009 "$TEST_IMG" # so we resize it and check again
diff --git i/tests/qemu-iotests/221.out w/tests/qemu-iotests/221.out
index fcf61352cc3..a9c0190aadc 100644
--- i/tests/qemu-iotests/221.out
+++ w/tests/qemu-iotests/221.out
@@ -6,7 +6,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=43009
  [{ "start": 0, "length": 43520, "depth": 0, "zero": true, "data": 
false, "offset": OFFSET}]
  [{ "start": 0, "length": 43520, "depth": 0, "zero": true, "data": 
false, "offset": OFFSET}]
  wrote 1/1 bytes at offset 43008
-1 bytes, 1 ops; 0.0001 sec (7.512 KiB/sec and 7692.3077 ops/sec)
+1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  [{ "start": 0, "length": 40960, "depth": 0, "zero": true, "data": 
false, "offset": OFFSET},
  { "start": 40960, "length": 2049, "depth": 0, "zero": false, "data": 
true, "offset": OFFSET},
  { "start": 43009, "length": 511, "depth": 0, "zero": true, "data": 
false, "offset": OFFSET}]


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

  reply	other threads:[~2018-06-11 22:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 21:39 [Qemu-devel] [PATCH 0/2] Fix qemu-img map on unaligned image Eric Blake
2018-06-11 21:39 ` [Qemu-devel] [PATCH 1/2] qemu-img: Fix assert when mapping unaligned raw file Eric Blake
2018-06-11 21:39 ` [Qemu-devel] [PATCH 2/2] iotests: Add test 221 to catch qemu-img map regression Eric Blake
2018-06-11 22:03   ` Eric Blake [this message]
2018-06-12 11:23     ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff47b198-c6a7-a2f5-86d0-93e3b431806e@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).