yeahuh / rpms / qemu-kvm

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