Blame SOURCES/kvm-qemu-iotests-Adjustments-due-to-error-propagation.patch

218e99
From aaf2d00ea8cd6479c5dd15773660e0699472af1c Mon Sep 17 00:00:00 2001
218e99
From: Max Reitz <mreitz@redhat.com>
218e99
Date: Thu, 7 Nov 2013 12:37:40 +0100
218e99
Subject: [PATCH 22/87] qemu-iotests: Adjustments due to error propagation
218e99
218e99
RH-Author: Max Reitz <mreitz@redhat.com>
218e99
Message-id: <1383604354-12743-25-git-send-email-mreitz@redhat.com>
218e99
Patchwork-id: 55324
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH 24/43] qemu-iotests: Adjustments due to error propagation
218e99
Bugzilla: 1026524
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Fam Zheng <famz@redhat.com>
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
218e99
BZ: 1026524
218e99
218e99
When opening/creating images, propagating errors instead of immediately
218e99
emitting them on occurrence results in errors generally being printed on
218e99
a single line rather than being split up into multiple ones. This in
218e99
turn requires adjustments to some test results.
218e99
218e99
Also, test 060 used a sed to filter out the test image directory and
218e99
format by removing everything from the affected line after a certain
218e99
keyword; this now also removes the error message itself, which can be
218e99
fixed by using _filter_testdir and _filter_imgfmt.
218e99
218e99
Finally, _make_test_img in common.rc did not filter out the test image
218e99
directory etc. from stderr. This has been fixed through a redirection of
218e99
stderr to stdout (which is already done in _check_test_img and
218e99
_img_info).
218e99
218e99
Signed-off-by: Max Reitz <mreitz@redhat.com>
218e99
(cherry picked from commit 2c78857bf6a9b5d06e17533b8f40fee14e087987)
218e99
218e99
Signed-off-by: Max Reitz <mreitz@redhat.com>
218e99
218e99
Conflicts:
218e99
	tests/qemu-iotests/054.out
218e99
	tests/qemu-iotests/060
218e99
	tests/qemu-iotests/060.out
218e99
218e99
Conflicts because these tests do not exist downstream.
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 tests/qemu-iotests/049.out   |   18 +++++++-----------
218e99
 tests/qemu-iotests/051.out   |   35 ++++++++++++-----------------------
218e99
 tests/qemu-iotests/common.rc |    2 +-
218e99
 3 files changed, 20 insertions(+), 35 deletions(-)
218e99
218e99
diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out
218e99
index 72db13f..96e83a4 100644
218e99
--- a/tests/qemu-iotests/049.out
218e99
+++ b/tests/qemu-iotests/049.out
218e99
@@ -96,7 +96,7 @@ qemu-img: Image size must be less than 8 EiB!
218e99
 
218e99
 qemu-img create -f qcow2 -o size=-1024 TEST_DIR/t.qcow2
218e99
 qemu-img: qcow2 doesn't support shrinking images yet
218e99
-qemu-img: Formatting or formatting option not supported for file format 'qcow2'
218e99
+qemu-img: TEST_DIR/t.qcow2: Could not resize image: Operation not supported
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=-1024 encryption=off cluster_size=65536 lazy_refcounts=off 
218e99
 
218e99
 qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- -1k
218e99
@@ -104,7 +104,7 @@ qemu-img: Image size must be less than 8 EiB!
218e99
 
218e99
 qemu-img create -f qcow2 -o size=-1k TEST_DIR/t.qcow2
218e99
 qemu-img: qcow2 doesn't support shrinking images yet
218e99
-qemu-img: Formatting or formatting option not supported for file format 'qcow2'
218e99
+qemu-img: TEST_DIR/t.qcow2: Could not resize image: Operation not supported
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=-1024 encryption=off cluster_size=65536 lazy_refcounts=off 
218e99
 
218e99
 qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- 1kilobyte
218e99
@@ -120,7 +120,7 @@ qemu-img: kilobytes, megabytes, gigabytes and terabytes.
218e99
 
218e99
 qemu-img create -f qcow2 -o size=foobar TEST_DIR/t.qcow2
218e99
 qemu-img: Parameter 'size' expects a size
218e99
-qemu-img: Invalid options for file format 'qcow2'.
218e99
+qemu-img: TEST_DIR/t.qcow2: Invalid options for file format 'qcow2'.
218e99
 
218e99
 == Check correct interpretation of suffixes for cluster size ==
218e99
 
218e99
@@ -163,13 +163,11 @@ qemu-img create -f qcow2 -o compat=1.1 TEST_DIR/t.qcow2 64M
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat='1.1' encryption=off cluster_size=65536 lazy_refcounts=off 
218e99
 
218e99
 qemu-img create -f qcow2 -o compat=0.42 TEST_DIR/t.qcow2 64M
218e99
-Invalid compatibility level: '0.42'
218e99
-qemu-img: TEST_DIR/t.qcow2: error while creating qcow2: Invalid argument
218e99
+qemu-img: TEST_DIR/t.qcow2: Invalid compatibility level: '0.42'
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat='0.42' encryption=off cluster_size=65536 lazy_refcounts=off 
218e99
 
218e99
 qemu-img create -f qcow2 -o compat=foobar TEST_DIR/t.qcow2 64M
218e99
-Invalid compatibility level: 'foobar'
218e99
-qemu-img: TEST_DIR/t.qcow2: error while creating qcow2: Invalid argument
218e99
+qemu-img: TEST_DIR/t.qcow2: Invalid compatibility level: 'foobar'
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat='foobar' encryption=off cluster_size=65536 lazy_refcounts=off 
218e99
 
218e99
 == Check preallocation option ==
218e99
@@ -181,8 +179,7 @@ qemu-img create -f qcow2 -o preallocation=metadata TEST_DIR/t.qcow2 64M
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off 
218e99
 
218e99
 qemu-img create -f qcow2 -o preallocation=1234 TEST_DIR/t.qcow2 64M
218e99
-Invalid preallocation mode: '1234'
218e99
-qemu-img: TEST_DIR/t.qcow2: error while creating qcow2: Invalid argument
218e99
+qemu-img: TEST_DIR/t.qcow2: Invalid preallocation mode: '1234'
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='1234' lazy_refcounts=off 
218e99
 
218e99
 == Check encryption option ==
218e99
@@ -205,8 +202,7 @@ qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=off TEST_DIR/t.qcow2 64M
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat='0.10' encryption=off cluster_size=65536 lazy_refcounts=off 
218e99
 
218e99
 qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=on TEST_DIR/t.qcow2 64M
218e99
-Lazy refcounts only supported with compatibility level 1.1 and above (use compat=1.1 or greater)
218e99
-qemu-img: TEST_DIR/t.qcow2: error while creating qcow2: Invalid argument
218e99
+qemu-img: TEST_DIR/t.qcow2: Lazy refcounts only supported with compatibility level 1.1 and above (use compat=1.1 or greater)
218e99
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 compat='0.10' encryption=off cluster_size=65536 lazy_refcounts=on 
218e99
 
218e99
 *** done
218e99
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
218e99
index e3cf244..fe0b347 100644
218e99
--- a/tests/qemu-iotests/051.out
218e99
+++ b/tests/qemu-iotests/051.out
218e99
@@ -4,20 +4,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
218e99
 === Unknown option ===
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=: could not open disk image TEST_DIR/t.qcow2: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=on
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=on: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=on: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=on: could not open disk image TEST_DIR/t.qcow2: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=1234
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=1234: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=1234: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=1234: could not open disk image TEST_DIR/t.qcow2: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: could not open disk image TEST_DIR/t.qcow2: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt'
218e99
 
218e99
 
218e99
 === Enable and disable lazy refcounting on the command line, plus some invalid values ===
218e99
@@ -31,24 +27,20 @@ QEMU X.Y.Z monitor - type 'help' for more information
218e99
 (qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: Parameter 'lazy-refcounts' expects 'on' or 'off'
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: could not open disk image TEST_DIR/t.qcow2: Parameter 'lazy-refcounts' expects 'on' or 'off'
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=42
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=42: Parameter 'lazy-refcounts' expects 'on' or 'off'
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=42: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=42: could not open disk image TEST_DIR/t.qcow2: Parameter 'lazy-refcounts' expects 'on' or 'off'
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=foo
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=foo: Parameter 'lazy-refcounts' expects 'on' or 'off'
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=foo: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=foo: could not open disk image TEST_DIR/t.qcow2: Parameter 'lazy-refcounts' expects 'on' or 'off'
218e99
 
218e99
 
218e99
 === With version 2 images enabling lazy refcounts must fail ===
218e99
 
218e99
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: Lazy refcounts require a qcow2 image with at least qemu 1.1 compatibility level
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: could not open disk image TEST_DIR/t.qcow2: Lazy refcounts require a qcow2 image with at least qemu 1.1 compatibility level
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
218e99
 QEMU X.Y.Z monitor - type 'help' for more information
218e99
@@ -162,21 +154,18 @@ QEMU X.Y.Z monitor - type 'help' for more information
218e99
 (qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: Can't use 'qcow2' as a block driver for the protocol level
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: could not open disk image TEST_DIR/t.qcow2: Invalid argument
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.driver=qcow2: could not open disk image TEST_DIR/t.qcow2: Can't use 'qcow2' as a block driver for the protocol level
218e99
 
218e99
 
218e99
 === Parsing protocol from file name ===
218e99
 
218e99
 Testing: -hda foo:bar
218e99
-QEMU_PROG: -hda foo:bar: Unknown protocol
218e99
-QEMU_PROG: -hda foo:bar: could not open disk image foo:bar: No such file or directory
218e99
+QEMU_PROG: -hda foo:bar: could not open disk image foo:bar: Unknown protocol
218e99
 
218e99
 Testing: -drive file=foo:bar
218e99
-QEMU_PROG: -drive file=foo:bar: Unknown protocol
218e99
-QEMU_PROG: -drive file=foo:bar: could not open disk image foo:bar: No such file or directory
218e99
+QEMU_PROG: -drive file=foo:bar: could not open disk image foo:bar: Unknown protocol
218e99
 
218e99
 Testing: -drive file.filename=foo:bar
218e99
-QEMU_PROG: -drive file.filename=foo:bar: could not open disk image ide0-hd0: No such file or directory
218e99
+QEMU_PROG: -drive file.filename=foo:bar: could not open disk image ide0-hd0: Could not open 'foo:bar': No such file or directory
218e99
 
218e99
 *** done
218e99
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
218e99
index 1187b86..764a3eb 100644
218e99
--- a/tests/qemu-iotests/common.rc
218e99
+++ b/tests/qemu-iotests/common.rc
218e99
@@ -123,7 +123,7 @@ _make_test_img()
218e99
     fi
218e99
 
218e99
     # XXX(hch): have global image options?
218e99
-    $QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size | \
218e99
+    $QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size 2>&1 | \
218e99
         sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
218e99
             -e "s#$TEST_DIR#TEST_DIR#g" \
218e99
             -e "s#$IMGFMT#IMGFMT#g" \
218e99
-- 
218e99
1.7.1
218e99