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

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