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