Blame SOURCES/kvm-iotests-Rework-113.patch

1bdc94
From 73f4959d911f86e487a5ef0e9b0cecbbbc51ea2f Mon Sep 17 00:00:00 2001
1bdc94
From: Max Reitz <mreitz@redhat.com>
1bdc94
Date: Mon, 18 Jun 2018 14:59:43 +0200
1bdc94
Subject: [PATCH 09/89] iotests: Rework 113
1bdc94
1bdc94
RH-Author: Max Reitz <mreitz@redhat.com>
1bdc94
Message-id: <20180618145943.4489-8-mreitz@redhat.com>
1bdc94
Patchwork-id: 80757
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 7/7] iotests: Rework 113
1bdc94
Bugzilla: 1537956
1bdc94
RH-Acked-by: John Snow <jsnow@redhat.com>
1bdc94
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
1bdc94
1bdc94
This test case has been broken since 398e6ad014df261d (roughly half a
1bdc94
year).  qemu-img amend requires its output image to be R/W, so it opens
1bdc94
it as such; the node is then turned into an read-only node automatically
1bdc94
which is now accompanied by a warning, however.  This warning has not
1bdc94
been part of the reference output.
1bdc94
1bdc94
For one thing, this warning shows that we cannot keep the test case as
1bdc94
it is.  We would need a format that has no create_opts but that does
1bdc94
have write support -- we do not have such a format, though.
1bdc94
1bdc94
Another thing is that qemu now actually checks whether an image format
1bdc94
supports amendment instead of whether it has create_opts (since the
1bdc94
former always implies the latter).  So we can now use any format that
1bdc94
does not support amendment (even if it supports creation) and thus test
1bdc94
the same code path.
1bdc94
1bdc94
The reason nobody has noticed the breakage until now of course is the
1bdc94
fact that nobody runs the iotests for nbd+bochs.  There actually was
1bdc94
never any reason to set the protocol to "nbd" but because that was
1bdc94
technically correct; functionally it made no difference.  So that is the
1bdc94
first thing we are going to change: Make the protocol "file" instead so
1bdc94
that people might actually notice breakage here.
1bdc94
1bdc94
Secondly, now that bochs no longer works for the amend test case, we
1bdc94
have to change the format there anyway.  Set let us just bend the truth
1bdc94
a bit, declare this test a raw test.  In fact, that does not even
1bdc94
concern the bochs test cases, other than the output now reading 'bochs'
1bdc94
instead of 'IMGFMT'.
1bdc94
1bdc94
So with this test now being a raw test, we can rework the amend test
1bdc94
case to use raw instead.
1bdc94
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Reviewed-by: John Snow <jsnow@redhat.com>
1bdc94
Message-id: 20180509210023.20283-8-mreitz@redhat.com
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
(cherry picked from commit dee6ddd8a6b7978d0bc8ef8e1f006282ce30e4fa)
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 tests/qemu-iotests/113     | 19 +++++++++----------
1bdc94
 tests/qemu-iotests/113.out |  7 ++++---
1bdc94
 2 files changed, 13 insertions(+), 13 deletions(-)
1bdc94
1bdc94
diff --git a/tests/qemu-iotests/113 b/tests/qemu-iotests/113
1bdc94
index 19b68b2..4e09810 100755
1bdc94
--- a/tests/qemu-iotests/113
1bdc94
+++ b/tests/qemu-iotests/113
1bdc94
@@ -38,16 +38,17 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
1bdc94
 . ./common.rc
1bdc94
 . ./common.filter
1bdc94
 
1bdc94
-# We can only test one format here because we need its sample file
1bdc94
-_supported_fmt bochs
1bdc94
-_supported_proto nbd
1bdc94
+# Some of these test cases use bochs, but others do use raw, so this
1bdc94
+# is only half a lie.
1bdc94
+_supported_fmt raw
1bdc94
+_supported_proto file
1bdc94
 _supported_os Linux
1bdc94
 
1bdc94
 echo
1bdc94
 echo '=== Unsupported image creation in qemu-img create ==='
1bdc94
 echo
1bdc94
 
1bdc94
-$QEMU_IMG create -f $IMGFMT nbd://example.com 2>&1 64M | _filter_imgfmt
1bdc94
+$QEMU_IMG create -f bochs nbd://example.com 2>&1 64M
1bdc94
 
1bdc94
 echo
1bdc94
 echo '=== Unsupported image creation in qemu-img convert ==='
1bdc94
@@ -56,17 +57,15 @@ echo
1bdc94
 # We could use any input image format here, but this is a bochs test, so just
1bdc94
 # use the bochs image
1bdc94
 _use_sample_img empty.bochs.bz2
1bdc94
-$QEMU_IMG convert -f $IMGFMT -O $IMGFMT "$TEST_IMG" nbd://example.com 2>&1 \
1bdc94
-    | _filter_imgfmt
1bdc94
+$QEMU_IMG convert -f bochs -O bochs "$TEST_IMG" nbd://example.com
1bdc94
 
1bdc94
 echo
1bdc94
 echo '=== Unsupported format in qemu-img amend ==='
1bdc94
 echo
1bdc94
 
1bdc94
-# The protocol does not matter here
1bdc94
-_use_sample_img empty.bochs.bz2
1bdc94
-$QEMU_IMG amend -f $IMGFMT -o foo=bar "$TEST_IMG" 2>&1 | _filter_imgfmt
1bdc94
-
1bdc94
+TEST_IMG="$TEST_DIR/t.$IMGFMT"
1bdc94
+_make_test_img 1M
1bdc94
+$QEMU_IMG amend -f $IMGFMT -o size=2M "$TEST_IMG" 2>&1 | _filter_imgfmt
1bdc94
 
1bdc94
 # success, all done
1bdc94
 echo
1bdc94
diff --git a/tests/qemu-iotests/113.out b/tests/qemu-iotests/113.out
1bdc94
index 00bdfd6..3557e2b 100644
1bdc94
--- a/tests/qemu-iotests/113.out
1bdc94
+++ b/tests/qemu-iotests/113.out
1bdc94
@@ -2,14 +2,15 @@ QA output created by 113
1bdc94
 
1bdc94
 === Unsupported image creation in qemu-img create ===
1bdc94
 
1bdc94
-qemu-img: nbd://example.com: Format driver 'IMGFMT' does not support image creation
1bdc94
+qemu-img: nbd://example.com: Format driver 'bochs' does not support image creation
1bdc94
 
1bdc94
 === Unsupported image creation in qemu-img convert ===
1bdc94
 
1bdc94
-qemu-img: Format driver 'IMGFMT' does not support image creation
1bdc94
+qemu-img: Format driver 'bochs' does not support image creation
1bdc94
 
1bdc94
 === Unsupported format in qemu-img amend ===
1bdc94
 
1bdc94
-qemu-img: Format driver 'IMGFMT' does not support any options to amend
1bdc94
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
1bdc94
+qemu-img: Format driver 'IMGFMT' does not support option amendment
1bdc94
 
1bdc94
 *** done
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94