thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 7441576422844bf66c7560c5940d8159aa8f6882 Mon Sep 17 00:00:00 2001
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Mon, 25 May 2015 04:45:55 +0200
9ae3a8
Subject: [PATCH 3/6] qemu-iotests: Test unaligned 4k zero write
9ae3a8
9ae3a8
Message-id: <1432529157-20381-2-git-send-email-famz@redhat.com>
9ae3a8
Patchwork-id: 65119
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH v2 1/3] qemu-iotests: Test unaligned 4k zero write
9ae3a8
Bugzilla: 1200295
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: 1427160230-4489-3-git-send-email-famz@redhat.com
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 61815d6e0aa1a549ad55f6621b6816aa6b1ab757)
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/033     | 47 +++++++++++++++++++++++++++++-----------------
9ae3a8
 tests/qemu-iotests/033.out | 26 +++++++++++++++++++++++++
9ae3a8
 2 files changed, 56 insertions(+), 17 deletions(-)
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
9ae3a8
index ea3351c..4008f10 100755
9ae3a8
--- a/tests/qemu-iotests/033
9ae3a8
+++ b/tests/qemu-iotests/033
9ae3a8
@@ -46,26 +46,39 @@ _supported_os Linux
9ae3a8
 size=128M
9ae3a8
 _make_test_img $size
9ae3a8
 
9ae3a8
-echo
9ae3a8
-echo "== preparing image =="
9ae3a8
-$QEMU_IO -c "write -P 0xa 0x200 0x400" "$TEST_IMG" | _filter_qemu_io
9ae3a8
-$QEMU_IO -c "write -P 0xa 0x20000 0x600" "$TEST_IMG" | _filter_qemu_io
9ae3a8
-$QEMU_IO -c "write -z 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+do_test()
9ae3a8
+{
9ae3a8
+	local align=$1
9ae3a8
+	local iocmd=$2
9ae3a8
+	local img=$3
9ae3a8
+	{
9ae3a8
+		echo "open -o driver=$IMGFMT,file.align=$align blkdebug::$img"
9ae3a8
+		echo $iocmd
9ae3a8
+	} | $QEMU_IO
9ae3a8
+}
9ae3a8
+
9ae3a8
+for align in 512 4k; do
9ae3a8
+	echo
9ae3a8
+	echo "== preparing image =="
9ae3a8
+	do_test $align "write -P 0xa 0x200 0x400" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	do_test $align "write -P 0xa 0x20000 0x600" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	do_test $align "write -z 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
 
9ae3a8
-echo
9ae3a8
-echo "== verifying patterns (1) =="
9ae3a8
-$QEMU_IO -c "read -P 0xa 0x200 0x200" "$TEST_IMG" | _filter_qemu_io
9ae3a8
-$QEMU_IO -c "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
-$QEMU_IO -c "read -P 0xa 0x20400 0x200" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	echo
9ae3a8
+	echo "== verifying patterns (1) =="
9ae3a8
+	do_test $align "read -P 0xa 0x200 0x200" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	do_test $align "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	do_test $align "read -P 0xa 0x20400 0x200" "$TEST_IMG" | _filter_qemu_io
9ae3a8
 
9ae3a8
-echo
9ae3a8
-echo "== rewriting zeroes =="
9ae3a8
-$QEMU_IO -c "write -P 0xb 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
-$QEMU_IO -c "write -z 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	echo
9ae3a8
+	echo "== rewriting zeroes =="
9ae3a8
+	do_test $align "write -P 0xb 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	do_test $align "write -z 0x10000 0x10000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
 
9ae3a8
-echo
9ae3a8
-echo "== verifying patterns (2) =="
9ae3a8
-$QEMU_IO -c "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+	echo
9ae3a8
+	echo "== verifying patterns (2) =="
9ae3a8
+	do_test $align "read -P 0x0 0x400 0x20000" "$TEST_IMG" | _filter_qemu_io
9ae3a8
+done
9ae3a8
 
9ae3a8
 # success, all done
9ae3a8
 echo "*** done"
9ae3a8
diff --git a/tests/qemu-iotests/033.out b/tests/qemu-iotests/033.out
9ae3a8
index 2fe74df..344065f 100644
9ae3a8
--- a/tests/qemu-iotests/033.out
9ae3a8
+++ b/tests/qemu-iotests/033.out
9ae3a8
@@ -26,4 +26,30 @@ wrote 65536/65536 bytes at offset 65536
9ae3a8
 == verifying patterns (2) ==
9ae3a8
 read 131072/131072 bytes at offset 1024
9ae3a8
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+
9ae3a8
+== preparing image ==
9ae3a8
+wrote 1024/1024 bytes at offset 512
9ae3a8
+1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+wrote 1536/1536 bytes at offset 131072
9ae3a8
+1.500 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+wrote 131072/131072 bytes at offset 1024
9ae3a8
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+
9ae3a8
+== verifying patterns (1) ==
9ae3a8
+read 512/512 bytes at offset 512
9ae3a8
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+read 131072/131072 bytes at offset 1024
9ae3a8
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+read 512/512 bytes at offset 132096
9ae3a8
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+
9ae3a8
+== rewriting zeroes ==
9ae3a8
+wrote 65536/65536 bytes at offset 65536
9ae3a8
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+wrote 65536/65536 bytes at offset 65536
9ae3a8
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
+
9ae3a8
+== verifying patterns (2) ==
9ae3a8
+read 131072/131072 bytes at offset 1024
9ae3a8
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
9ae3a8
 *** done
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8