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