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