iotests: Check for enabled drivers before testing them
PATCH v2 1/1 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).
---
v2:
- Update the check in _require_drivers() according to Max' suggestion
- Remove superfluous check in test 081
- Mark 120 to require "raw"
- Replaced the check in 162 to use the new _require_drivers() function
- Mark 186 to require "null-co"
tests/qemu-iotests/071 | 1 + tests/qemu-iotests/081 | 4 +--- tests/qemu-iotests/099 | 1 + tests/qemu-iotests/120 | 1 + tests/qemu-iotests/162 | 4 +--- tests/qemu-iotests/184 | 1 + tests/qemu-iotests/186 | 1 + tests/qemu-iotests/common.rc | 14 ++++++++++++++ 8 files changed, 21 insertions(+), 6 deletions(-)
tests/qemu-iotests/071 +1 -0
@@ -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() {
tests/qemu-iotests/081 +1 -3
@@ -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"
tests/qemu-iotests/099 +1 -0
@@ -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"
tests/qemu-iotests/120 +1 -0
@@ -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
tests/qemu-iotests/162 +1 -3
@@ -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 ==='
tests/qemu-iotests/184 +1 -0
@@ -33,6 +33,7 @@ trap "exit \$status" 0 1 2 3 15 . ./common.filter _supported_os Linux +_require_drivers throttle do_run_qemu() {
tests/qemu-iotests/186 +1 -0
@@ -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"
tests/qemu-iotests/common.rc +14 -0
@@ -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
Signature · 1 line
2.18.1
Max Reitz
AppliedQuoted 25 lines · Thomas Huth
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 <[email protected]>---
v2:
- Update the check in_require_drivers()according to Max' suggestion
- Remove superfluous check in test 081
- Mark 120 to require "raw"
- Replaced the check in 162 to use the new_require_drivers()function
- Mark 186 to require "null-co"
Quoted 9 lines
tests/qemu-iotests/071 | 1 + tests/qemu-iotests/081 | 4 +--- tests/qemu-iotests/099 | 1 + tests/qemu-iotests/120 | 1 + tests/qemu-iotests/162 | 4 +--- tests/qemu-iotests/184 | 1 + tests/qemu-iotests/186 | 1 + tests/qemu-iotests/common.rc | 14 ++++++++++++++ 8 files changed, 21 insertions(+), 6 deletions(-)
Thanks, applied to my block branch:
https://git.xanclic.moe/XanClic/qemu/commits/branch/block
Max
Quoted 25 lines · Thomas Huth
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 <[email protected]>---
v2:
- Update the check in_require_drivers()according to Max' suggestion
- Remove superfluous check in test 081
- Mark 120 to require "raw"
- Replaced the check in 162 to use the new_require_drivers()function
- Mark 186 to require "null-co"
Quoted 9 lines
tests/qemu-iotests/071 | 1 + tests/qemu-iotests/081 | 4 +--- tests/qemu-iotests/099 | 1 + tests/qemu-iotests/120 | 1 + tests/qemu-iotests/162 | 4 +--- tests/qemu-iotests/184 | 1 + tests/qemu-iotests/186 | 1 + tests/qemu-iotests/common.rc | 14 ++++++++++++++ 8 files changed, 21 insertions(+), 6 deletions(-)
This patch breaks these iotests when $DISPLAY is not set. It does work with “iotests: Add -display none to the qemu options”.
Hm. You reviewed that one, so I suppose I’ll just take it into v2 of my pull request as well.
(I’m not going to say having added the iotests to make check gives me as a maintainer more trouble than I had before, but, you know.)
Max
Quoted 36 lines · Max Reitz
Quoted 25 lines · Thomas Huth
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 <[email protected]>---
v2:
- Update the check in_require_drivers()according to Max' suggestion
- Remove superfluous check in test 081
- Mark 120 to require "raw"
- Replaced the check in 162 to use the new_require_drivers()function
- Mark 186 to require "null-co"Quoted 9 lines
tests/qemu-iotests/071 | 1 + tests/qemu-iotests/081 | 4 +--- tests/qemu-iotests/099 | 1 + tests/qemu-iotests/120 | 1 + tests/qemu-iotests/162 | 4 +--- tests/qemu-iotests/184 | 1 + tests/qemu-iotests/186 | 1 + tests/qemu-iotests/common.rc | 14 ++++++++++++++ 8 files changed, 21 insertions(+), 6 deletions(-)
Quoted 5 lines
This patch breaks these iotests when $DISPLAY is not set. It does work with “iotests: Add -display none to the qemu options”.
Hm. You reviewed that one, so I suppose I’ll just take it into v2 of my pull request as well.
Sounds like the righ way to go, thanks!
Quoted 2 lines
(I’m not going to say having added the iotests to make check gives me as a maintainer more trouble than I had before, but, you know.)
I expected some initial trouble, since the iotests now get exposed to much more different systems. But I hope it will pay off in the long run! (Remember the 4.1 development cycles? The iotests have been completely broken in the master branch by accident two or three times ... I hope at least those days will now be gone or at least not happen that often anymore)
Thomas