tests: do more testing of block drivers
PATCH v8 1/16 python: bump qemu.qmp to v0.0.6
In reply to Daniel P. BerrangéFrom: John Snow <[email protected]>
This release removes some deprecated warnings for our use of the old sendmsg API on older python versions.
---
python/scripts/vendor.py | 4 ++--
...ny.whl => qemu_qmp-0.0.6-py3-none-any.whl} | Bin 72263 -> 72379 bytes
pythondeps.toml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename python/wheels/{qemu_qmp-0.0.5-py3-none-any.whl => qemu_qmp-0.0.6-py3-none-any.whl} (64%)python/scripts/vendor.py +2 -2
@@ -43,8 +43,8 @@ def main() -> int: packages = { "meson==1.11.1": "9b3a023657e393dbc5335b95c561337d49b7a458f5541e47ec44f2cc566e0d80", - "qemu.qmp==0.0.5": - "e05782d6df5844b34e0d2f7c68693525da074deef7b641c1401dda6e4e3d6303", + "qemu.qmp==0.0.6": + "5d7c5af0e9de427696e3bf72e333965c3a697929f77f6b7ddc30c989fc7b539b", "pycotap==1.3.1": "1c3a25b3ff89e48f4e00f1f71dbbc1642b4f65c65d416524d07e73492fff25ea", }
python/wheels/qemu_qmp-0.0.6-py3-none-any.whl renamed from python/wheels/qemu_qmp-0.0.5-py3-none-any.whl binary +0 -0
pythondeps.toml +1 -1
@@ -36,7 +36,7 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } # only include dependencies that can be guaranteed via configure from # system packages, or python packages we vendor. [tooling] -"qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } +"qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.6" } "qemu" = { path = "python/" } # NB: The following dependencies should be a little bit more modern than # the versions listed here, but we are still using Debian 11 for several
Signature · 1 line
2.54.0
PATCH v8 2/16 gitlab: ensure all meson jobs capture build/meson-logs by default
In reply to Daniel P. BerrangéThe build-without-defaults and build-tci jobs do not capture any artifacts, despite running 'make check'. This has proved a repeated bug with CI jobs, so introduce a new '.meson_job_template' rule which always captures 'build/meson-logs'. Jobs can still provide their own 'artifacts:' config which will override this default behaviour.
--- .gitlab-ci.d/buildtest-template.yml | 30 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
.gitlab-ci.d/buildtest-template.yml +19 -11
@@ -1,5 +1,20 @@ -.native_build_job_template: + +# Any job running meson should capture meson logs +# by default. Some jobs might override the artifacts +# to capture further files +.meson_job_template: extends: .base_job_template + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + when: always + expire_in: 7 days + paths: + - build/meson-logs + reports: + junit: build/meson-logs/*.junit.xml + +.native_build_job_template: + extends: .meson_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG cache:
@@ -60,7 +75,7 @@ - build/**/*.c.o.d .common_test_job_template: - extends: .base_job_template + extends: .meson_job_template stage: test image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG script:
@@ -87,14 +102,7 @@ # Prevent logs from the build job that run earlier # from being duplicated in the test job artifacts - rm -f build/meson-logs/* - artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - when: always - expire_in: 7 days - paths: - - build/meson-logs - reports: - junit: build/meson-logs/*.junit.xml + .functional_test_job_template: extends: .common_test_job_template
@@ -125,7 +133,7 @@ QEMU_JOB_FUNCTIONAL: 1 .wasm_build_job_template: - extends: .base_job_template + extends: .meson_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG before_script:
Signature · 1 line
2.54.0
PATCH v8 5/16 iotests: ensure all qcow2 I/O tests are able to be run via make
In reply to Daniel P. BerrangéFor block formats marked as 'quick', only tests in the 'auto' group are added to the meson test suite.
The result of this is that qcow2 tests not in the 'auto' group cannot be run at all, even if passing SPEED=slow or SPEED=thorough.
To fix this we need todo two passes over the I/O test list. First add all tests from 'auto' group into the 'block' suite, so they are run by default. Then on the second pass add any tests which were not in 'auto' into the 'block-slow' suite, so they get run when SPEED=slow or SPEED=thorough.
--- tests/qemu-iotests/meson.build | 48 ++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-)
tests/qemu-iotests/meson.build +43 -5
@@ -30,16 +30,48 @@ endforeach qemu_iotests_check_cmd = files('check') foreach format, speed: qemu_iotests_formats + # Formats tagged 'quick' get the subset of tests in the 'auto' + # group, run by default with 'make check' / 'make check-block' + seen = [] if speed == 'quick' - suites = 'block' + args = ['-tap', '-' + format, '-g', 'auto'] + suites = ['block'] + + rc = run_command( + [python, qemu_iotests_check_cmd] + args + ['-n'], + check: true, + ) + + foreach item: rc.stdout().strip().split() + seen += item + args = [qemu_iotests_check_cmd, + '-tap', '-' + format, item, + '--source-dir', meson.current_source_dir(), + '--build-dir', meson.current_build_dir()] + # Some individual tests take as long as 45 seconds + # Bump the timeout to 3 minutes for some headroom + # on slow machines to minimize spurious failures + test('io-' + format + '-' + item, + python, + args: args, + depends: qemu_iotests_binaries, + env: qemu_iotests_env, + protocol: 'tap', + timeout: 180, + suite: suites) + endforeach + endif + + suites = [] + # Any format tagged quick or slow also gets added to slow + # otherwise its tagged thorough + if speed != 'thorough' + suites += ['block-slow'] else - suites = ['block-' + speed] + suites += ['block-thorough'] endif args = ['-tap', '-' + format] - if speed == 'quick' - args += ['-g', 'auto'] - endif rc = run_command( [python, qemu_iotests_check_cmd] + args + ['-n'],
@@ -47,6 +79,12 @@ foreach format, speed: qemu_iotests_formats ) foreach item: rc.stdout().strip().split() + # Skip any tests already added from the 'auto' group + # as they're run in the 'quick' suite already + if item in seen + continue + endif + args = [qemu_iotests_check_cmd, '-tap', '-' + format, item, '--source-dir', meson.current_source_dir(),
Signature · 1 line
2.54.0
PATCH v8 8/16 iotests: add a meson suite / make target per block I/O tests format
In reply to Daniel P. BerrangéCurrently each block format is classified as either 'quick', 'slow' or 'thorough' and this controls whether its I/O tests are added to the meson suites 'block-quick', 'block-slow' or 'block-thorough'.
This suites are exposed the 'check-block' make target, accepting the optional SPEED variable.
As we add more formats to the 'thorough' group, however, it becomes increasingly large and time consuming to run. What is needed is a make target that can exercise all tests for an individual format, regardless of speed classification.
This makes use of the previous enhancement to mtest2make.py to introduce new meson suites 'block-$FORMAT-optional', which translate to new top level make targets 'check-block-$FORMAT'. These new targets always run all tests and as such do not need the SPEED variable to be set, but are not triggered by 'make check' or 'make check-block'.
--- tests/Makefile.include | 3 ++- tests/qemu-iotests/meson.build | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
tests/Makefile.include +2 -1
@@ -14,7 +14,8 @@ check-help: @echo " $(MAKE) check-unit Run qobject tests" @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" @echo " $(MAKE) check-tracetool Run tracetool generator tests" - @echo " $(MAKE) check-block Run block tests" + @echo " $(MAKE) check-block Run block tests (all formats)" + @echo " $(MAKE) check-block-FORMAT Run block tests (only for FORMAT)" ifneq ($(filter $(all-check-targets), check-softfloat),) @echo " $(MAKE) check-softfloat Run FPU emulation tests" @echo " $(MAKE) check-tcg Run TCG tests"
tests/qemu-iotests/meson.build +2 -1
@@ -62,7 +62,8 @@ foreach format, speed: qemu_iotests_formats endforeach endif - suites = [] + # Every format gets put in the format specific suite + suites = ['block-' + format + '-optional'] # Any format tagged quick or slow also gets added to slow # otherwise its tagged thorough if speed != 'thorough'
Signature · 1 line
2.54.0
PATCH v8 3/16 iotests: print reason when I/O test is skipped in TAP mode
In reply to Daniel P. BerrangéThe TAP output on a skipped test:
ok raw 181 # SKIP
is not informative.
The test program included a reason, and that should be displayed in TAP mode (it is already shown in non-TAP mode):
ok raw 181 # SKIP Postcopy is not supported
--- tests/qemu-iotests/testrunner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testrunner.py +1 -1
@@ -174,7 +174,7 @@ def test_print_one_line(self, test: str, elif status == 'fail': print(f'not ok {self.env.imgfmt} {test}') elif status == 'not run': - print(f'ok {self.env.imgfmt} {test} # SKIP') + print(f'ok {self.env.imgfmt} {test} # SKIP {description}') return if lasttime:
Signature · 1 line
2.54.0
PATCH v8 6/16 scripts/mtest2make: ensure output has stable sorting
In reply to Daniel P. BerrangéWhen debugging mtest2make.py changes it is important to be able to compare the old and new output. This requires that any lists in the output have stable sort ordering.
--- scripts/mtest2make.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
scripts/mtest2make.py +6 -4
@@ -67,8 +67,10 @@ def process_tests(test, targets, suites): suites[s].speeds.add('thorough') def emit_prolog(suites, prefix): - all_targets = ' '.join((f'{prefix}-{k}' for k in suites.keys())) - all_xml = ' '.join((f'{prefix}-report-{k}.junit.xml' for k in suites.keys())) + all_targets = ' '.join((f'{prefix}-{k}' + for k in sorted(suites.keys()))) + all_xml = ' '.join((f'{prefix}-report-{k}.junit.xml' + for k in sorted(suites.keys()))) print() print(f'all-{prefix}-targets = {all_targets}') print(f'all-{prefix}-xml = {all_xml}')
@@ -81,12 +83,12 @@ def emit_prolog(suites, prefix): print(f'\t$(MAKE) {prefix}$* MTESTARGS="$(MTESTARGS) --logbase {prefix}-report$*" && ln -f meson-logs/$@ .') def emit_suite(name, suite, prefix): - deps = ' '.join(suite.deps) + deps = ' '.join(sorted(suite.deps)) print() print(f'.{prefix}-{name}.deps = {deps}') print(f'.ninja-goals.check-build += $(.{prefix}-{name}.deps)') - names = ' '.join(suite.names(name)) + names = ' '.join(sorted(suite.names(name))) targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml' if not name.endswith('-slow') and not name.endswith('-thorough'): targets += f' {prefix} {prefix}-report.junit.xml'
Signature · 1 line
2.54.0
PATCH v8 4/16 iotests: remove redundant meson suite for iotests
In reply to Daniel P. BerrangéIf a test is in the 'block-slow' or 'block-thorough' suite, there is no need to also add it to the 'slow' or 'thorough' suites.
--- tests/qemu-iotests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/meson.build +1 -1
@@ -33,7 +33,7 @@ foreach format, speed: qemu_iotests_formats if speed == 'quick' suites = 'block' else - suites = ['block-' + speed, speed] + suites = ['block-' + speed] endif args = ['-tap', '-' + format]
Signature · 1 line
2.54.0
PATCH v8 13/16 iotests: fix check for sudo access in LUKS I/O test
In reply to Daniel P. BerrangéThe test did not cope with the possibility that 'sudo' was not installed at all, merely that it was not configured. This broke tests in any CI env which lacks 'sudo'.
--- tests/qemu-iotests/149 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
tests/qemu-iotests/149 +8 -5
@@ -95,11 +95,14 @@ def verify_passwordless_sudo(): args = ["sudo", "-n", "/bin/true"] - proc = subprocess.Popen(args, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - universal_newlines=True) + try: + proc = subprocess.Popen(args, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + universal_newlines=True) + except FileNotFoundError as e: + iotests.notrun('requires sudo binary: %s' % e) msg = proc.communicate()[0]
Signature · 1 line
2.54.0
PATCH v8 12/16 iotests: validate dmsetup result in test 128
In reply to Daniel P. BerrangéThe I/O test 128 uses 'dmsetup create' to create a device, optionally using sudo to elevate privileges.
This dmsetup command works in GitLab CI, however, the test then fails with a missing device name:
1..1
# running raw 128 not ok raw 128 ----------------------------------- stderr ----------------------------------- --- /builds/berrange/qemu/tests/qemu-iotests/128.out +++ /builds/berrange/qemu/build/scratch/raw-file-128/128.out.bad @@ -1,5 +1,5 @@ QA output created by 128
== reading from error device ==
-read failed: Input/output error
+qemu-io: can't open device /dev/mapper/eiodev16546: Could not open '/dev/mapper/eiodev16546': No such file or directory
*** done
(test program exited with status code 1)
It is believed that this is due to the build env using a manually populated /dev, such that the device mapper node won't ever appear. It is not a race, since a test adding a sleep did not result in the device appearing.
--- tests/qemu-iotests/128 | 6 ++++++ 1 file changed, 6 insertions(+)
tests/qemu-iotests/128 +6 -0
@@ -42,6 +42,12 @@ _setup_eiodev() echo "0 $((1024 * 1024 * 1024 / 512)) error" | \ $cmd dmsetup create "$devname" 2>/dev/null if [ "$?" -eq 0 ]; then + DEV="/dev/mapper/$devname" + if ! -e $DEV + then + _notrun "Device $DEV not appearing" + fi + sudo="$cmd" return fi
Signature · 1 line
2.54.0
PATCH v8 16/16 gitlab: remove I/O tests from build-tcg-disabled job
In reply to Daniel P. BerrangéNow that we have dedicated CI jobs for running I/O tests on each supported format/protocol, we no longer need to special case a run of a hand picked set of tests in the build-tcg-disabled job.
--- .gitlab-ci.d/buildtest.yml | 9 --------- 1 file changed, 9 deletions(-)
.gitlab-ci.d/buildtest.yml +0 -9
@@ -366,15 +366,6 @@ build-tcg-disabled: - make -j"$JOBS" - make check-unit - make check-qapi-schema - - ./run tests/qemu-iotests/check -raw 001 002 003 004 005 008 009 - 010 011 012 021 025 032 033 048 052 063 077 086 101 104 106 - 113 148 150 151 152 157 159 160 163 170 171 184 192 194 208 - 221 226 227 236 253 277 image-fleecing - - ./run tests/qemu-iotests/check -qcow2 028 051 056 057 058 065 068 - 082 085 091 095 096 102 122 124 132 139 142 144 145 151 152 - 155 157 165 194 196 200 202 208 209 216 218 227 234 246 247 - 248 250 254 255 257 258 260 261 262 263 264 270 272 273 277 - 279 image-fleecing - make distclean build-user:
Signature · 1 line
2.54.0
PATCH v8 14/16 iotests: mark 185 as a flaky test
In reply to Daniel P. BerrangéIntroduce a "_flaky_test" function for I/O tests which accepts a GitLab issue URL, and causes the I/O test to be skipped unless the $QEMU_TEST_FLAKY_TESTS environment variable is set.
This is used by test 185 which currently fails in GitLab CI for unknown reasons.
--- tests/qemu-iotests/185 | 1 + tests/qemu-iotests/common.rc | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)
tests/qemu-iotests/185 +1 -0
@@ -50,6 +50,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +_flaky_test https://gitlab.com/qemu-project/qemu/-/issues/3270 size=$((64 * 1048576)) TEST_IMG="${TEST_IMG}.base" _make_test_img $size
tests/qemu-iotests/common.rc +16 -0
@@ -1088,5 +1088,21 @@ _qcow2_dump_header() fi } +# This must be referenced after any _require_ lines, so that +# test filtering happens first +_flaky_test() +{ + if test -z "$1" + then + echo "A GitLab issue URL must be provided for a flaky test" + exit 1 + fi + + if test -z "$QEMU_TEST_FLAKY_TESTS" + then + _notrun "Test is flaky (see $1) and \$QEMU_TEST_FLAKY_TESTS is not set" + fi +} + # make sure this script returns success true
Signature · 1 line
2.54.0
PATCH v8 11/16 iotests: use 'driver' as collective term for either format or protocol
In reply to Daniel P. BerrangéThe I/O tests integration previously exclusively tested block formats and now also covers the NBD protocol. Replace references to 'format' with 'driver', as a generic term to collectively apply to either a format or protocol.
--- docs/devel/testing/main.rst | 13 +++++++------ tests/Makefile.include | 4 ++-- tests/qemu-iotests/meson.build | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 20 deletions(-)
docs/devel/testing/main.rst +7 -6
@@ -237,7 +237,8 @@ check-block ~~~~~~~~~~~ There are a variety of ways to exercise the block layer I/O tests -via make targets. +via make targets for a selection of formats / protocols (collectively +referred to as ``drivers`` below). A default ``make check`` or ``make check-block`` command will exercise the ``qcow2`` format, using the tests tagged into the ``auto`` group
@@ -246,14 +247,14 @@ only. These targets accept the ``SPEED`` variable to augment the set of tests to run. A slightly more comprehensive test plan can be run by defining ``SPEED=slow``, which enables all tests for the ``qcow2`` and ``raw`` -formats. The most comprehensive test plan can be run by defining -``SPEED=thorough``, which enables all available tests for the formats +drivers. The most comprehensive test plan can be run by defining +``SPEED=thorough``, which enables all available tests for the drivers ``luks``, ``nbd``, ``parallels``, ``qcow2``, ``qed``, ``raw``, ``vdi``, ``vhdx``, ``vmdk``, and ``vpc``. -Each of formats also has its own dedicated make target, named -``make check-block-$FORMAT`` which will run all available tests for -the designated format and does not require the ``SPEED`` variable +Each of drivers also has its own dedicated make target, named +``make check-block-$DRIVER`` which will run all available tests for +the designated driver and does not require the ``SPEED`` variable to be set. See the "QEMU iotests" section below for more information on the
tests/Makefile.include +2 -2
@@ -14,8 +14,8 @@ check-help: @echo " $(MAKE) check-unit Run qobject tests" @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" @echo " $(MAKE) check-tracetool Run tracetool generator tests" - @echo " $(MAKE) check-block Run block tests (all formats)" - @echo " $(MAKE) check-block-FORMAT Run block tests (only for FORMAT)" + @echo " $(MAKE) check-block Run block tests (all formats/protocols)" + @echo " $(MAKE) check-block-DRIVER Run block tests (only for format/protocol 'DRIVER')" ifneq ($(filter $(all-check-targets), check-softfloat),) @echo " $(MAKE) check-softfloat Run FPU emulation tests" @echo " $(MAKE) check-tcg Run TCG tests"
tests/qemu-iotests/meson.build +12 -12
@@ -12,7 +12,7 @@ qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd] qemu_iotests_env = {'PYTHON': python.full_path()} # If altering this definition, also update docs/devel/testing/main.rst # section on 'check-block' targets to reflect the changes -qemu_iotests_formats = { +qemu_iotests_drivers = { 'qcow2': 'quick', 'raw': 'slow', 'luks': 'thorough',
@@ -33,12 +33,12 @@ endforeach qemu_iotests_check_cmd = files('check') -foreach format, speed: qemu_iotests_formats - # Formats tagged 'quick' get the subset of tests in the 'auto' +foreach driver, speed: qemu_iotests_drivers + # Drivers tagged 'quick' get the subset of tests in the 'auto' # group, run by default with 'make check' / 'make check-block' seen = [] if speed == 'quick' - args = ['-tap', '-' + format, '-g', 'auto'] + args = ['-tap', '-' + driver, '-g', 'auto'] suites = ['block'] rc = run_command(
@@ -49,13 +49,13 @@ foreach format, speed: qemu_iotests_formats foreach item: rc.stdout().strip().split() seen += item args = [qemu_iotests_check_cmd, - '-tap', '-' + format, item, + '-tap', '-' + driver, item, '--source-dir', meson.current_source_dir(), '--build-dir', meson.current_build_dir()] # Some individual tests take as long as 45 seconds # Bump the timeout to 3 minutes for some headroom # on slow machines to minimize spurious failures - test('io-' + format + '-' + item, + test('io-' + driver + '-' + item, python, args: args, depends: qemu_iotests_binaries,
@@ -66,9 +66,9 @@ foreach format, speed: qemu_iotests_formats endforeach endif - # Every format gets put in the format specific suite - suites = ['block-' + format + '-optional'] - # Any format tagged quick or slow also gets added to slow + # Every driver gets put in the driver specific suite + suites = ['block-' + driver + '-optional'] + # Any driver tagged quick or slow also gets added to slow # otherwise its tagged thorough if speed != 'thorough' suites += ['block-slow']
@@ -76,7 +76,7 @@ foreach format, speed: qemu_iotests_formats suites += ['block-thorough'] endif - args = ['-tap', '-' + format] + args = ['-tap', '-' + driver] rc = run_command( [python, qemu_iotests_check_cmd] + args + ['-n'],
@@ -91,13 +91,13 @@ foreach format, speed: qemu_iotests_formats endif args = [qemu_iotests_check_cmd, - '-tap', '-' + format, item, + '-tap', '-' + driver, item, '--source-dir', meson.current_source_dir(), '--build-dir', meson.current_build_dir()] # Some individual tests take as long as 45 seconds # Bump the timeout to 3 minutes for some headroom # on slow machines to minimize spurious failures - test('io-' + format + '-' + item, + test('io-' + driver + '-' + item, python, args: args, depends: qemu_iotests_binaries,
Signature · 1 line
2.54.0
PATCH v8 10/16 iotests: add nbd and luks to the I/O test suites
In reply to Daniel P. BerrangéThis introduces new suites for running I/O tests on NBD and LUKS drivers, giving new make targets
* make check-block-luks
* make check-block-nbd
as well as adding their tests to 'make check-block SPEED=thorough'
--- docs/devel/testing/main.rst | 4 ++-- tests/qemu-iotests/meson.build | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
docs/devel/testing/main.rst +2 -2
@@ -248,8 +248,8 @@ to run. A slightly more comprehensive test plan can be run by defining ``SPEED=slow``, which enables all tests for the ``qcow2`` and ``raw`` formats. The most comprehensive test plan can be run by defining ``SPEED=thorough``, which enables all available tests for the formats -``parallels``, ``qcow2``, ``qed``, ``raw``, ``vdi``, ``vhdx``, -``vmdk``, and ``vpc``. +``luks``, ``nbd``, ``parallels``, ``qcow2``, ``qed``, ``raw``, ``vdi``, +``vhdx``, ``vmdk``, and ``vpc``. Each of formats also has its own dedicated make target, named ``make check-block-$FORMAT`` which will run all available tests for
tests/qemu-iotests/meson.build +3 -1
@@ -15,12 +15,14 @@ qemu_iotests_env = {'PYTHON': python.full_path()} qemu_iotests_formats = { 'qcow2': 'quick', 'raw': 'slow', + 'luks': 'thorough', + 'nbd': 'thorough', 'parallels': 'thorough', 'qed': 'thorough', 'vdi': 'thorough', 'vhdx': 'thorough', 'vmdk': 'thorough', - 'vpc': 'thorough' + 'vpc': 'thorough', } foreach k, v : emulators
Signature · 1 line
2.54.0
PATCH v8 9/16 docs/devel/testing: expand documentation for 'make check-block'
In reply to Daniel P. BerrangéExplain in greater detail what 'check-block' will run for each format, and also document the new format specific targets.
--- docs/devel/testing/main.rst | 25 ++++++++++++++++++++++--- tests/qemu-iotests/meson.build | 2 ++ 2 files changed, 24 insertions(+), 3 deletions(-)
docs/devel/testing/main.rst +22 -3
@@ -236,9 +236,28 @@ same commit that alters the generator code. check-block ~~~~~~~~~~~ -``make check-block`` runs a subset of the block layer iotests (the tests that -are in the "auto" group). -See the "QEMU iotests" section below for more information. +There are a variety of ways to exercise the block layer I/O tests +via make targets. + +A default ``make check`` or ``make check-block`` command will exercise +the ``qcow2`` format, using the tests tagged into the ``auto`` group +only. + +These targets accept the ``SPEED`` variable to augment the set of tests +to run. A slightly more comprehensive test plan can be run by defining +``SPEED=slow``, which enables all tests for the ``qcow2`` and ``raw`` +formats. The most comprehensive test plan can be run by defining +``SPEED=thorough``, which enables all available tests for the formats +``parallels``, ``qcow2``, ``qed``, ``raw``, ``vdi``, ``vhdx``, +``vmdk``, and ``vpc``. + +Each of formats also has its own dedicated make target, named +``make check-block-$FORMAT`` which will run all available tests for +the designated format and does not require the ``SPEED`` variable +to be set. + +See the "QEMU iotests" section below for more information on the +block I/O test framework that is leveraged by these ``make`` targets. .. _qemu-iotests:
tests/qemu-iotests/meson.build +2 -0
@@ -10,6 +10,8 @@ endif qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd] qemu_iotests_env = {'PYTHON': python.full_path()} +# If altering this definition, also update docs/devel/testing/main.rst +# section on 'check-block' targets to reflect the changes qemu_iotests_formats = { 'qcow2': 'quick', 'raw': 'slow',
Signature · 1 line
2.54.0
v8 cover tests: do more testing of block drivers
v1: https://lists.nongnu.org/archive/html/qemu-devel/2025-10/msg01650.html
v2: https://lists.nongnu.org/archive/html/qemu-devel/2026-01/msg02083.html
v3: https://lists.nongnu.org/archive/html/qemu-devel/2026-01/msg02939.html
v4: https://lists.nongnu.org/archive/html/qemu-devel/2026-02/msg03245.html
v5: https://lists.nongnu.org/archive/html/qemu-devel/2026-03/msg01252.html
v6: https://lists.nongnu.org/archive/html/qemu-devel/2026-04/msg04861.html
v7: https://lists.nongnu.org/archive/html/qemu-devel/2026-05/msg03163.html
The recent (at the time of v1) set of regressions identified in the LUKS block driver re-inforced that despite having a hugely useful set of I/O tests, our CI coverage is still letting through too many bugs.
The core goals of this series were/are:
* Add LUKS and NBD to the tested formats/protocols integrated into "make check-block SPEED=thorough"
* Ensure that all qcow2 tests can be run with "SPEED=slow", not staying limited to only the 'auto' group used by the 'make check-block' target in its default 'quick' mode
* Add 'make check-block-$FORMAT' to expose a standalone target for running all tests for a given format (or equivalently a protocol)
* Add GitLab CI jobs for exercising tests for all formats
A sample pipeline for this is
https://gitlab.com/berrange/qemu/-/pipelines/2258731804/
Showing the 'block-FORMAT' jobs which test the 10 block formats/protocols currently enabled.
This series fixes a couple of bugs
* Test 128 check for device mapper usage doesn't work sufficiently well to detect gitlab's containe env can't do dynamic devfs
* Test 185 is failing on gitlab so is marked as flaky
Testing of pipelines throughout development of v1-v5 postings does not exhibit any non-deterministic failures with the shared runners. Hopefully that will apply to QEMU's private runners used forthe staging tree too.
At this point it is a chicken & egg problem though.
If we don't bite the bullet and enable block I/O tests in GitLab CI for everyone, we'll never find out if they're truely stable enough to rely on.
As a mitigation against instability a patch in this series adds a new QEMU_TEST_IO_SKIP env variable that we are able to set as a GitLab CI env variable. This lets us skip broken tests dynamically without waiting for a git commit to disable them in the buildtest.yml config that we use for disabling the 3 known broken tests currently.
Changed in v8
- Use 'driver' more comprehensively in tests/qemu-iotests/meson.build
- Use 'iotests:' as patch prefix
- Fix series numbering - due to a laptop change I accidentally posted v6 twice, once without a version and once with a versio. IOW what I previously called v6 was in fact v7.
Changed in v7:
- Support QEMU_TEST_FLAKY_TESTS in I/O tests framework and mark 185 as flaky
- Drop the env var for skipping tests
- Use a matrix job in gitlab definition for I/O tests jobs
Changed in v6:
- Drop redundant change from gitlab yml config
- Pull in rebase for qemu.qmp to 0.6.0 to fix two tests by avoiding deprecation warnings
Changed in v5:
- Adapt for python-qemu-qmp being spun off, by temp disabling tests that are broken by it, that we formerly fixed in-tree.
Changed in v4:
- Remove tests from build-tcg-disabled job
Changed in v3:
- Test whether dmsetup create device appeared or not, instead of unconditionally skipping test 128 in GitLab
- Use 'driver' term instead of 'format' or 'protocol'
- Fix misc typos & rephrasing
Daniel P. Berrangé (15):
gitlab: ensure all meson jobs capture build/meson-logs by default
iotests: print reason when I/O test is skipped in TAP mode
iotests: remove redundant meson suite for iotests
iotests: ensure all qcow2 I/O tests are able to be run via make scripts/mtest2make: ensure output has stable sorting scripts/mtest2make: support optional tests grouping
iotests: add a meson suite / make target per block I/O tests format docs/devel/testing: expand documentation for 'make check-block'
iotests: add nbd and luks to the I/O test suites
iotests: use 'driver' as collective term for either format or protocol
iotests: validate dmsetup result in test 128
iotests: fix check for sudo access in LUKS I/O test
iotests: mark 185 as a flaky test
gitlab: add jobs for thorough block tests
gitlab: remove I/O tests from build-tcg-disabled job
John Snow (1):
python: bump qemu.qmp to v0.0.6
.gitlab-ci.d/buildtest-template.yml | 30 +++++---
.gitlab-ci.d/buildtest.yml | 27 +++++---
docs/devel/testing/main.rst | 26 ++++++-
python/scripts/vendor.py | 4 +-
...ny.whl => qemu_qmp-0.0.6-py3-none-any.whl} | Bin 72263 -> 72379 bytes
pythondeps.toml | 2 +-
scripts/mtest2make.py | 30 +++++---
tests/Makefile.include | 3 +-
tests/qemu-iotests/128 | 6 ++
tests/qemu-iotests/149 | 13 ++--
tests/qemu-iotests/185 | 1 +
tests/qemu-iotests/common.rc | 16 +++++
tests/qemu-iotests/meson.build | 65 +++++++++++++++---
tests/qemu-iotests/testrunner.py | 2 +-
14 files changed, 171 insertions(+), 54 deletions(-)
rename python/wheels/{qemu_qmp-0.0.5-py3-none-any.whl => qemu_qmp-0.0.6-py3-none-any.whl} (64%)Signature · 1 line
2.54.0
PATCH v8 15/16 gitlab: add jobs for thorough block tests
CI is only exercising the qcow2 'auto' tests currently. As a result we get no exposure of changes which cause regressions in other block format drivers.
This adds new CI jobs for each block format, that will run the target 'make check-block-$FORMAT'. The jobs are separate so that we have the ability to make each format gating or not, depending on their level of reliability.
The 'centos' image is used to run the I/O tests since several tests have an implicit dependency on x86_64-softmmu, and thus break with other architecture targets. The 'centos' build job is the only one that creates the x86_64-softmmu target in CI. Ideally this target portability in I/O tests would be fixed to avoid this limitation.
--- .gitlab-ci.d/buildtest.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
.gitlab-ci.d/buildtest.yml +18 -0
@@ -174,6 +174,24 @@ build-system-centos: x86_64-softmmu rx-softmmu sh4-softmmu MAKE_CHECK_ARGS: check-build + +# NB: block-XXX jobs use 'centos' since that is the build +# job that provides the x86_64-softmmu. Some I/O tests +# are currently buggy and blindly assume characteristics +# of x86 (such as PCIe) causing failures with other arches + +block: + extends: .native_test_job_template + needs: + - job: build-system-centos + artifacts: true + variables: + IMAGE: centos9 + MAKE_CHECK_ARGS: "check-block-$FORMAT" + parallel: + matrix: + - FORMAT: [luks, nbd, parallels, qcow2, qed, raw, vdi, vhdx, vmdk, vpc] + # Previous QEMU release. Used for cross-version migration tests. build-previous-qemu: extends: .native_build_job_template
Signature · 1 line
2.54.0
PATCH v8 7/16 scripts/mtest2make: support optional tests grouping
In reply to Daniel P. BerrangéCurrently tests can be classified into three speed groups depending on whether the meson suite name ends in '-slow' or '-thorough' or neither.
This gets turned into make targets that match the name of the meson suite, with the speed suffix stripped. e.g.
* suite=block -> 'make check-block'
* suite=block-slow -> 'make check-block SPEED=slow'
* suite=block-thorough -> 'make check-block SPEED=thorough'
The set of tests under the "thorough" speed, however, can get rather large and it would be useful to have a way to expose further make targets for directly running a particular subset of tests.
This needs a way to run a target without requiring the SPEED variable, while also not having them enabled by default as if they were 'quick' tests.
This modifies mtest2make.py to support this idea by allowing for a new suffix '-optional' on a suite. When this is present, a correspondingly named make target will be created without the '-optional' suffix which will never be run automatically.
This is intended to be combined with use of other suites. For example, a single NBD test might be added to two suites, 'block-thorough' and 'block-nbd-optional'.
This would allow running it as part of all the block tests with 'make check-block SPEED=thorough', and as part of a standalone target 'make check-block-nbd'.
--- scripts/mtest2make.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
scripts/mtest2make.py +15 -7
@@ -22,7 +22,7 @@ def names(self, base): print(r''' SPEED = quick -.speed.quick = $(sort $(filter-out %-slow %-thorough, $1)) +.speed.quick = $(sort $(filter-out %-slow %-thorough %-optional, $1)) .speed.slow = $(sort $(filter-out %-thorough, $1)) .speed.thorough = $(sort $1)
@@ -66,10 +66,15 @@ def process_tests(test, targets, suites): s = s[:-9] suites[s].speeds.add('thorough') +def target_name(suite): + if suite.endswith('-optional'): + return suite[0:-9] + return suite + def emit_prolog(suites, prefix): - all_targets = ' '.join((f'{prefix}-{k}' + all_targets = ' '.join((f'{prefix}-{target_name(k)}' for k in sorted(suites.keys()))) - all_xml = ' '.join((f'{prefix}-report-{k}.junit.xml' + all_xml = ' '.join((f'{prefix}-report-{target_name(k)}.junit.xml' for k in sorted(suites.keys()))) print() print(f'all-{prefix}-targets = {all_targets}')
@@ -83,14 +88,17 @@ def emit_prolog(suites, prefix): print(f'\t$(MAKE) {prefix}$* MTESTARGS="$(MTESTARGS) --logbase {prefix}-report$*" && ln -f meson-logs/$@ .') def emit_suite(name, suite, prefix): + tgtname = target_name(name) deps = ' '.join(sorted(suite.deps)) print() - print(f'.{prefix}-{name}.deps = {deps}') - print(f'.ninja-goals.check-build += $(.{prefix}-{name}.deps)') + print(f'.{prefix}-{tgtname}.deps = {deps}') + print(f'.ninja-goals.check-build += $(.{prefix}-{tgtname}.deps)') names = ' '.join(sorted(suite.names(name))) - targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml' - if not name.endswith('-slow') and not name.endswith('-thorough'): + targets = f'{prefix}-{tgtname} {prefix}-report-{tgtname}.junit.xml' + if not name.endswith('-slow') and \ + not name.endswith('-thorough') and \ + not name.endswith('-optional'): targets += f' {prefix} {prefix}-report.junit.xml' print(f'ifneq ($(filter {targets}, $(MAKECMDGOALS)),)') # for the "base" suite possibly add FOO-slow and FOO-thorough
Signature · 1 line
2.54.0
Re: [PATCH v8 11/16] iotests: use 'driver' as collective term for either format or protocol
In reply to Daniel P. BerrangéQuoted 11 lines · Daniel P. Berrangé
The I/O tests integration previously exclusively tested block formats and now also covers the NBD protocol. Replace references to 'format' with 'driver', as a generic term to collectively apply to either a format or protocol.
Signed-off-by Daniel P. Berrangé <[email protected]>--- docs/devel/testing/main.rst | 13 +++++++------ tests/Makefile.include | 4 ++-- tests/qemu-iotests/meson.build | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 20 deletions(-)
Re: [PATCH v8 06/16] scripts/mtest2make: ensure output has stable sorting
In reply to Daniel P. BerrangéQuoted 11 lines · Daniel P. Berrangé
When debugging
mtest2make.pychanges it is important to be able to compare the old and new output. This requires that any lists in the output have stable sort ordering.Acked-by Kevin Wolf <[email protected]>Reviewed-by Thomas Huth <[email protected]>Signed-off-by Daniel P. Berrangé <[email protected]>--- scripts/mtest2make.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Re: [PATCH v8 11/16] iotests: use 'driver' as collective term for either format or protocol
In reply to Daniel P. BerrangéQuoted 5 lines · Daniel P. Berrangé
The I/O tests integration previously exclusively tested block formats and now also covers the NBD protocol. Replace references to 'format' with 'driver', as a generic term to collectively apply to either a format or protocol.
Quoted 7 lines
Signed-off-by Daniel P. Berrangé <[email protected]>--- docs/devel/testing/main.rst | 13 +++++++------ tests/Makefile.include | 4 ++-- tests/qemu-iotests/meson.build | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 20 deletions(-)