qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

iotests: Rework 113

This test case has been broken since 398e6ad014df261d (roughly half a
year). qemu-img amend requires its output image to be R/W, so it opens
it as such; the node is then turned into an read-only node automatically
which is now accompanied by a warning, however. This warning has not
been part of the reference output.

For one thing, this warning shows that we cannot keep the test case as
it is. We would need a format that has no create_opts but that does
have write support -- we do not have such a format, though.

Another thing is that qemu now actually checks whether an image format
supports amendment instead of whether it has create_opts (since the
former always implies the latter). So we can now use any format that
does not support amendment (even if it supports creation) and thus test
the same code path.

The reason nobody has noticed the breakage until now of course is the
fact that nobody runs the iotests for nbd+bochs. There actually was
never any reason to set the protocol to "nbd" but because that was
technically correct; functionally it made no difference. So that is the
first thing we are going to change: Make the protocol "file" instead so
that people might actually notice breakage here.

Secondly, now that bochs no longer works for the amend test case, we
have to change the format there anyway. Set let us just bend the truth
a bit, declare this test a raw test. In fact, that does not even
concern the bochs test cases, other than the output now reading 'bochs'
instead of 'IMGFMT'.

So with this test now being a raw test, we can rework the amend test
case to use raw instead.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20180509210023.20283-8-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>

+13 -13
+9 -10
tests/qemu-iotests/113
··· 38 38 . ./common.rc 39 39 . ./common.filter 40 40 41 - # We can only test one format here because we need its sample file 42 - _supported_fmt bochs 43 - _supported_proto nbd 41 + # Some of these test cases use bochs, but others do use raw, so this 42 + # is only half a lie. 43 + _supported_fmt raw 44 + _supported_proto file 44 45 _supported_os Linux 45 46 46 47 echo 47 48 echo '=== Unsupported image creation in qemu-img create ===' 48 49 echo 49 50 50 - $QEMU_IMG create -f $IMGFMT nbd://example.com 2>&1 64M | _filter_imgfmt 51 + $QEMU_IMG create -f bochs nbd://example.com 2>&1 64M 51 52 52 53 echo 53 54 echo '=== Unsupported image creation in qemu-img convert ===' ··· 56 57 # We could use any input image format here, but this is a bochs test, so just 57 58 # use the bochs image 58 59 _use_sample_img empty.bochs.bz2 59 - $QEMU_IMG convert -f $IMGFMT -O $IMGFMT "$TEST_IMG" nbd://example.com 2>&1 \ 60 - | _filter_imgfmt 60 + $QEMU_IMG convert -f bochs -O bochs "$TEST_IMG" nbd://example.com 61 61 62 62 echo 63 63 echo '=== Unsupported format in qemu-img amend ===' 64 64 echo 65 65 66 - # The protocol does not matter here 67 - _use_sample_img empty.bochs.bz2 68 - $QEMU_IMG amend -f $IMGFMT -o foo=bar "$TEST_IMG" 2>&1 | _filter_imgfmt 69 - 66 + TEST_IMG="$TEST_DIR/t.$IMGFMT" 67 + _make_test_img 1M 68 + $QEMU_IMG amend -f $IMGFMT -o size=2M "$TEST_IMG" 2>&1 | _filter_imgfmt 70 69 71 70 # success, all done 72 71 echo
+4 -3
tests/qemu-iotests/113.out
··· 2 2 3 3 === Unsupported image creation in qemu-img create === 4 4 5 - qemu-img: nbd://example.com: Format driver 'IMGFMT' does not support image creation 5 + qemu-img: nbd://example.com: Format driver 'bochs' does not support image creation 6 6 7 7 === Unsupported image creation in qemu-img convert === 8 8 9 - qemu-img: Format driver 'IMGFMT' does not support image creation 9 + qemu-img: Format driver 'bochs' does not support image creation 10 10 11 11 === Unsupported format in qemu-img amend === 12 12 13 - qemu-img: Format driver 'IMGFMT' does not support any options to amend 13 + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 14 + qemu-img: Format driver 'IMGFMT' does not support option amendment 14 15 15 16 *** done