]> git.proxmox.com Git - mirror_qemu.git/commitdiff
iotests: Check for enabled drivers before testing them
authorThomas Huth <thuth@redhat.com>
Fri, 23 Aug 2019 13:35:52 +0000 (15:35 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 3 Sep 2019 12:56:06 +0000 (14:56 +0200)
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>
tests/qemu-iotests/071
tests/qemu-iotests/081
tests/qemu-iotests/099
tests/qemu-iotests/120
tests/qemu-iotests/162
tests/qemu-iotests/184
tests/qemu-iotests/186
tests/qemu-iotests/common.rc

index 1cca9233d09d72f9a8c09163b42aaa47f6fb5b9f..fab526666b0f0b1268c9e6de0ebc8dbda07dd22c 100755 (executable)
@@ -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()
 {
index c418bab0937b655c97b6615e72dd0d715f0427d5..85acdf76d4386658d6c93e66bb719e6b985c137a 100755 (executable)
@@ -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"
index ae02f27afe30af48db4887e56027c94a6c4cae6a..c3cf66798a9c98726c4ba7d1ccb386e257325c6e 100755 (executable)
@@ -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"
 
index e9b4fbb00954caf1437bbf9e2d6e44c9f3341cab..2931a7550f9f6ef1a27c54590325a6cf25382035 100755 (executable)
@@ -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
 
index 4e5ed74fd5874f31d9d4af2f9da6331cd355aac3..2d719afbeda9a7206add2b216f90641a01f6743d 100755 (executable)
@@ -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 ==='
index cb0c181228b56f0a74b4a0974a620002ac9b892a..33dd8d2a4fc8e3c785d100767ecd25c048a81b09 100755 (executable)
@@ -33,6 +33,7 @@ trap "exit \$status" 0 1 2 3 15
 . ./common.filter
 
 _supported_os Linux
+_require_drivers throttle
 
 do_run_qemu()
 {
index 5f6b18c150e3f69c3538583ee10e77e76c6331e8..3ea0442d44fcaa7d079f080baf2730281ac96d99 100755 (executable)
@@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
+_require_drivers null-co
 
 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
     _notrun "Requires a PC machine"
index 5502c3da2f879c54c7385e96048194c9b8532cfd..ee20be8920d411bcf79203eb794a97567ed139bf 100644 (file)
@@ -520,5 +520,19 @@ _require_command()
     [ -x "$c" ] || _notrun "$1 utility required, skipped this test"
 }
 
+# Check that a set of drivers has been whitelisted in the QEMU binary
+#
+_require_drivers()
+{
+    available=$($QEMU -drive format=help | \
+                sed -e '/Supported formats:/!d' -e 's/Supported formats://')
+    for driver
+    do
+        if ! echo "$available" | grep -q " $driver\( \|$\)"; then
+            _notrun "$driver not available"
+        fi
+    done
+}
+
 # make sure this script returns success
 true