From: Kevin Wolf <kwolf@redhat.com>
To: hch@lst.de
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH][qemu-iotests] Improve test for qemu-img convert with backing file
Date: Thu, 14 Oct 2010 15:01:18 +0200 [thread overview]
Message-ID: <1287061278-17908-1-git-send-email-kwolf@redhat.com> (raw)
Additionally to testing the qemu-img convert -B option, also test
-o backing_file.
Also, the old test acidentlly used a pattern of zeros for most of the writes,
so that the allocation test didn't really work out. This is fixed by using an
explicit pattern.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
019 | 59 ++++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/019 b/019
index 711255e..896b8d9 100755
--- a/019
+++ b/019
@@ -57,10 +57,10 @@ echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
- io writev $(( offset )) 512 1024 64
+ io_pattern writev $(( offset )) 512 1024 64 42
# Complete backing clusters
- io writev $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1
+ io_pattern writev $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 42
done
_check_test_img
@@ -75,39 +75,52 @@ echo
for offset in $TEST_OFFSETS; do
# Some clusters with alternating backing file/image file reads
- io writev $(( offset + 512 )) 512 1024 64
+ io_pattern writev $(( offset + 512 )) 512 1024 64 43
# Complete test image clusters
- io writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1
+ io_pattern writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 43
done
_check_test_img
mv $TEST_IMG $TEST_IMG.orig
-$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG.orig $TEST_IMG
-echo "Checking if backing clusters are allocated when they shouldn't"
-echo
-for offset in $TEST_OFFSETS; do
- # Complete backing clusters
- is_allocated $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1
-done
-echo "Reading"
-echo
-for offset in $TEST_OFFSETS; do
- # Some clusters with alternating backing file/image file reads
- io readv $(( offset )) 512 1024 64
- io readv $(( offset + 512 )) 512 1024 64
+# Test the conversion twice: One test with the old-style -B option and another
+# one with -o backing_file
- # Complete test image clusters
- io readv $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1
- io readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1
+for backing_option in "-B $TEST_IMG.base" "-o backing_file=$TEST_IMG.base"; do
+
+ echo
+ echo Testing conversion with $backing_option
+ echo
+ $QEMU_IMG convert -O $IMGFMT $backing_option $TEST_IMG.orig $TEST_IMG
+
+ echo "Checking if backing clusters are allocated when they shouldn't"
+ echo
+ for offset in $TEST_OFFSETS; do
+ # Complete backing clusters
+ is_allocated $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1
+ done
+
+ echo "Reading"
+ echo
+
+ for offset in $TEST_OFFSETS; do
+ # Some clusters with alternating backing file/image file reads
+ io_pattern readv $(( offset )) 512 1024 64 42
+ io_pattern readv $(( offset + 512 )) 512 1024 64 43
+
+ # Complete test image clusters
+ io_pattern readv $(( offset + 1024 * 1024)) $CLUSTER_SIZE $CLUSTER_SIZE 1 42
+ io_pattern readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE)) $CLUSTER_SIZE $CLUSTER_SIZE 1 43
+
+ # Empty sectors
+ io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
+ done
+ _check_test_img
- # Empty sectors
- io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
done
-_check_test_img
# success, all done
echo "*** done"
--
1.7.2.3
next reply other threads:[~2010-10-14 13:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 13:01 Kevin Wolf [this message]
2010-10-15 14:57 ` [Qemu-devel] Re: [PATCH][qemu-iotests] Improve test for qemu-img convert with backing file Christoph Hellwig
2010-10-15 15:56 ` Kevin Wolf
2010-10-15 16:06 ` Christoph Hellwig
2010-10-15 16:11 ` [Qemu-devel] [PATCH] qemu-iotests: Update expected results after qemu-img changes Kevin Wolf
2010-10-15 21:12 ` [Qemu-devel] " Christoph Hellwig
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=1287061278-17908-1-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=hch@lst.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.