cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 72620f05ee7306dcdd209e0e527b7a4c92bcb98d Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Wed, 6 Nov 2013 16:53:24 +0100
9ae3a8
Subject: [PATCH 67/87] qemu-iotests: Try creating huge qcow2 image
9ae3a8
9ae3a8
RH-Author: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: <1383756824-6921-2-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 55556
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 01/21] qemu-iotests: Try creating huge qcow2 image
9ae3a8
Bugzilla: 980771
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
9ae3a8
BZ: 980771
9ae3a8
9ae3a8
It's supposed to fail gracefully instead of segfaulting.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit bd91ecbf5b43b52321c4d938e16a612b9c68bf06)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	tests/qemu-iotests/group
9ae3a8
9ae3a8
Conflicts because downstream contains more patches in the group file
9ae3a8
than upstream did at the time this patch was originally written.
9ae3a8
---
9ae3a8
 tests/qemu-iotests/054       | 58 ++++++++++++++++++++++++++++++++++++++++++++
9ae3a8
 tests/qemu-iotests/054.out   | 10 ++++++++
9ae3a8
 tests/qemu-iotests/common.rc |  2 +-
9ae3a8
 tests/qemu-iotests/group     |  1 +
9ae3a8
 4 files changed, 70 insertions(+), 1 deletion(-)
9ae3a8
 create mode 100755 tests/qemu-iotests/054
9ae3a8
 create mode 100644 tests/qemu-iotests/054.out
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/054       |   58 ++++++++++++++++++++++++++++++++++++++++++
9ae3a8
 tests/qemu-iotests/054.out   |   10 +++++++
9ae3a8
 tests/qemu-iotests/common.rc |    2 +-
9ae3a8
 tests/qemu-iotests/group     |    1 +
9ae3a8
 4 files changed, 70 insertions(+), 1 deletions(-)
9ae3a8
 create mode 100755 tests/qemu-iotests/054
9ae3a8
 create mode 100644 tests/qemu-iotests/054.out
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054
9ae3a8
new file mode 100755
9ae3a8
index 0000000..b360429
9ae3a8
--- /dev/null
9ae3a8
+++ b/tests/qemu-iotests/054
9ae3a8
@@ -0,0 +1,58 @@
9ae3a8
+#!/bin/bash
9ae3a8
+#
9ae3a8
+# Test huge qcow2 images
9ae3a8
+#
9ae3a8
+# Copyright (C) 2013 Red Hat, Inc.
9ae3a8
+#
9ae3a8
+# This program is free software; you can redistribute it and/or modify
9ae3a8
+# it under the terms of the GNU General Public License as published by
9ae3a8
+# the Free Software Foundation; either version 2 of the License, or
9ae3a8
+# (at your option) any later version.
9ae3a8
+#
9ae3a8
+# This program is distributed in the hope that it will be useful,
9ae3a8
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
9ae3a8
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9ae3a8
+# GNU General Public License for more details.
9ae3a8
+#
9ae3a8
+# You should have received a copy of the GNU General Public License
9ae3a8
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
9ae3a8
+#
9ae3a8
+
9ae3a8
+# creator
9ae3a8
+owner=kwolf@redhat.com
9ae3a8
+
9ae3a8
+seq=`basename $0`
9ae3a8
+echo "QA output created by $seq"
9ae3a8
+
9ae3a8
+here=`pwd`
9ae3a8
+tmp=/tmp/$$
9ae3a8
+status=1	# failure is the default!
9ae3a8
+
9ae3a8
+_cleanup()
9ae3a8
+{
9ae3a8
+	_cleanup_test_img
9ae3a8
+}
9ae3a8
+trap "_cleanup; exit \$status" 0 1 2 3 15
9ae3a8
+
9ae3a8
+# get standard environment, filters and checks
9ae3a8
+. ./common.rc
9ae3a8
+. ./common.filter
9ae3a8
+
9ae3a8
+_supported_fmt qcow2
9ae3a8
+_supported_proto generic
9ae3a8
+_supported_os Linux
9ae3a8
+
9ae3a8
+echo
9ae3a8
+echo "creating too large image (1 EB)"
9ae3a8
+_make_test_img $((1024*1024))T
9ae3a8
+
9ae3a8
+echo
9ae3a8
+echo "creating too large image (1 EB) using qcow2.py"
9ae3a8
+_make_test_img 4G
9ae3a8
+./qcow2.py $TEST_IMG set-header size $((1024 ** 6))
9ae3a8
+_check_test_img
9ae3a8
+
9ae3a8
+# success, all done
9ae3a8
+echo "*** done"
9ae3a8
+rm -f $seq.full
9ae3a8
+status=0
9ae3a8
diff --git a/tests/qemu-iotests/054.out b/tests/qemu-iotests/054.out
9ae3a8
new file mode 100644
9ae3a8
index 0000000..0b2fe30
9ae3a8
--- /dev/null
9ae3a8
+++ b/tests/qemu-iotests/054.out
9ae3a8
@@ -0,0 +1,10 @@
9ae3a8
+QA output created by 054
9ae3a8
+
9ae3a8
+creating too large image (1 EB)
9ae3a8
+qemu-img: The image size is too large for file format 'qcow2'
9ae3a8
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1152921504606846976 
9ae3a8
+
9ae3a8
+creating too large image (1 EB) using qcow2.py
9ae3a8
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4294967296 
9ae3a8
+qemu-img: Could not open 'TEST_DIR/t.qcow2': File too large
9ae3a8
+*** done
9ae3a8
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
9ae3a8
index 764a3eb..28b39e4 100644
9ae3a8
--- a/tests/qemu-iotests/common.rc
9ae3a8
+++ b/tests/qemu-iotests/common.rc
9ae3a8
@@ -173,7 +173,7 @@ _cleanup_test_img()
9ae3a8
 
9ae3a8
 _check_test_img()
9ae3a8
 {
9ae3a8
-    $QEMU_IMG check "$@" -f $IMGFMT $TEST_IMG 2>&1 | \
9ae3a8
+    $QEMU_IMG check "$@" -f $IMGFMT $TEST_IMG 2>&1 | _filter_testdir | \
9ae3a8
         sed -e '/allocated.*fragmented.*compressed clusters/d' \
9ae3a8
             -e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \
9ae3a8
             -e '/Image end offset: [0-9]\+/d'
9ae3a8
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
9ae3a8
index c841c5e..d02ee96 100644
9ae3a8
--- a/tests/qemu-iotests/group
9ae3a8
+++ b/tests/qemu-iotests/group
9ae3a8
@@ -60,6 +60,7 @@
9ae3a8
 051 rw auto
9ae3a8
 052 rw auto backing
9ae3a8
 053 rw auto
9ae3a8
+054 rw auto
9ae3a8
 059 rw auto
9ae3a8
 060 rw auto
9ae3a8
 063 rw auto
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8