Skip to contentSkip to conversation

tests: do more testing of block drivers

PATCH In review Daniel P. Berrangé 4 participants 57 messages Apr 24 – May 13 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

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

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 reliably failing on gitlab

* Two tests fail when run on CentOS 9 because they trigger python deprecation warnings. This will be fixed when the python-qemu-qmp module is next released.

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 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
tests: print reason when I/O test is skipped in TAP mode
tests: remove redundant meson suite for iotests
tests: 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
tests: add a meson suite / make target per block I/O tests format docs/devel/testing: expand documentation for 'make check-block'
tests: add nbd and luks to the I/O test suites
tests: use 'driver' as collective term for either format or protocol
tests: validate dmsetup result in test 128
tests: fix check for sudo access in LUKS I/O test
tests: add QEMU_TEST_IO_SKIP for skipping I/O tests
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                    | 107 ++++++++++++++++--
 docs/devel/testing/main.rst                   |  33 +++++-
 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/meson.build                |  59 ++++++++--
 tests/qemu-iotests/testrunner.py              |  18 ++-
 12 files changed, 254 insertions(+), 51 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.53.0
#3 lore raw

PATCH 2/16 gitlab: ensure all meson jobs capture build/meson-logs by default

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
index d866cb12bb..005058625e 100644
@@ -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.53.0
#5 lore raw

PATCH 3/16 tests: 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
index e2a3658994..dbe2dddc32 100644
@@ -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.53.0
#31 lore raw

PATCH 13/16 tests: 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
index c13343d7ef..6dff39a28a 100755
@@ -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.53.0
#1 lore raw

PATCH 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
index 78058183e4..127e442659 100755
@@ -43,8 +43,8 @@ def main() -> int:
     packages = {
         "meson==1.10.0":
         "4b27aafce281e652dcb437b28007457411245d975c48b5db3a797d3e93ae1585",
-        "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
similarity index 64%
rename from python/wheels/qemu_qmp-0.0.5-py3-none-any.whl
rename to python/wheels/qemu_qmp-0.0.6-py3-none-any.whl
index 6372b7544ffb015a5c77d9686e921b65c848d433..5754130b408e2f13081b368a5506101a6ac490f2 100644
GIT binary patch
pythondeps.toml +1 -1
index a071774242..0949a6e6cd 100644
@@ -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.53.0
#10 lore raw

PATCH 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
index 4b252defc3..915f02d600 100644
@@ -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.53.0
#21 lore raw

PATCH 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
index 0662766b5c..dc4f7202a5 100644
@@ -221,9 +221,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
index 16a5e39476..66b09d6b97 100644
@@ -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.53.0
#19 lore raw

PATCH 8/16 tests: 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
index f257288194..a820980bbe 100644
@@ -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
index 1a24d801a3..16a5e39476 100644
@@ -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.53.0
#7 lore raw

PATCH 4/16 tests: 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
index d7bae71ced..bf588cc2c9 100644
@@ -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.53.0
#9 lore raw

PATCH 5/16 tests: 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
index bf588cc2c9..1a24d801a3 100644
@@ -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.53.0
#25 lore raw

PATCH 11/16 tests: 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 |  6 +++---
 3 files changed, 12 insertions(+), 11 deletions(-)
docs/devel/testing/main.rst +7 -6
index 8067d0a3ed..797111009a 100644
@@ -222,7 +222,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
@@ -231,14 +232,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
index a820980bbe..a063a1d60f 100644
@@ -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 +3 -3
index 744d0b6e88..5d6b0b5ed9 100644
@@ -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,8 +33,8 @@ 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 format, 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'
Signature · 1 line
2.53.0
#23 lore raw

PATCH 10/16 tests: 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
index dc4f7202a5..8067d0a3ed 100644
@@ -233,8 +233,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
index 66b09d6b97..744d0b6e88 100644
@@ -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.53.0
#51 lore raw

PATCH 15/16 gitlab: add jobs for thorough block tests

In reply to Daniel P. Berrangé

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.

There is currently an undiagnosed failure of job 185 with the qcow2 when run in CI that is marked to be skipped, reported at:

https://gitlab.com/qemu-project/qemu/-/issues/3270

---
 .gitlab-ci.d/buildtest.yml | 98 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)
.gitlab-ci.d/buildtest.yml +98 -0
index 4b1949a3a5..d4591d30e9 100644
@@ -174,6 +174,104 @@ 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-luks:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-luks
+
+block-nbd:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-nbd
+
+block-parallels:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-parallels
+
+block-qcow2:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-qcow2
+    # https://gitlab.com/qemu-project/qemu/-/issues/3270
+    QEMU_TEST_IO_SKIP: qcow2:185
+
+block-qed:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-qed
+
+block-raw:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-raw
+
+block-vdi:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vdi
+
+block-vhdx:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vhdx
+
+block-vmdk:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vmdk
+
+block-vpc:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vpc
+
 # Previous QEMU release. Used for cross-version migration tests.
 build-previous-qemu:
   extends: .native_build_job_template
Signature · 1 line
2.53.0
#11 lore raw

PATCH 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
index 915f02d600..383ea68b16 100644
@@ -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.53.0
#33 lore raw

PATCH 14/16 tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

In reply to Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +16 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 
Signature · 1 line
2.53.0
#53 lore raw

PATCH 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
index d4591d30e9..710dfbcc77 100644
@@ -446,15 +446,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.53.0
#27 lore raw

PATCH 12/16 tests: 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
index d0e00d24b1..d75b1a451a 100755
@@ -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.53.0
Reviewed-by on v1 16/16
#54 lore raw

Re: [PATCH 16/16] gitlab: remove I/O tests from build-tcg-disabled job

In reply to Daniel P. Berrangé
Quoted 19 lines · 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 -2
index d4591d30e9..710dfbcc77 100644
@@ -446,15 +446,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

.gitlab-ci.d/buildtest.yml build-tcg-disabled: · line 451

Quoted 10 lines
.gitlab-ci.d/buildtest.yml +0 -7
-            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:
#56 lore raw
In reply to Daniel P. Berrangé

ping: is there any more feedback on series ?

I'd really like to get the block driver CI coverage improved to prevent further regressions in currently untested drivers.

Quoted 102 lines · Daniel P. Berrangé

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

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 reliably failing on gitlab

* Two tests fail when run on CentOS 9 because they trigger python deprecation warnings. This will be fixed when the python-qemu-qmp module is next released.

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 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
tests: print reason when I/O test is skipped in TAP mode
tests: remove redundant meson suite for iotests
tests: 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
tests: add a meson suite / make target per block I/O tests format docs/devel/testing: expand documentation for 'make check-block'
tests: add nbd and luks to the I/O test suites
tests: use 'driver' as collective term for either format or protocol
tests: validate dmsetup result in test 128
tests: fix check for sudo access in LUKS I/O test
tests: add QEMU_TEST_IO_SKIP for skipping I/O tests
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

Quoted 18 lines
 .gitlab-ci.d/buildtest-template.yml           |  30 +++--
 .gitlab-ci.d/buildtest.yml                    | 107 ++++++++++++++++--
 docs/devel/testing/main.rst                   |  33 +++++-
 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/meson.build                |  59 ++++++++--
 tests/qemu-iotests/testrunner.py              |  18 ++-
 12 files changed, 254 insertions(+), 51 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.53.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
Reviewed-by on v1 2/16
#4 lore raw

Re: [PATCH 02/16] gitlab: ensure all meson jobs capture build/meson-logs by default

In reply to Daniel P. Berrangé
Quoted 7 lines · 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.

Quoted 5 lines
---
 .gitlab-ci.d/buildtest-template.yml | 30 ++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
Reviewed-by on v1 3/16
#6 lore raw

Re: [PATCH 03/16] tests: print reason when I/O test is skipped in TAP mode

In reply to Daniel P. Berrangé
Quoted 9 lines · 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):

Quoted 8 lines

ok raw 181 # SKIP Postcopy is not supported

---
 tests/qemu-iotests/testrunner.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Good idea,

Reviewed-by on v1 1/16
#2 lore raw

Re: [PATCH 01/16] python: bump qemu.qmp to v0.0.6

In reply to Daniel P. Berrangé
Quoted 5 lines · 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.

Quoted 8 lines
---
 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%)
Reviewed-by on v1 4/16
#8 lore raw

Re: [PATCH 04/16] tests: remove redundant meson suite for iotests

In reply to Daniel P. Berrangé
Quoted 9 lines · 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(-)
Reviewed-by on v1 7/16
#12 lore raw

Re: [PATCH 07/16] scripts/mtest2make: support optional tests grouping

In reply to Daniel P. Berrangé
Quoted 79 lines · 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 +11 -5
index 915f02d600..383ea68b16 100644
@@ -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)')
 

scripts/mtest2make.py def emit_prolog(suites, prefix): · line 104

Quoted 10 lines
scripts/mtest2make.py +4 -2
     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

Not blocking this patch, thus reviewed, but I think it would be a better abstraction to use meson suites for this (a test can be added in multiple suites), instead of adding more clunk to makefile layer.

Regards,
Pierrick

Reviewed-by on v1 8/16
#20 lore raw

Re: [PATCH 08/16] tests: add a meson suite / make target per block I/O tests format

In reply to Daniel P. Berrangé
Quoted 18 lines · 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'.

Quoted 6 lines
---
 tests/Makefile.include         | 3 ++-
 tests/qemu-iotests/meson.build | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Reviewed-by on v1 10/16
#24 lore raw

Re: [PATCH 10/16] tests: add nbd and luks to the I/O test suites

In reply to Daniel P. Berrangé
Quoted 6 lines · 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

Quoted 8 lines

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(-)
Reviewed-by on v1 9/16
#22 lore raw

Re: [PATCH 09/16] docs/devel/testing: expand documentation for 'make check-block'

In reply to Daniel P. Berrangé
Quoted 10 lines · 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(-)
Reviewed-by on v1 16/16
#55 lore raw

Re: [PATCH 16/16] gitlab: remove I/O tests from build-tcg-disabled job

In reply to Daniel P. Berrangé
Quoted 9 lines · 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(-)
Reviewed-by on v1 11/16
#26 lore raw

Re: [PATCH 11/16] tests: use 'driver' as collective term for either format or protocol

In reply to Daniel P. Berrangé
Quoted 51 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.

---
 docs/devel/testing/main.rst    | 13 +++++++------
 tests/Makefile.include         |  4 ++--
 tests/qemu-iotests/meson.build |  6 +++---
 3 files changed, 12 insertions(+), 11 deletions(-)
docs/devel/testing/main.rst +7 -6
index 8067d0a3ed..797111009a 100644
@@ -222,7 +222,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
@@ -231,14 +232,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 +0 -0
index a820980bbe..a063a1d60f 100644

tests/Makefile.include check-help: · line 18

Quoted 7 lines
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')"

We had two words for this, now there is a third :)
I would suggest to remove format/protocol at all, and assume it's called a driver.

Quoted 17 lines
tests/Makefile.include +0 -0
 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 +1 -1
index 744d0b6e88..5d6b0b5ed9 100644
@@ -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',

tests/qemu-iotests/meson.build endforeach · line 40

Quoted 10 lines
tests/qemu-iotests/meson.build +2 -2
@@ -33,8 +33,8 @@ 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 format, 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'
#28 lore raw

Re: [PATCH 12/16] tests: validate dmsetup result in test 128

In reply to Daniel P. Berrangé
Quoted 20 lines · 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

Quoted 7 lines

(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.

Could that be related to the fact it's running inside a container (if it is). Maybe it's just missing exposing all /dev instead of a limited set of devices.

Quoted 22 lines
---
 tests/qemu-iotests/128 | 6 ++++++
 1 file changed, 6 insertions(+)
tests/qemu-iotests/128 +6 -0
index d0e00d24b1..d75b1a451a 100755
@@ -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
Reviewed-by on v1 13/16
#32 lore raw

Re: [PATCH 13/16] tests: fix check for sudo access in LUKS I/O test

In reply to Daniel P. Berrangé
Quoted 10 lines · 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(-)
#34 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

In reply to Daniel P. Berrangé
Quoted 63 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 10 lines
tests/qemu-iotests/testrunner.py +4 -0
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

Once it's green, in theory, code breaking existing tests should not be merged, right? So what would be the usage of this variable?

Regards,
Pierrick

#52 lore raw

Re: [PATCH 15/16] gitlab: add jobs for thorough block tests

In reply to Daniel P. Berrangé
Quoted 124 lines · Daniel P. Berrangé

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.

There is currently an undiagnosed failure of job 185 with the qcow2 when run in CI that is marked to be skipped, reported at:

https://gitlab.com/qemu-project/qemu/-/issues/3270

---
 .gitlab-ci.d/buildtest.yml | 98 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)
.gitlab-ci.d/buildtest.yml +91 -0
index 4b1949a3a5..d4591d30e9 100644
@@ -174,6 +174,104 @@ 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-luks:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-luks
+
+block-nbd:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-nbd
+
+block-parallels:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-parallels
+
+block-qcow2:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-qcow2
+    # https://gitlab.com/qemu-project/qemu/-/issues/3270
+    QEMU_TEST_IO_SKIP: qcow2:185
+
+block-qed:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-qed
+
+block-raw:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-raw
+
+block-vdi:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vdi
+
+block-vhdx:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vhdx
+
+block-vmdk:
+  extends: .native_test_job_template
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vmdk
+
+block-vpc:
+  extends: .native_test_job_template

.gitlab-ci.d/buildtest.yml build-system-centos: · line 277

Quoted 10 lines
.gitlab-ci.d/buildtest.yml +7 -0
+  needs:
+    - job: build-system-centos
+      artifacts: true
+  variables:
+    IMAGE: centos9
+    MAKE_CHECK_ARGS: check-block-vpc
+
 # Previous QEMU release. Used for cross-version migration tests.
 build-previous-qemu:
   extends: .native_build_job_template

You may want to use a gitlab parallel matrix here, since it's basically a copy paste with driver name changed.
And either you can set QEMU_TEST_IO_SKIP for all of them, or simply remove the broken test from tree.

Regards,
Pierrick

#35 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

In reply to Pierrick Bouvier
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 2 lines

Once it's green, in theory, code breaking existing tests should not be merged, right? So what would be the usage of this variable?

We have had a pretty decent chunk of non-deterministic test failures, so there is high likelihood we can merge stuff that passes once and then subsequently fails some subset of the time. This non-determinism is one of the key reasons that we currently only have a hand picked selection of block I/O tests run by meson.

While I've tested this series and haven't see any non-determinstic failures in what I'm proposing to enable thus far, I think there is still a pretty high chance we'll uncover some more.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#36 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 84 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

Quoted 6 lines

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

What do you think?

Quoted 9 lines
Quoted 2 lines

Once it's green, in theory, code breaking existing tests should not be merged, right? So what would be the usage of this variable?

We have had a pretty decent chunk of non-deterministic test failures, so there is high likelihood we can merge stuff that passes once and then subsequently fails some subset of the time. This non-determinism is one of the key reasons that we currently only have a hand picked selection of block I/O tests run by meson.

Quoted 4 lines

While I've tested this series and haven't see any non-determinstic failures in what I'm proposing to enable thus far, I think there is still a pretty high chance we'll uncover some more.

Fair point.

Quoted 2 lines

With regards,
Daniel

#37 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 92 lines · Pierrick Bouvier
Quoted 84 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

Quoted 6 lines

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 5 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

Once it's green, in theory, code breaking existing tests should not be merged, right? So what would be the usage of this variable?

We have had a pretty decent chunk of non-deterministic test failures, so there is high likelihood we can merge stuff that passes once and then subsequently fails some subset of the time. This non-determinism is one of the key reasons that we currently only have a hand picked selection of block I/O tests run by meson.

Quoted 6 lines
Quoted 4 lines

While I've tested this series and haven't see any non-determinstic failures in what I'm proposing to enable thus far, I think there is still a pretty high chance we'll uncover some more.

Fair point.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#38 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

Once it's green, in theory, code breaking existing tests should not be merged, right? So what would be the usage of this variable?

We have had a pretty decent chunk of non-deterministic test failures, so there is high likelihood we can merge stuff that passes once and then subsequently fails some subset of the time. This non-determinism is one of the key reasons that we currently only have a hand picked selection of block I/O tests run by meson.

Quoted 6 lines
Quoted 4 lines

While I've tested this series and haven't see any non-determinstic failures in what I'm proposing to enable thus far, I think there is still a pretty high chance we'll uncover some more.

Fair point.

With regards,
Daniel

#39 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#40 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 160 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

Quoted 7 lines

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

In the future, do we expect to merge code breaking tests?

It really seem there is just one failure, and we won't have more in the future.

Quoted 2 lines

With regards,
Daniel

#41 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 165 lines · Pierrick Bouvier
Quoted 164 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

Quoted 7 lines
Quoted 3 lines

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

The env variable is the generic mechanism.

The yaml file exclusion for 185 is the special case, but we get that basically for free with the former.

Quoted 1 line

In the future, do we expect to merge code breaking tests?

Yes. We will certainly merge more non-deterministic tests. We've seen this over & over again. Something passes CI initially but after a number of CI pipelines turns out to be flaky

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#42 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 176 lines · Daniel P. Berrangé
Quoted 165 lines · Pierrick Bouvier
Quoted 164 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

Quoted 7 lines
Quoted 3 lines

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

The env variable is the generic mechanism.

Quoted 9 lines

The yaml file exclusion for 185 is the special case, but we get that basically for free with the former.

Quoted 1 line

In the future, do we expect to merge code breaking tests?

Yes. We will certainly merge more non-deterministic tests. We've seen this over & over again. Something passes CI initially but after a number of CI pipelines turns out to be flaky

Then we can mark them as flaky in tests/qemu-iotests/meson.build.

It seems like you ignore the point that there is a problem between setting something in CI only vs making something that works for all users. I'm not against an env var, I just don't see how it answers this need.

Quoted 2 lines

With regards,
Daniel

#43 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 180 lines · Pierrick Bouvier
Quoted 179 lines · Daniel P. Berrangé
Quoted 165 lines · Pierrick Bouvier
Quoted 164 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

Quoted 7 lines
Quoted 3 lines

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

The env variable is the generic mechanism.

The yaml file exclusion for 185 is the special case, but we get that basically for free with the former.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

In the future, do we expect to merge code breaking tests?

Yes. We will certainly merge more non-deterministic tests. We've seen this over & over again. Something passes CI initially but after a number of CI pipelines turns out to be flaky

Then we can mark them as flaky in tests/qemu-iotests/meson.build.

That is a long term solution. It does not address the immediate time critical goal to have the ability to fix a broken CI pipeline immediately by skipping the test without waiting for code changes.

Quoted 4 lines

It seems like you ignore the point that there is a problem between setting something in CI only vs making something that works for all users. I'm not against an env var, I just don't see how it answers this need.

Again, I'm not saying that we fix this only for CI. The env var is to allow broken jobs to be immediately skipped, while waiting for code changes to permanently skipped/fix the tests. The latter addresses it for every scenario.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#44 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 199 lines · Daniel P. Berrangé
Quoted 180 lines · Pierrick Bouvier
Quoted 179 lines · Daniel P. Berrangé
Quoted 165 lines · Pierrick Bouvier
Quoted 164 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

Quoted 7 lines
Quoted 3 lines

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

The env variable is the generic mechanism.

The yaml file exclusion for 185 is the special case, but we get that basically for free with the former.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

In the future, do we expect to merge code breaking tests?

Yes. We will certainly merge more non-deterministic tests. We've seen this over & over again. Something passes CI initially but after a number of CI pipelines turns out to be flaky

Then we can mark them as flaky in tests/qemu-iotests/meson.build.

That is a long term solution. It does not address the immediate time critical goal to have the ability to fix a broken CI pipeline immediately by skipping the test without waiting for code changes.

Quoted 4 lines

It seems like you ignore the point that there is a problem between setting something in CI only vs making something that works for all users. I'm not against an env var, I just don't see how it answers this need.

Quoted 5 lines

Again, I'm not saying that we fix this only for CI. The env var is to allow broken jobs to be immediately skipped, while waiting for code changes to permanently skipped/fix the tests. The latter addresses it for every scenario.

I might have missed where we have a default value for this env var, out of yaml file, that makes it apply the exact same set of skip tests for CI, and for users running tests manually.

Where is this default applied for both CI and users?

I understand it's not needed for test 185 which fails only in GitLab, but as you mentioned, we'll probably have non deterministic tests in the future, so we need to consider this.

Quoted 2 lines

With regards,
Daniel

#45 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 210 lines · Pierrick Bouvier
Quoted 199 lines · Daniel P. Berrangé
Quoted 180 lines · Pierrick Bouvier
Quoted 179 lines · Daniel P. Berrangé
Quoted 165 lines · Pierrick Bouvier
Quoted 164 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false positive failures in certain scenarios that have not been encountered before, and sometimes non-deterministic failures that are hard to reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a mechanism to dynamically mark tests as skipped, without having to commit code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this variable can be set as a GitLab CI pipeline variable to temporarily disable a test while problems are being debugged.

---
 docs/devel/testing/main.rst      |  7 +++++++
 tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
docs/devel/testing/main.rst +7 -0
index 797111009a..f779a64415 100644
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
 More options are supported by the ``./check`` script, run ``./check -h`` for
 help.
 
+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
 Writing a new test case
 ~~~~~~~~~~~~~~~~~~~~~~~
 
tests/qemu-iotests/testrunner.py +12 -0
index dbe2dddc32..ecb5d4529f 100644
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,
 
         self._stack: contextlib.ExitStack
 
+        self.skip = {}
+        for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+            rule = rule.strip()
+            if rule == "":
+                continue
+            if ":" in rule:
+                fmt, name = rule.split(":")
+                if fmt in ("", env.imgfmt, env.imgproto):
+                    self.skip[name] = True
+            else:
+                self.skip[rule] = True
+
     def __enter__(self) -> 'TestRunner':
         self._stack = contextlib.ExitStack()
         self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
                               description='No qualified output '
                                           f'(expected {f_reference})')
 
Quoted 10 lines

tests/qemu-iotests/testrunner.py def do_run_test(self, test: str) -> TestResult: · line 272

Quoted 7 lines
tests/qemu-iotests/testrunner.py +4 -0
+        if f_test.name in self.skip:
+            return TestResult(status='not run',
+                              description='Listed in QEMU_TEST_IO_SKIP')
+
         args = [str(f_test.resolve())]
         env = self.env.prepare_subprocess(args)
 

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

Quoted 7 lines
Quoted 3 lines

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

The env variable is the generic mechanism.

The yaml file exclusion for 185 is the special case, but we get that basically for free with the former.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

In the future, do we expect to merge code breaking tests?

Yes. We will certainly merge more non-deterministic tests. We've seen this over & over again. Something passes CI initially but after a number of CI pipelines turns out to be flaky

Then we can mark them as flaky in tests/qemu-iotests/meson.build.

That is a long term solution. It does not address the immediate time critical goal to have the ability to fix a broken CI pipeline immediately by skipping the test without waiting for code changes.

Quoted 4 lines

It seems like you ignore the point that there is a problem between setting something in CI only vs making something that works for all users. I'm not against an env var, I just don't see how it answers this need.

Quoted 5 lines

Again, I'm not saying that we fix this only for CI. The env var is to allow broken jobs to be immediately skipped, while waiting for code changes to permanently skipped/fix the tests. The latter addresses it for every scenario.

I might have missed where we have a default value for this env var, out of yaml file, that makes it apply the exact same set of skip tests for CI, and for users running tests manually.

Quoted 5 lines

Where is this default applied for both CI and users?

I understand it's not needed for test 185 which fails only in GitLab, but as you mentioned, we'll probably have non deterministic tests in the future, so we need to consider this.

I was considering any change in meson.build to permanently skip a test would be independent of the env var handling, and outside the scope of this series since there's no need for it here.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#46 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 213 lines · Daniel P. Berrangé
Quoted 212 lines · Pierrick Bouvier
Quoted 199 lines · Daniel P. Berrangé
Quoted 180 lines · Pierrick Bouvier
Quoted 179 lines · Daniel P. Berrangé
Quoted 165 lines · Pierrick Bouvier
Quoted 164 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 67 lines · Pierrick Bouvier
Quoted 66 lines · Daniel P. Berrangé

The nature of block I/O tests is such that there can be unexpected false
positive failures in certain scenarios that have not been encountered
before, and sometimes non-deterministic failures that are hard to
reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a
mechanism to dynamically mark tests as skipped, without having to commit
code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set
to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this
variable can be set as a GitLab CI pipeline variable to temporarily
disable a test while problems are being debugged.

Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
---
docs/devel/testing/main.rst | 7 +++++++
tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
2 files changed, 23 insertions(+)

diff --git a/docs/devel/testing/main.rst b/docs/devel/testing/main.rst
index 797111009a..f779a64415 100644
--- a/docs/devel/testing/main.rst
+++ b/docs/devel/testing/main.rst
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
More options are supported by the ``./check`` script, run ``./check -h`` for
help.

+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
Writing a new test case
~~~~~~~~~~~~~~~~~~~~~~~

diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index dbe2dddc32..ecb5d4529f 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,

self._stack: contextlib.ExitStack

+ self.skip = {}
+ for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+ rule = rule.strip()
+ if rule == "":
+ continue
+ if ":" in rule:
+ fmt, name = rule.split(":")
+ if fmt in ("", env.imgfmt, env.imgproto):
+ self.skip[name] = True
+ else:
+ self.skip[rule] = True
+
def __enter__(self) -> 'TestRunner':
self._stack = contextlib.ExitStack()
self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
description='No qualified output '
f'(expected {f_reference})')

Quoted 10 lines
Quoted 7 lines

+ if f_test.name in self.skip:
+ return TestResult(status='not run',
+ description='Listed in QEMU_TEST_IO_SKIP')
+
args = [str(f_test.resolve())]
env = self.env.prepare_subprocess(args)

Why not simply remove the broken tests, and create issues to add them again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

Quoted 7 lines
Quoted 3 lines

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

The env variable is the generic mechanism.

The yaml file exclusion for 185 is the special case, but we get that basically for free with the former.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

In the future, do we expect to merge code breaking tests?

Yes. We will certainly merge more non-deterministic tests. We've seen this over & over again. Something passes CI initially but after a number of CI pipelines turns out to be flaky

Then we can mark them as flaky in tests/qemu-iotests/meson.build.

That is a long term solution. It does not address the immediate time critical goal to have the ability to fix a broken CI pipeline immediately by skipping the test without waiting for code changes.

Quoted 4 lines

It seems like you ignore the point that there is a problem between setting something in CI only vs making something that works for all users. I'm not against an env var, I just don't see how it answers this need.

Quoted 5 lines

Again, I'm not saying that we fix this only for CI. The env var is to allow broken jobs to be immediately skipped, while waiting for code changes to permanently skipped/fix the tests. The latter addresses it for every scenario.

I might have missed where we have a default value for this env var, out of yaml file, that makes it apply the exact same set of skip tests for CI, and for users running tests manually.

Where is this default applied for both CI and users?

Quoted 8 lines
Quoted 3 lines

I understand it's not needed for test 185 which fails only in GitLab, but as you mentioned, we'll probably have non deterministic tests in the future, so we need to consider this.

I was considering any change in meson.build to permanently skip a test would be independent of the env var handling, and outside the scope of this series since there's no need for it here.

Where is the default value for this env var applied for both CI and users? yaml is for CI only.

Quoted 3 lines

With regards,
Daniel

#49 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

In reply to Daniel P. Berrangé

On 12/05/2026 18.36, Daniel P. Berrangé wrote:
...

Quoted 3 lines

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

The functional tests and the qtests both already use the QEMU_TEST_FLAKY_TESTS environment variable to decide whether to run a flaky test or not. Could we please use the same mechanism in the iotests, too? ... I'd really like to avoid that we have to remember specific ways to disable flaky tests for each test subsystem...

Thanks,
Thomas

#13 lore raw

Re: [PATCH 07/16] scripts/mtest2make: support optional tests grouping

In reply to Pierrick Bouvier
Quoted 93 lines · Pierrick Bouvier
Quoted 79 lines · 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 +11 -5
index 915f02d600..383ea68b16 100644
@@ -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)')
 

scripts/mtest2make.py def emit_prolog(suites, prefix): · line 104

Quoted 10 lines
scripts/mtest2make.py +4 -2
     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
Quoted 3 lines

Not blocking this patch, thus reviewed, but I think it would be a better abstraction to use meson suites for this (a test can be added in multiple suites), instead of adding more clunk to makefile layer.

This *is* using meson suites. The mtest2make script takes the list of meson suites and generates makefile targets which can be used to select execution of the meson suites. This change is exposing more of the suites as makefile targets, since make is our primary entry point.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#29 lore raw

Re: [PATCH 12/16] tests: validate dmsetup result in test 128

In reply to Pierrick Bouvier
Quoted 29 lines · Pierrick Bouvier
Quoted 20 lines · 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

Quoted 7 lines

(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.

Quoted 3 lines

Could that be related to the fact it's running inside a container (if it is). Maybe it's just missing exposing all /dev instead of a limited set of devices.

We don't have any control over what's present in /dev in test environments, so we shouldn't assume /dev automatically exposes devices that we can create via device mapper, as it could be locked down.

Quoted 15 lines
Quoted 15 lines
---
 tests/qemu-iotests/128 | 6 ++++++
 1 file changed, 6 insertions(+)
tests/qemu-iotests/128 +1 -0
index d0e00d24b1..d75b1a451a 100755
@@ -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"
Quoted 9 lines

tests/qemu-iotests/128 _setup_eiodev() · line 53

Quoted 8 lines
tests/qemu-iotests/128 +5 -0
+			if ! -e $DEV
+			then
+				_notrun "Device $DEV not appearing"
+			fi
+
 			sudo="$cmd"
 			return
 		fi

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#47 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

In reply to Pierrick Bouvier
Quoted 218 lines · Pierrick Bouvier
Quoted 217 lines · Daniel P. Berrangé
Quoted 215 lines · Pierrick Bouvier
Quoted 199 lines · Daniel P. Berrangé
Quoted 180 lines · Pierrick Bouvier
Quoted 179 lines · Daniel P. Berrangé
Quoted 165 lines · Pierrick Bouvier
Quoted 164 lines · Daniel P. Berrangé
Quoted 151 lines · Pierrick Bouvier
Quoted 93 lines · Daniel P. Berrangé
Quoted 92 lines · Pierrick Bouvier
Quoted 90 lines · Daniel P. Berrangé
Quoted 77 lines · Pierrick Bouvier

On 4/24/2026 8:42 AM, Daniel P. Berrangé wrote:
The nature of block I/O tests is such that there can be unexpected false
positive failures in certain scenarios that have not been encountered
before, and sometimes non-deterministic failures that are hard to
reproduce.

Before enabling the I/O tests as gating jobs in CI, there needs to be a
mechanism to dynamically mark tests as skipped, without having to commit
code changes.

This introduces the QEMU_TEST_IO_SKIP environment variable that is set
to a list of FORMAT-OR-PROTOCOL:NAME pairs. The intent is that this
variable can be set as a GitLab CI pipeline variable to temporarily
disable a test while problems are being debugged.

Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
---
docs/devel/testing/main.rst | 7 +++++++
tests/qemu-iotests/testrunner.py | 16 ++++++++++++++++
2 files changed, 23 insertions(+)

diff --git a/docs/devel/testing/main.rst b/docs/devel/testing/main.rst
index 797111009a..f779a64415 100644
--- a/docs/devel/testing/main.rst
+++ b/docs/devel/testing/main.rst
@@ -284,6 +284,13 @@ that are specific to certain cache mode.
More options are supported by the ``./check`` script, run ``./check -h`` for
help.

+If a test program is known to be broken, it can be disabled by setting
+the ``QEMU_TEST_IO_SKIP`` environment variable with a list of tests to
+be skipped. The values are of the form FORMAT-OR-PROTOCOL:NAME, the
+leading component can be omitted to skip the test for all formats and
+protocols. For example ``export QEMU_TEST_IO_SKIP="luks:149 185 iov-padding``
+will skip ``149`` for LUKS only, and ``185`` and ``iov-padding`` for all.
+
Writing a new test case
~~~~~~~~~~~~~~~~~~~~~~~

diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index dbe2dddc32..ecb5d4529f 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -145,6 +145,18 @@ def __init__(self, env: TestEnv, tap: bool = False,

self._stack: contextlib.ExitStack

+ self.skip = {}
+ for rule in os.environ.get("QEMU_TEST_IO_SKIP", "").split(" "):
+ rule = rule.strip()
+ if rule == "":
+ continue
+ if ":" in rule:
+ fmt, name = rule.split(":")
+ if fmt in ("", env.imgfmt, env.imgproto):
+ self.skip[name] = True
+ else:
+ self.skip[rule] = True
+
def __enter__(self) -> 'TestRunner':
self._stack = contextlib.ExitStack()
self._stack.enter_context(self.env)
@@ -251,6 +263,10 @@ def do_run_test(self, test: str) -> TestResult:
description='No qualified output '
f'(expected {f_reference})')

+ if f_test.name in self.skip:
+ return TestResult(status='not run',
+ description='Listed in QEMU_TEST_IO_SKIP')
+
args = [str(f_test.resolve())]
env = self.env.prepare_subprocess(args)

Why not simply remove the broken tests, and create issues to add them
again in the future?

In theory that's what our policy today is, but in practice it is too much of a burden on the release co-ordinator, to expect them to create such a patch themselves, or wait on a subsys maintainer todo it for them.

They end up just ignoring brokenness in CI which is a bad practice, and will prevent us ever making CI truely gating or switching to using MRs for pull requests. This gives us a super-fast way to skip flaky tests, while the subsystem maintainers figure out the right permanent answer.

Quoted 9 lines
Quoted 3 lines

I disagree on this one, merging a single patch doing a git rm, and a git revert later is not more expensive than merging a variable modifying a variable in a yaml file.

Any code changes like that need to be sent back to the subsystem maintainer to be acked. IMHO the release manager should not be unilaterally deleting tests without peer review. So that's got a non-negligible turn around time, during which CI is broken.

I accept the argument, but it seems like a workaround for a human process, more than a proper solution to the problem.

It would be better to have a proper policy for build/test fixes, instead of implementing local overrides to this.

Quoted 34 lines

Setting an env variable to skip a problematic test is something reasonable to do with zero oversight.

Quoted 3 lines

The issue with this approach is that people running tests locally will not see which tests are skipped, and will see false positives. So you just keep CI green, but not the test base itself.

I would still expect the release manager to file a bug about any flaky test they disable via the env var, and the subsystem maintainer should still be fixing it or disabling it such that tests won't fail more broadly, or deciding to remove it if terminally broken.

We're just decoupling the process so that there is an immediate workaround possible. It can also be used by people working in their forks - often I've been testing stuff in my fork, but see spurious failures because git master has a non-deterministic test failure merged. I would like to easily skip those in my fork too, without adding extra commits to me working branches, as that would require the same commit to be duped into several in-progress branches, vs setting the env var once.

Quoted 3 lines

The risk I see is that some tests will stay forever in this skip variable, so it will be dead code for CI, but still alive and failing for people running tests manually who hit the regression.

Again, there should be a bug filed for any flaky test. Anyone can do this, if they see it locally or in their fork CI, or in staging CI. If no one can see an obvious fix, then anyone can also propose to disable the test.

Quoted 4 lines

If you still want an alternative to removing test, implementing a skip_list in tests/qemu-iotests/meson.build is better than an env var IMHO, and achieves the exact same effect, for CI and for users.

Quoted 6 lines
Quoted 1 line

What do you think?

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 7 lines

I'm not sure all this answers to my question about How to ensure users who run tests and the CI both see the same skip list.

I don't mind having an env var, a black list in meson or any other solution, but having different results on a dev machine and in CI is not a good design. So whatever the solution is, the CI yaml file is not the proper place to store this information.

AFAICT the test 185 that is being skipped in the CI yaml file only fails when run under gitlab. I've never seen a failure running it locally.

Quoted 7 lines
Quoted 3 lines

If it failed locally too, then I'd agree that it should not be skipped in the CI yaml, but universally skipped in all scenarios.

If I get all this correctly, we add a generic mechanic to be able to gate CI with block tests just because there is a single test failing with a single driver. Is that the right approach?

The env variable is the generic mechanism.

The yaml file exclusion for 185 is the special case, but we get that basically for free with the former.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

In the future, do we expect to merge code breaking tests?

Yes. We will certainly merge more non-deterministic tests. We've seen this over & over again. Something passes CI initially but after a number of CI pipelines turns out to be flaky

Then we can mark them as flaky in tests/qemu-iotests/meson.build.

That is a long term solution. It does not address the immediate time critical goal to have the ability to fix a broken CI pipeline immediately by skipping the test without waiting for code changes.

Quoted 4 lines

It seems like you ignore the point that there is a problem between setting something in CI only vs making something that works for all users. I'm not against an env var, I just don't see how it answers this need.

Quoted 5 lines

Again, I'm not saying that we fix this only for CI. The env var is to allow broken jobs to be immediately skipped, while waiting for code changes to permanently skipped/fix the tests. The latter addresses it for every scenario.

I might have missed where we have a default value for this env var, out of yaml file, that makes it apply the exact same set of skip tests for CI, and for users running tests manually.

Where is this default applied for both CI and users?

I understand it's not needed for test 185 which fails only in GitLab, but as you mentioned, we'll probably have non deterministic tests in the future, so we need to consider this.

Quoted 8 lines
Quoted 4 lines

I was considering any change in meson.build to permanently skip a test would be independent of the env var handling, and outside the scope of this series since there's no need for it here.

Where is the default value for this env var applied for both CI and users? yaml is for CI only.

Hi all,

I think Pierrick's concern is valid, but I see it slightly differently:

In the case of an environment variable, it's possible to set it without any code change (even to .yaml files), by setting "-o ci.variable=<val>" at git push time and also by setting directly in GitLab's web interface under "New Pipeline". So it allows anyone wanting to "just get work done" to skip broken tests for the duration of a pipeline.

It also works when running locally and skipping some tests for the single local run.

All temporary changes, of course.

For the case of a flaky test that will need to be disabled for longer than a single run, could we standardize on a list committed to meson.build, so it works for both CI and local? I think so, and I think it's a good idea. Having recently taking up maintainership of QTests I sometimes stumble into disabled tests that have been there for years and everyone forgot about them. Same with the migration subsystem. Having a single place to check from time to time would be helpful.

Migration, by the way, has been using the env variable approach in qtest like this:

    /*
     * Our CI system has problems with shared memory.
     * Don't run this test until we find a workaround.
     */
    if (getenv("QEMU_TEST_FLAKY_TESTS")) {

Which is a case in which a single list committed in meson.build wouldn't help. We actually do want to skip this only for CI. ("problems with shared memory" here means that CI environments simply don't have enough shared memory space available to run all the tests that make use of it)

A further complication is that in the migration case above, that skip does not apply to the entire migration-test, it applies to a sub-test (./migration-test -p /x86/migration/mode/reboot). Constructs in meson.build would not be able to skip this, they can only skip the entire migration-test. There is an -x option that gtester accepts, so we'd need to write some meson-fu to invoke "./migration-test -x /x86/migration/mode/reboot -x ..." if any subtest is to be skipped (note that this is not migration-specific, all qtests that invoke g_test_add_data* more than once are like this).

Maybe we could work on a proposal to improve this in a generic way for all test frameworks.

PS: I'd even say there's a lot we could make common between frameworks. A bunch of what happens around running a test is generic programming, not tied to a specific programming language or accelerator (in case of qtest).

Quoted 3 lines
Quoted 3 lines

With regards,
Daniel

#48 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

Quoted 11 lines · Fabiano Rosas

In the case of an environment variable, it's possible to set it without any code change (even to .yaml files), by setting "-o ci.variable=<val>" at git push time and also by setting directly in GitLab's web interface under "New Pipeline". So it allows anyone wanting to "just get work done" to skip broken tests for the duration of a pipeline.

It also works when running locally and skipping some tests for the single local run.

All temporary changes, of course.

Quoted 7 lines

For the case of a flaky test that will need to be disabled for longer than a single run, could we standardize on a list committed to meson.build, so it works for both CI and local? I think so, and I think it's a good idea. Having recently taking up maintainership of QTests I sometimes stumble into disabled tests that have been there for years and everyone forgot about them. Same with the migration subsystem. Having a single place to check from time to time would be helpful.

That was one of the reasons why when wwe introduced the "QEMU_TEST_FLAKY_TESTS" env in tests/functional, we mandated a gitlab issue URL is provided. This gives us a record of why it was turned off both in the code and issue tracker.

If we can keep all permanent test disablement behind QEMU_TEST_FLAKY_TESTS we avoid needing to add logic to meson.build too.

Quoted 25 lines

Migration, by the way, has been using the env variable approach in qtest like this:

    /*
     * Our CI system has problems with shared memory.
     * Don't run this test until we find a workaround.
     */
    if (getenv("QEMU_TEST_FLAKY_TESTS")) {

Which is a case in which a single list committed in meson.build wouldn't help. We actually do want to skip this only for CI. ("problems with shared memory" here means that CI environments simply don't have enough shared memory space available to run all the tests that make use of it)

A further complication is that in the migration case above, that skip does not apply to the entire migration-test, it applies to a sub-test (./migration-test -p /x86/migration/mode/reboot). Constructs in meson.build would not be able to skip this, they can only skip the entire migration-test. There is an -x option that gtester accepts, so we'd need to write some meson-fu to invoke "./migration-test -x /x86/migration/mode/reboot -x ..." if any subtest is to be skipped (note that this is not migration-specific, all qtests that invoke g_test_add_data* more than once are like this).

Quoted 2 lines

Maybe we could work on a proposal to improve this in a generic way for all test frameworks.

I have dropped this patch in my v6 posting, as it would indeed be much more useful if it worked across all the test subsystems.

My v6 has meanwhile introduced the QEMU_TEST_FLAKY_TESTS concept to the I/O tests (as suggested by Thomas), to skip the dodgy I/O test universally in all scenarios which satisfies Pierrick's request.

Quoted 4 lines

PS: I'd even say there's a lot we could make common between frameworks. A bunch of what happens around running a test is generic programming, not tied to a specific programming language or accelerator (in case of qtest).

Yeah, getting everything being represented as meson tests was one of the things we did to make the frameworks more common.

I think there's scope for having more common env variable names too. eg we have different env variable names to specify the name of the QEMU emulator binary which is a bit silly.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#14 lore raw

Re: [PATCH 07/16] scripts/mtest2make: support optional tests grouping

In reply to Daniel P. Berrangé
Quoted 105 lines · Daniel P. Berrangé
Quoted 93 lines · Pierrick Bouvier
Quoted 79 lines · 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 +11 -5
index 915f02d600..383ea68b16 100644
@@ -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)')
 

scripts/mtest2make.py def emit_prolog(suites, prefix): · line 104

Quoted 10 lines
scripts/mtest2make.py +4 -2
     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
Quoted 3 lines

Not blocking this patch, thus reviewed, but I think it would be a better abstraction to use meson suites for this (a test can be added in multiple suites), instead of adding more clunk to makefile layer.

This *is* using meson suites. The mtest2make script takes the list of meson suites and generates makefile targets which can be used to select execution of the meson suites. This change is exposing more of the suites as makefile targets, since make is our primary entry point.

Quoted 2 lines

With regards,
Daniel

Maybe I can't read this patch correctly, but from it, and the message description, I understand that -optional is a pure Makefile abstraction, and does not reflect any real meson suite.

```
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.
```

Regards,
Pierrick

Reviewed-by
#30 lore raw

Re: [PATCH 12/16] tests: validate dmsetup result in test 128

In reply to Daniel P. Berrangé
Quoted 30 lines · Daniel P. Berrangé
Quoted 29 lines · Pierrick Bouvier
Quoted 27 lines · 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.

Quoted 8 lines
Quoted 3 lines

Could that be related to the fact it's running inside a container (if it is). Maybe it's just missing exposing all /dev instead of a limited set of devices.

We don't have any control over what's present in /dev in test environments, so we shouldn't assume /dev automatically exposes devices that we can create via device mapper, as it could be locked down.

Ok.

Regards,
Pierrick

#50 lore raw

Re: [PATCH 14/16] tests: add QEMU_TEST_IO_SKIP for skipping I/O tests

In reply to Thomas Huth
Quoted 6 lines · Thomas Huth

On 12/05/2026 18.36, Daniel P. Berrangé wrote:
...

Quoted 3 lines

IMHO there needs to be a way to skip flaky tests which does not require code changes as the only available option. Code changes are the permanent fix, env var is the immediate workaround.

Quoted 6 lines

The functional tests and the qtests both already use the QEMU_TEST_FLAKY_TESTS environment variable to decide whether to run a flaky test or not. Could we please use the same mechanism in the iotests, too? ... I'd really like to avoid that we have to remember specific ways to disable flaky tests for each test subsystem...

This sounds like a good idea to reuse the same mechanism. And should be easy to implement this is in iotest shell script directly.

Quoted 3 lines

 Thanks,
  Thomas

#15 lore raw

Re: [PATCH 07/16] scripts/mtest2make: support optional tests grouping

In reply to Pierrick Bouvier
Quoted 106 lines · Pierrick Bouvier
Quoted 105 lines · Daniel P. Berrangé
Quoted 93 lines · Pierrick Bouvier
Quoted 79 lines · 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 +11 -5
index 915f02d600..383ea68b16 100644
@@ -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)')
 

scripts/mtest2make.py def emit_prolog(suites, prefix): · line 104

Quoted 10 lines
scripts/mtest2make.py +4 -2
     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
Quoted 3 lines

Not blocking this patch, thus reviewed, but I think it would be a better abstraction to use meson suites for this (a test can be added in multiple suites), instead of adding more clunk to makefile layer.

This *is* using meson suites. The mtest2make script takes the list of meson suites and generates makefile targets which can be used to select execution of the meson suites. This change is exposing more of the suites as makefile targets, since make is our primary entry point.

Quoted 6 lines
Quoted 2 lines

With regards,
Daniel

Maybe I can't read this patch correctly, but from it, and the message description, I understand that -optional is a pure Makefile abstraction, and does not reflect any real meson suite.

Actually its the other way around. In the next patch in this series we create meson suites like "block-nbd-optional" and that gets turned into a makefile target "check-block-nbd". The "optional" part of the meson suite name determines that "check-block-nbd" is NOT added as a depedency of "check". IOW, it doesn't get run by "make check", but must be optionally run through "make check-block-nbd" when needed.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#16 lore raw

Re: [PATCH 07/16] scripts/mtest2make: support optional tests grouping

Quoted 114 lines · Daniel P. Berrangé
Quoted 106 lines · Pierrick Bouvier
Quoted 105 lines · Daniel P. Berrangé
Quoted 93 lines · Pierrick Bouvier
Quoted 79 lines · 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 +11 -5
index 915f02d600..383ea68b16 100644
@@ -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)')
 

scripts/mtest2make.py def emit_prolog(suites, prefix): · line 104

Quoted 10 lines
scripts/mtest2make.py +4 -2
     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
Quoted 3 lines

Not blocking this patch, thus reviewed, but I think it would be a better abstraction to use meson suites for this (a test can be added in multiple suites), instead of adding more clunk to makefile layer.

This *is* using meson suites. The mtest2make script takes the list of meson suites and generates makefile targets which can be used to select execution of the meson suites. This change is exposing more of the suites as makefile targets, since make is our primary entry point.

Quoted 6 lines
Quoted 2 lines

With regards,
Daniel

Maybe I can't read this patch correctly, but from it, and the message description, I understand that -optional is a pure Makefile abstraction, and does not reflect any real meson suite.

Quoted 7 lines

Actually its the other way around. In the next patch in this series we create meson suites like "block-nbd-optional" and that gets turned into a makefile target "check-block-nbd". The "optional" part of the meson suite name determines that "check-block-nbd" is NOT added as a depedency of "check". IOW, it doesn't get run by "make check", but must be optionally run through "make check-block-nbd" when needed.

Oh right.
Just to double check, will everything still run when using make check-block SPEED=thorough, or is there some new behaviour on this side?

Quoted 2 lines

With regards,
Daniel

#17 lore raw

Re: [PATCH 07/16] scripts/mtest2make: support optional tests grouping

Quoted 123 lines · Pierrick Bouvier
Quoted 114 lines · Daniel P. Berrangé
Quoted 106 lines · Pierrick Bouvier
Quoted 105 lines · Daniel P. Berrangé
Quoted 93 lines · Pierrick Bouvier
Quoted 79 lines · 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 +11 -5
index 915f02d600..383ea68b16 100644
@@ -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)')
 

scripts/mtest2make.py def emit_prolog(suites, prefix): · line 104

Quoted 10 lines
scripts/mtest2make.py +4 -2
     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
Quoted 3 lines

Not blocking this patch, thus reviewed, but I think it would be a better abstraction to use meson suites for this (a test can be added in multiple suites), instead of adding more clunk to makefile layer.

This *is* using meson suites. The mtest2make script takes the list of meson suites and generates makefile targets which can be used to select execution of the meson suites. This change is exposing more of the suites as makefile targets, since make is our primary entry point.

Quoted 6 lines
Quoted 2 lines

With regards,
Daniel

Maybe I can't read this patch correctly, but from it, and the message description, I understand that -optional is a pure Makefile abstraction, and does not reflect any real meson suite.

Quoted 7 lines

Actually its the other way around. In the next patch in this series we create meson suites like "block-nbd-optional" and that gets turned into a makefile target "check-block-nbd". The "optional" part of the meson suite name determines that "check-block-nbd" is NOT added as a depedency of "check". IOW, it doesn't get run by "make check", but must be optionally run through "make check-block-nbd" when needed.

Quoted 4 lines

Oh right.
Just to double check, will everything still run when using make check-block SPEED=thorough, or is there some new behaviour on this side?

Yes, this commit doesn't affect that existing make target, so it operates as before.

Patch 5 does however fix a pre-existing problem - currently even with SPEED=thorough most of the qcow2 tests didn't get run, only the "quick" tests. With this series SPEED=thorough correctly does what people thought it was already doing.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#18 lore raw

Re: [PATCH 07/16] scripts/mtest2make: support optional tests grouping

Quoted 129 lines · Daniel P. Berrangé
Quoted 123 lines · Pierrick Bouvier
Quoted 114 lines · Daniel P. Berrangé
Quoted 106 lines · Pierrick Bouvier
Quoted 105 lines · Daniel P. Berrangé
Quoted 93 lines · Pierrick Bouvier
Quoted 79 lines · 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 +11 -5
index 915f02d600..383ea68b16 100644
@@ -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)')
 

scripts/mtest2make.py def emit_prolog(suites, prefix): · line 104

Quoted 10 lines
scripts/mtest2make.py +4 -2
     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
Quoted 3 lines

Not blocking this patch, thus reviewed, but I think it would be a better abstraction to use meson suites for this (a test can be added in multiple suites), instead of adding more clunk to makefile layer.

This *is* using meson suites. The mtest2make script takes the list of meson suites and generates makefile targets which can be used to select execution of the meson suites. This change is exposing more of the suites as makefile targets, since make is our primary entry point.

Quoted 6 lines
Quoted 2 lines

With regards,
Daniel

Maybe I can't read this patch correctly, but from it, and the message description, I understand that -optional is a pure Makefile abstraction, and does not reflect any real meson suite.

Quoted 7 lines

Actually its the other way around. In the next patch in this series we create meson suites like "block-nbd-optional" and that gets turned into a makefile target "check-block-nbd". The "optional" part of the meson suite name determines that "check-block-nbd" is NOT added as a depedency of "check". IOW, it doesn't get run by "make check", but must be optionally run through "make check-block-nbd" when needed.

Quoted 4 lines

Oh right.
Just to double check, will everything still run when using make check-block SPEED=thorough, or is there some new behaviour on this side?

Quoted 8 lines

Yes, this commit doesn't affect that existing make target, so it operates as before.

Patch 5 does however fix a pre-existing problem - currently even with SPEED=thorough most of the qcow2 tests didn't get run, only the "quick" tests. With this series SPEED=thorough correctly does what people thought it was already doing.

Sounds good, thanks Daniel.

Quoted 2 lines

With regards,
Daniel