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

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: Thomas Huth <thuth@redhat.com>
Message-id: 20190823133552.11680-1-thuth@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>

authored by

Thomas Huth and committed by
Max Reitz
21b43d00 9da126fc

+21 -6
+1
tests/qemu-iotests/071
··· 38 38 39 39 _supported_fmt qcow2 40 40 _supported_proto file 41 + _require_drivers blkdebug blkverify 41 42 42 43 do_run_qemu() 43 44 {
+1 -3
tests/qemu-iotests/081
··· 41 41 _supported_fmt raw 42 42 _supported_proto file 43 43 _supported_os Linux 44 + _require_drivers quorum 44 45 45 46 do_run_qemu() 46 47 { ··· 54 55 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\ 55 56 | _filter_qemu_io | _filter_generated_node_ids 56 57 } 57 - 58 - test_quorum=$($QEMU_IMG --help|grep quorum) 59 - [ "$test_quorum" = "" ] && _supported_fmt quorum 60 58 61 59 quorum="driver=raw,file.driver=quorum,file.vote-threshold=2" 62 60 quorum="$quorum,file.children.0.file.filename=$TEST_DIR/1.raw"
+1
tests/qemu-iotests/099
··· 42 42 _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc 43 43 _supported_proto file 44 44 _supported_os Linux 45 + _require_drivers blkdebug blkverify 45 46 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ 46 47 "subformat=twoGbMaxExtentSparse" 47 48
+1
tests/qemu-iotests/120
··· 40 40 _supported_fmt generic 41 41 _supported_proto file 42 42 _unsupported_fmt luks 43 + _require_drivers raw 43 44 44 45 _make_test_img 64M 45 46
+1 -3
tests/qemu-iotests/162
··· 39 39 . ./common.filter 40 40 41 41 _supported_fmt generic 42 - 43 - test_ssh=$($QEMU_IMG --help | grep '^Supported formats:.* ssh\( \|$\)') 44 - [ "$test_ssh" = "" ] && _notrun "ssh support required" 42 + _require_drivers ssh 45 43 46 44 echo 47 45 echo '=== NBD ==='
+1
tests/qemu-iotests/184
··· 33 33 . ./common.filter 34 34 35 35 _supported_os Linux 36 + _require_drivers throttle 36 37 37 38 do_run_qemu() 38 39 {
+1
tests/qemu-iotests/186
··· 38 38 39 39 _supported_fmt qcow2 40 40 _supported_proto file 41 + _require_drivers null-co 41 42 42 43 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then 43 44 _notrun "Requires a PC machine"
+14
tests/qemu-iotests/common.rc
··· 520 520 [ -x "$c" ] || _notrun "$1 utility required, skipped this test" 521 521 } 522 522 523 + # Check that a set of drivers has been whitelisted in the QEMU binary 524 + # 525 + _require_drivers() 526 + { 527 + available=$($QEMU -drive format=help | \ 528 + sed -e '/Supported formats:/!d' -e 's/Supported formats://') 529 + for driver 530 + do 531 + if ! echo "$available" | grep -q " $driver\( \|$\)"; then 532 + _notrun "$driver not available" 533 + fi 534 + done 535 + } 536 + 523 537 # make sure this script returns success 524 538 true