9ae3a8
From f42cefd020d8fcd3a2b9ef2007af6fc473d628a5 Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Wed, 22 Jul 2015 16:24:57 +0200
9ae3a8
Subject: [PATCH 5/5] iotests: Add test for non-existing backing file
9ae3a8
9ae3a8
Message-id: <1437582297-9244-4-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 67108
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 3/3] iotests: Add test for non-existing backing file
9ae3a8
Bugzilla: 1238639
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
Test the error message when a COW file is about to be created which is
9ae3a8
supposed to inherit the size of its backing file, while the backing file
9ae3a8
given does not actually exist.
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Peter Lieven <pl@kamp.de>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit c4d01535dcc2c6a573c03a85a9b7502d15f2bb45)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	tests/qemu-iotests/group
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/111     | 53 ++++++++++++++++++++++++++++++++++++++++++++++
9ae3a8
 tests/qemu-iotests/111.out |  3 +++
9ae3a8
 tests/qemu-iotests/group   |  1 +
9ae3a8
 3 files changed, 57 insertions(+)
9ae3a8
 create mode 100755 tests/qemu-iotests/111
9ae3a8
 create mode 100644 tests/qemu-iotests/111.out
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111
9ae3a8
new file mode 100755
9ae3a8
index 0000000..6011c94
9ae3a8
--- /dev/null
9ae3a8
+++ b/tests/qemu-iotests/111
9ae3a8
@@ -0,0 +1,53 @@
9ae3a8
+#!/bin/bash
9ae3a8
+#
9ae3a8
+# Test case for non-existing backing file when creating a qcow2 image
9ae3a8
+# and not specifying the size
9ae3a8
+#
9ae3a8
+# Copyright (C) 2014 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=mreitz@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 qed qcow qcow2 vmdk
9ae3a8
+_supported_proto file
9ae3a8
+_supported_os Linux
9ae3a8
+_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
9ae3a8
+
9ae3a8
+$QEMU_IMG create -f $IMGFMT -b "$TEST_IMG.inexistent" "$TEST_IMG" 2>&1 \
9ae3a8
+    | _filter_testdir | _filter_imgfmt
9ae3a8
+
9ae3a8
+# success, all done
9ae3a8
+echo '*** done'
9ae3a8
+rm -f $seq.full
9ae3a8
+status=0
9ae3a8
diff --git a/tests/qemu-iotests/111.out b/tests/qemu-iotests/111.out
9ae3a8
new file mode 100644
9ae3a8
index 0000000..683c01a
9ae3a8
--- /dev/null
9ae3a8
+++ b/tests/qemu-iotests/111.out
9ae3a8
@@ -0,0 +1,3 @@
9ae3a8
+QA output created by 111
9ae3a8
+qemu-img: TEST_DIR/t.IMGFMT: Could not open 'TEST_DIR/t.IMGFMT.inexistent': No such file or directory
9ae3a8
+*** done
9ae3a8
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
9ae3a8
index 739c266..0644c42 100644
9ae3a8
--- a/tests/qemu-iotests/group
9ae3a8
+++ b/tests/qemu-iotests/group
9ae3a8
@@ -88,6 +88,7 @@
9ae3a8
 105 rw auto quick
9ae3a8
 107 rw auto quick
9ae3a8
 108 rw auto quick
9ae3a8
+111 rw auto quick
9ae3a8
 114 rw auto quick
9ae3a8
 121 rw auto
9ae3a8
 130 rw auto quick
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8