Commit 21b43d00 authored by Thomas Huth's avatar Thomas Huth Committed by Max Reitz
Browse files

iotests: Check for enabled drivers before testing them



It is possible to enable only a subset of the block drivers with the
"--block-drv-rw-whitelist" option of the "configure" script. All other
drivers are marked as unusable (or only included as read-only with the
"--block-drv-ro-whitelist" option). If an iotest is now using such a
disabled block driver, it is failing - which is bad, since at least the
tests in the "auto" group should be able to deal with this situation.
Thus let's introduce a "_require_drivers" function that can be used by
the shell tests to check for the availability of certain drivers first,
and marks the test as "not run" if one of the drivers is missing.

This patch mainly targets the test in the "auto" group which should
never fail in such a case, but also improves some of the other tests
along the way. Note that we also assume that the "qcow2" and "file"
drivers are always available - otherwise it does not make sense to
run "make check-block" at all (which only tests with qcow2 by default).

Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Message-id: 20190823133552.11680-1-thuth@redhat.com
Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
parent 9da126fc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15

_supported_fmt qcow2
_supported_proto file
_require_drivers blkdebug blkverify

do_run_qemu()
{
+1 −3
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt raw
_supported_proto file
_supported_os Linux
_require_drivers quorum

do_run_qemu()
{
@@ -55,9 +56,6 @@ run_qemu()
                          | _filter_qemu_io | _filter_generated_node_ids
}

test_quorum=$($QEMU_IMG --help|grep quorum)
[ "$test_quorum" = "" ] && _supported_fmt quorum

quorum="driver=raw,file.driver=quorum,file.vote-threshold=2"
quorum="$quorum,file.children.0.file.filename=$TEST_DIR/1.raw"
quorum="$quorum,file.children.1.file.filename=$TEST_DIR/2.raw"
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc
_supported_proto file
_supported_os Linux
_require_drivers blkdebug blkverify
_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
    "subformat=twoGbMaxExtentSparse"

+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt generic
_supported_proto file
_unsupported_fmt luks
_require_drivers raw

_make_test_img 64M

+1 −3
Original line number Diff line number Diff line
@@ -39,9 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.filter

_supported_fmt generic

test_ssh=$($QEMU_IMG --help | grep '^Supported formats:.* ssh\( \|$\)')
[ "$test_ssh" = "" ] && _notrun "ssh support required"
_require_drivers ssh

echo
echo '=== NBD ==='
Loading