thebeanogamer / rpms / qemu-kvm

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