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