yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
05bba0
From 8c0c745cfd6e5e8e366449ed421edb250f24abf1 Mon Sep 17 00:00:00 2001
05bba0
From: Max Reitz <mreitz@redhat.com>
05bba0
Date: Sat, 13 Jun 2015 16:22:08 +0200
05bba0
Subject: [PATCH 14/42] iotests: Add test for qcow2 L1 table update
05bba0
05bba0
Message-id: <1434212556-3927-15-git-send-email-mreitz@redhat.com>
05bba0
Patchwork-id: 66033
05bba0
O-Subject: [RHEL-7.2 qemu-kvm PATCH 14/42] iotests: Add test for qcow2 L1 table update
05bba0
Bugzilla: 1129893
05bba0
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
05bba0
RH-Acked-by: Fam Zheng <famz@redhat.com>
05bba0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
05bba0
BZ: 1129893
05bba0
05bba0
Updating the L1 table should not result in random data being written.
05bba0
This adds a test for that.
05bba0
05bba0
Signed-off-by: Max Reitz <mreitz@redhat.com>
05bba0
Reviewed-by: Eric Blake <eblake@redhat.com>
05bba0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
05bba0
(cherry picked from commit 1b2dd0bee6bd03045b90c8a7549c8134466b2938)
05bba0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
05bba0
Conflicts:
05bba0
	tests/qemu-iotests/group
05bba0
05bba0
Signed-off-by: Max Reitz <mreitz@redhat.com>
05bba0
---
05bba0
 tests/qemu-iotests/107     | 61 ++++++++++++++++++++++++++++++++++++++++++++++
05bba0
 tests/qemu-iotests/107.out | 10 ++++++++
05bba0
 tests/qemu-iotests/group   |  1 +
05bba0
 3 files changed, 72 insertions(+)
05bba0
 create mode 100755 tests/qemu-iotests/107
05bba0
 create mode 100644 tests/qemu-iotests/107.out
05bba0
05bba0
diff --git a/tests/qemu-iotests/107 b/tests/qemu-iotests/107
05bba0
new file mode 100755
05bba0
index 0000000..cad1cf9
05bba0
--- /dev/null
05bba0
+++ b/tests/qemu-iotests/107
05bba0
@@ -0,0 +1,61 @@
05bba0
+#!/bin/bash
05bba0
+#
05bba0
+# Tests updates of the qcow2 L1 table
05bba0
+#
05bba0
+# Copyright (C) 2014 Red Hat, Inc.
05bba0
+#
05bba0
+# This program is free software; you can redistribute it and/or modify
05bba0
+# it under the terms of the GNU General Public License as published by
05bba0
+# the Free Software Foundation; either version 2 of the License, or
05bba0
+# (at your option) any later version.
05bba0
+#
05bba0
+# This program is distributed in the hope that it will be useful,
05bba0
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
05bba0
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
05bba0
+# GNU General Public License for more details.
05bba0
+#
05bba0
+# You should have received a copy of the GNU General Public License
05bba0
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
05bba0
+#
05bba0
+
05bba0
+# creator
05bba0
+owner=mreitz@redhat.com
05bba0
+
05bba0
+seq="$(basename $0)"
05bba0
+echo "QA output created by $seq"
05bba0
+
05bba0
+here="$PWD"
05bba0
+tmp=/tmp/$$
05bba0
+status=1	# failure is the default!
05bba0
+
05bba0
+_cleanup()
05bba0
+{
05bba0
+	_cleanup_test_img
05bba0
+}
05bba0
+trap "_cleanup; exit \$status" 0 1 2 3 15
05bba0
+
05bba0
+# get standard environment, filters and checks
05bba0
+. ./common.rc
05bba0
+. ./common.filter
05bba0
+
05bba0
+_supported_fmt qcow2
05bba0
+_supported_proto file
05bba0
+_supported_os Linux
05bba0
+
05bba0
+
05bba0
+IMG_SIZE=64K
05bba0
+
05bba0
+echo
05bba0
+echo '=== Updates should not write random data ==='
05bba0
+echo
05bba0
+
05bba0
+_make_test_img $IMG_SIZE
05bba0
+$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
05bba0
+$QEMU_IO -c "open -o driver=raw $TEST_IMG" -c 'read -p -P 0 196616 65528' \
05bba0
+    | _filter_qemu_io
05bba0
+
05bba0
+# success, all done
05bba0
+echo "*** done"
05bba0
+rm -f $seq.full
05bba0
+status=0
05bba0
+
05bba0
diff --git a/tests/qemu-iotests/107.out b/tests/qemu-iotests/107.out
05bba0
new file mode 100644
05bba0
index 0000000..93445b7
05bba0
--- /dev/null
05bba0
+++ b/tests/qemu-iotests/107.out
05bba0
@@ -0,0 +1,10 @@
05bba0
+QA output created by 107
05bba0
+
05bba0
+=== Updates should not write random data ===
05bba0
+
05bba0
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536 
05bba0
+wrote 65536/65536 bytes at offset 0
05bba0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
05bba0
+read 65528/65528 bytes at offset 196616
05bba0
+63.992 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
05bba0
+*** done
05bba0
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
05bba0
index cd8384a..dd3c5fe 100644
05bba0
--- a/tests/qemu-iotests/group
05bba0
+++ b/tests/qemu-iotests/group
05bba0
@@ -86,3 +86,4 @@
05bba0
 088 rw auto
05bba0
 092 rw auto quick
05bba0
 105 rw auto quick
05bba0
+107 rw auto quick
05bba0
-- 
05bba0
1.8.3.1
05bba0