Skip to contentSkip to conversation

python: drop qemu.qmp from qemu.git tree

PATCH Superseded John Snow 4 participants 45 messages Nov 17, 2025 – Nov 21, 2025

Subsystems (2)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
author
#1 lore raw

PATCH 1/22 python/mkvenv: ensure HAVE_LIB variables are actually constants

In reply to John Snow

Pylint 4.x has refined checking for variable names that behave as constants vs ones that do not; unfortunately our tricky import machinery is perceived as these variables being re-assigned.

Add a temporary variable with an underscore and assign to the global constants precisely once to alleviate this new nag message. Add an ignore for this name for older versions of pylint that developers may have installed locally.

(In other words: there is no solution that will cater to both pre- and post- 4.x versions, so we target 4.x here and silence older versions.)

---
 python/scripts/mkvenv.py | 24 ++++++++++++++++--------
 python/setup.cfg         |  1 +
 2 files changed, 17 insertions(+), 8 deletions(-)
python/scripts/mkvenv.py +16 -8
index 9aed266df1b..a064709e6ce 100644
@@ -92,7 +92,7 @@
 # Try to load distlib, with a fallback to pip's vendored version.
 # HAVE_DISTLIB is checked below, just-in-time, so that mkvenv does not fail
 # outside the venv or before a potential call to ensurepip in checkpip().
-HAVE_DISTLIB = True
+_import_ok = True
 try:
     import distlib.scripts
 except ImportError:
@@ -102,11 +102,13 @@
         from pip._vendor import distlib
         import pip._vendor.distlib.scripts  # noqa, pylint: disable=unused-import
     except ImportError:
-        HAVE_DISTLIB = False
+        _import_ok = False
+
+HAVE_DISTLIB = _import_ok
 
 # pip 25.2 does not vendor distlib.version, but it uses vendored
 # packaging.version
-HAVE_DISTLIB_VERSION = True
+_import_ok = True
 try:
     import distlib.version  # pylint: disable=ungrouped-imports
 except ImportError:
@@ -114,9 +116,11 @@
         # pylint: disable=unused-import,ungrouped-imports
         import pip._vendor.distlib.version  # noqa
     except ImportError:
-        HAVE_DISTLIB_VERSION = False
+        _import_ok = False
 
-HAVE_PACKAGING_VERSION = True
+HAVE_DISTLIB_VERSION = _import_ok
+
+_import_ok = True
 try:
     # Do not bother importing non-vendored packaging, because it is not
     # in stdlib.
@@ -125,20 +129,24 @@
     import pip._vendor.packaging.requirements  # noqa
     import pip._vendor.packaging.version  # noqa
 except ImportError:
-    HAVE_PACKAGING_VERSION = False
+    _import_ok = False
+
+HAVE_PACKAGING_VERSION = _import_ok
 
 
 # Try to load tomllib, with a fallback to tomli.
 # HAVE_TOMLLIB is checked below, just-in-time, so that mkvenv does not fail
 # outside the venv or before a potential call to ensurepip in checkpip().
-HAVE_TOMLLIB = True
+_import_ok = True
 try:
     import tomllib
 except ImportError:
     try:
         import tomli as tomllib
     except ImportError:
-        HAVE_TOMLLIB = False
+        _import_ok = False
+
+HAVE_TOMLLIB = _import_ok
 
 # Do not add any mandatory dependencies from outside the stdlib:
 # This script *must* be usable standalone!
python/setup.cfg +1 -0
index d7f5dc7bafe..f40f11396c9 100644
@@ -159,6 +159,7 @@ good-names=i,
            c,   # for c in string: ...
            T,   # for TypeVars. See pylint#3401
            SocketAddrT,  # Not sure why this is invalid.
+           _import_ok,  # For mkvenv import trickery and compatibility pre-4.x
 
 [pylint.similarities]
 # Ignore imports when computing similarities.
Signature · 1 line
2.51.1

John Snow

author
#0 lore raw

cover python: drop qemu.qmp from qemu.git tree

Hi, this series does a few things, but it's ultimately in service of dropping the python qemu.qmp package from the qemu.git tree in favor of using the standalone package instead, to prevent any further issues from the two codebases diverging.

Patches 1-3: Fix linting issues that have cropped up with python Patches 4-8,12,16: Set up new python dependency targets in Meson Patches 9-10,17: Adjust test execution in GitLab to cope with new test
dependency structure
Patch 11: Add vendored qemu.qmp package for isolated/offline test
execution
Patches 13-15: Fix meson build system (Paolo Bonzini) Patches 18-20: Teach mkvenv how to install local packages Patch 21: Replace "make check-venv" in Makefile with meson execution Patch 22: Drop qemu.qmp.

There are some quality problems with Patches 18-20, but all GitLab tests are green and this is a great starting point to discuss this series.

--js

John Snow (19):
python/mkvenv: ensure HAVE_LIB variables are actually constants python/qapi: add an ignore for Pylint 4.x
python/qapi: delint import statements
python/mkvenv: create timestamp file for each group "ensured" python/mkvenv: bump 'qemu.qmp' dependency for testdeps python/mkvenv: rename 'testdeps' to 'functests' python/mkvenv: add "checktests" dependency group
meson, mkvenv: add checktests and functests custom targets tests/iotests: Use configured python to run GitLab iotests tests/iotests: use "make check-venv" to prepare for running iotests
python: add vendored qemu.qmp package
meson, mkvenv: make iotests depend on checktests group meson, mkvenv: make functional tests depend on functests group
tests: forcibly run 'make check-venv' for crash tests python/mkvenv: add mechanism to install local package(s)
mkvenv: add --no-build-isolation flag
meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml tests/Makefile: replace old "check-venv" target with meson target
python: delete qemu.qmp

Paolo Bonzini (3):
mtest2make: cleanup mtest-suites variables
mtest2make: add dependencies to the "speed-qualified" suite
mtest2make: do not repeat the same speed over and over

 Makefile                                      |    4 +-
 meson.build                                   |    1 +
 .gitlab-ci.d/buildtest.yml                    |    9 +-
 python/qemu/qmp/__init__.py                   |   60 -
 python/qemu/qmp/error.py                      |   53 -
 python/qemu/qmp/events.py                     |  751 -----------
 python/qemu/qmp/legacy.py                     |  339 -----
 python/qemu/qmp/message.py                    |  217 ----
 python/qemu/qmp/models.py                     |  146 ---
 python/qemu/qmp/protocol.py                   | 1101 -----------------
 python/qemu/qmp/py.typed                      |    0
 python/qemu/qmp/qmp_client.py                 |  732 -----------
 python/qemu/qmp/qmp_shell.py                  |  689 -----------
 python/qemu/qmp/qmp_tui.py                    |  665 ----------
 python/qemu/qmp/util.py                       |  150 ---
 python/qemu/utils/qom_fuse.py                 |    1 -
 python/scripts/mkvenv.py                      |   35 +-
 python/scripts/vendor.py                      |    2 +
 python/setup.cfg                              |   32 +-
 python/tests/minreqs.txt                      |    8 +-
 python/tests/protocol.py                      |  596 ---------
 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl |  Bin 0 -> 72263 bytes
 pythondeps.toml                               |    7 +-
 pyvenv/meson.build                            |   34 +
 scripts/mtest2make.py                         |   41 +-
 scripts/qapi/commands.py                      |    5 +-
 scripts/qapi/introspect.py                    |    2 +-
 tests/Makefile.include                        |   25 +-
 tests/functional/meson.build                  |    7 +-
 tests/qemu-iotests/meson.build                |    2 +-
 30 files changed, 116 insertions(+), 5598 deletions(-)
 delete mode 100644 python/qemu/qmp/__init__.py
 delete mode 100644 python/qemu/qmp/error.py
 delete mode 100644 python/qemu/qmp/events.py
 delete mode 100644 python/qemu/qmp/legacy.py
 delete mode 100644 python/qemu/qmp/message.py
 delete mode 100644 python/qemu/qmp/models.py
 delete mode 100644 python/qemu/qmp/protocol.py
 delete mode 100644 python/qemu/qmp/py.typed
 delete mode 100644 python/qemu/qmp/qmp_client.py
 delete mode 100644 python/qemu/qmp/qmp_shell.py
 delete mode 100644 python/qemu/qmp/qmp_tui.py
 delete mode 100644 python/qemu/qmp/util.py
 delete mode 100644 python/tests/protocol.py
 create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl
 create mode 100644 pyvenv/meson.build
Signature · 1 line
2.51.1
author
#3 lore raw

PATCH 2/22 python/qapi: add an ignore for Pylint 4.x

Pylint 4.x wants to use a different regex for _Stub for some reason; just silence this.

---
 scripts/qapi/introspect.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi/introspect.py +1 -1
index 89ee5d5f176..7e28de2279a 100644
@@ -59,7 +59,7 @@
 #
 # Sadly, mypy does not support recursive types; so the _Stub alias is used to
 # mark the imprecision in the type model where we'd otherwise use JSONValue.
-_Stub = Any
+_Stub = Any  # pylint: disable=invalid-name
 _Scalar = Union[str, bool, None]
 _NonScalar = Union[Dict[str, _Stub], List[_Stub]]
 _Value = Union[_Scalar, _NonScalar]
Signature · 1 line
2.51.1
author
#14 lore raw

PATCH 7/22 python/mkvenv: add "checktests" dependency group

In reply to John Snow

This group is intended for packages required to run "make check" successfully. Once qemu.qmp is fully divorced from the source tree, this will primarily mean the qemu.qmp package and the remaining in-tree python packages. It specifically excludes packages only needed to run the functional tests, which are not invoked by default for "make check".

Amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them.

---
 pythondeps.toml        | 4 +++-
 tests/Makefile.include | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
pythondeps.toml +3 -1
index d814bb54d08..b931d8bb578 100644
@@ -31,6 +31,8 @@ meson = { accepted = ">=1.9.0", installed = "1.9.0", canary = "meson" }
 sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
 sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
-[functests]
+[checktests]
 "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
+
+[functests]
 pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
tests/Makefile.include +1 -1
index 6f86eb283d3..40b114bd158 100644
@@ -98,7 +98,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
 
 $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
 	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-	$(MKVENV_ENSUREGROUP) $< functests
+	$(MKVENV_ENSUREGROUP) $< checktests functests
 	$(call quiet-command, touch $@)
 
 check-venv: $(TESTS_VENV_TOKEN)
Signature · 1 line
2.51.1
author
#16 lore raw

PATCH 8/22 meson, mkvenv: add checktests and functests custom targets

In reply to John Snow

add "pyvenv_checktests_group" and "pyvenv_functests_group" targets to meson. These targets will invoke mkvenv.py to install the associated dependency group to the build/pyvenv directory.

---
 meson.build        |  1 +
 pyvenv/meson.build | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 pyvenv/meson.build
meson.build +1 -0
index df4460035c3..0e9c73dc2a0 100644
@@ -4585,6 +4585,7 @@ subdir('scripts')
 subdir('tools')
 subdir('pc-bios')
 subdir('docs')
+subdir('pyvenv')
 # Tests are disabled on emscripten because they rely on host features that aren't
 # supported by emscripten (e.g. fork and unix socket).
 if host_os != 'emscripten'
pyvenv/meson.build new file +34 -0
new file mode 100644
index 00000000000..6631caf9b7a
@@ -0,0 +1,34 @@
+# Note that this file only controls "optional" dependency groups; groups
+# *required* for the build are handled directly in configure instead:
+# namely, meson and sphinx.
+
+pyvenv_common_deps = files(
+    meson.project_source_root() + '/pythondeps.toml',
+    meson.project_source_root() + '/python/scripts/mkvenv.py'
+)
+pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels'
+
+
+pyvenv_checktests_group = custom_target(
+    'pyvenv_checktests_group',
+    output: 'checktests.group',
+    input: pyvenv_common_deps,
+    command: [ python, '@INPUT1@',
+               'ensuregroup',
+               '--dir', pyvenv_wheel_dir,
+               '@INPUT0@',
+               'checktests' ],
+)
+
+
+pyvenv_functests_group = custom_target(
+    'pyvenv_functests_group',
+    output: 'functests.group',
+    input: pyvenv_common_deps,
+    depends: pyvenv_checktests_group,
+    command: [ python, '@INPUT1@',
+               'ensuregroup',
+               '--dir', pyvenv_wheel_dir,
+               '@INPUT0@',
+               'functests' ],
+)
Signature · 1 line
2.51.1
author
#5 lore raw

PATCH 3/22 python/qapi: delint import statements

In reply to John Snow

Missed a spot with isort, which now causes the python-minreqs test on GitLab to fail. Fix it.

(Hint: the commands in python/tests/qapi-isort.sh can be run without the "-c" parameter to automatically adjust import statements according to our style rules. Maybe I should make a pre-submit hook that makes this adjustment automatically. What do you think?)

Fixes 5bd89761
---
 scripts/qapi/commands.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
scripts/qapi/commands.py +1 -4
index a82b5a2a5e6..9dede747205 100644
@@ -13,10 +13,7 @@
 See the COPYING file in the top-level directory.
 """
 
-from typing import (
-    List,
-    Optional,
-)
+from typing import List, Optional
 
 from .common import c_name, mcgen
 from .gen import (
Signature · 1 line
2.51.1
author
#20 lore raw

PATCH 10/22 tests/iotests: use "make check-venv" to prepare for running iotests

In reply to John Snow

Soon, qemu.qmp will not be included in the qemu.git tree and so invoking the meson target for preparing the "checktests" mkvenv group will be necessary for this test to run successfully. Doing it now in its own patch separates this change from the big switcheroo patch.

---
 .gitlab-ci.d/buildtest.yml | 1 +
 1 file changed, 1 insertion(+)
.gitlab-ci.d/buildtest.yml +1 -0
index c3a9e8428c2..18d72d3058b 100644
@@ -350,6 +350,7 @@ build-tcg-disabled:
     - make -j"$JOBS"
     - make check-unit
     - make check-qapi-schema
+    - make check-venv
     - cd tests/qemu-iotests/
     - ../../pyvenv/bin/python3 ./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
Signature · 1 line
2.51.1
author
#7 lore raw

PATCH 4/22 python/mkvenv: create timestamp file for each group "ensured"

In reply to John Snow

Each group ensured by the mkvenv script will create an empty timestamp file named {groupname}.group which can be used to conditionally trigger dependency installation from various scripts and build machinery.

---
 python/scripts/mkvenv.py | 6 ++++++
 1 file changed, 6 insertions(+)
python/scripts/mkvenv.py +6 -0
index a064709e6ce..a22e3ee3394 100644
@@ -838,6 +838,12 @@ def ensure_group(
             raise Ouch(result[0])
         raise SystemExit(f"\n{result[0]}\n\n")
 
+    if inside_a_venv():
+        for group in groups:
+            path = Path(sys.prefix).joinpath(f"{group}.group")
+            with open(path, "w", encoding="UTF8"):
+                pass
+
 
 def post_venv_setup() -> None:
     """
Signature · 1 line
2.51.1
author
#8 lore raw

PATCH 5/22 python/mkvenv: bump 'qemu.qmp' dependency for testdeps

In reply to John Snow

First up, use the newest v0.0.5 instead of the older v0.0.3.

Secondly, the use of a period in the key name does not behave as expected when installing and checking for dependencies, so quote this string instead.

---
 pythondeps.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pythondeps.toml +1 -1
index 98e99e79005..1657953ff65 100644
@@ -32,5 +32,5 @@ sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
 sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
 [testdeps]
-qemu.qmp = { accepted = ">=0.0.3", installed = "0.0.3" }
+"qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
 pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
Signature · 1 line
2.51.1
author
#11 lore raw

PATCH 6/22 python/mkvenv: rename 'testdeps' to 'functests'

In reply to John Snow

pygdbmi is only needed for functional tests and not tests in general; to prepare for more universally required test dependencies, rename this dependency group "functests" instead.

In other words: we promise that "make check" will run offline in an isolated environment, but we do not make the same promises for functional tests, which require an internet connection.

---
 pythondeps.toml        | 2 +-
 tests/Makefile.include | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
pythondeps.toml +1 -1
index 1657953ff65..d814bb54d08 100644
@@ -31,6 +31,6 @@ meson = { accepted = ">=1.9.0", installed = "1.9.0", canary = "meson" }
 sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
 sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
-[testdeps]
+[functests]
 "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
 pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
tests/Makefile.include +1 -1
index d4dfbf3716d..6f86eb283d3 100644
@@ -98,7 +98,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
 
 $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
 	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-	$(MKVENV_ENSUREGROUP) $< testdeps
+	$(MKVENV_ENSUREGROUP) $< functests
 	$(call quiet-command, touch $@)
 
 check-venv: $(TESTS_VENV_TOKEN)
Signature · 1 line
2.51.1
author
#29 lore raw

PATCH 15/22 mtest2make: do not repeat the same speed over and over

In reply to John Snow

From: Paolo Bonzini <[email protected]>

There are just three of them, avoid repeating them for as many times as there are tests.

---
 scripts/mtest2make.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/mtest2make.py +3 -3
index d32eef2f7f4..2b706f94234 100644
@@ -14,7 +14,7 @@
 class Suite(object):
     def __init__(self):
         self.deps = set()
-        self.speeds = ['quick']
+        self.speeds = {'quick'}
 
     def names(self, base):
         return [base if speed == 'quick' else f'{base}-{speed}' for speed in self.speeds]
@@ -62,10 +62,10 @@ def process_tests(test, targets, suites):
         suites[s].deps.update(deps)
         if s.endswith('-slow'):
             s = s[:-5]
-            suites[s].speeds.append('slow')
+            suites[s].speeds.add('slow')
         if s.endswith('-thorough'):
             s = s[:-9]
-            suites[s].speeds.append('thorough')
+            suites[s].speeds.add('thorough')
 
 def emit_prolog(suites, prefix):
     all_targets = ' '.join((f'{prefix}-{k}' for k in suites.keys()))
Signature · 1 line
2.51.1
author
#22 lore raw

PATCH 11/22 python: add vendored qemu.qmp package

In reply to John Snow

In anticipation of deleting the python/qemu/qmp source from the tree, add a vendored version of the qemu.qmp package to ensure that "make check" can be run in isolated build environments, offline.

---
 python/scripts/vendor.py                      |   2 ++
 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl | Bin 0 -> 72263 bytes
 2 files changed, 2 insertions(+)
 create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl
python/scripts/vendor.py +2 -0
index 33ac7a45de0..36cd27046e7 100755
@@ -43,6 +43,8 @@ def main() -> int:
     packages = {
         "meson==1.9.0":
         "45e51ddc41e37d961582d06e78c48e0f9039011587f3495c4d6b0781dad92357",
+        "qemu.qmp==0.0.5":
+        "e05782d6df5844b34e0d2f7c68693525da074deef7b641c1401dda6e4e3d6303",
     }
 
     vendor_dir = Path(__file__, "..", "..", "wheels").resolve()
python/wheels/qemu_qmp-0.0.5-py3-none-any.whl new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..6372b7544ffb015a5c77d9686e921b65c848d433
GIT binary patch
Signature · 1 line
2.51.1
author
#17 lore raw

PATCH 9/22 tests/iotests: Use configured python to run GitLab iotests

In reply to John Snow

use the python (and the pyvenv) to run iotests instead of the system default python3 interpreter.

---
 .gitlab-ci.d/buildtest.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +2 -2
index 44df116139b..c3a9e8428c2 100644
@@ -351,10 +351,10 @@ build-tcg-disabled:
     - make check-unit
     - make check-qapi-schema
     - cd tests/qemu-iotests/
-    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
+    - ../../pyvenv/bin/python3 ./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
-    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
+    - ../../pyvenv/bin/python3 ./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
Signature · 1 line
2.51.1
author
#26 lore raw

PATCH 13/22 mtest2make: cleanup mtest-suites variables

In reply to John Snow

From: Paolo Bonzini <[email protected]>

Remove the "--suite" argument from the .*.mtest-suites variables, and add it only when actually computing the arguments to "meson test". This makes it possible to look at the set of suites to set ninja-cmd-goals, instead of doing it via many different .ninja-goals.* variables.

As a bonus, this removes code duplication between emit_suite_deps and its caller emit_suite. Since emit_suite_deps would now be one or two lines of code, integrate it into emit_suite directly.

---
 Makefile              |  4 +++-
 scripts/mtest2make.py | 33 +++++++++++++--------------------
 2 files changed, 16 insertions(+), 21 deletions(-)
Makefile +3 -1
index 74c2da20372..9fb55dcf330 100644
@@ -96,6 +96,8 @@ meson.stamp: config-host.mak
 
 # 3. ensure meson-generated build files are up-to-date
 
+ninja-cmd-goals =
+
 ifneq ($(NINJA),)
 Makefile.ninja: build.ninja
 	$(quiet-@){ \
@@ -150,7 +152,7 @@ NINJAFLAGS = \
           $(or $(filter -l% -j%, $(MAKEFLAGS)), \
                $(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1))) \
         -d keepdepfile
-ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
+ninja-cmd-goals += $(or $(MAKECMDGOALS), all)
 ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
 
 makefile-targets := build.ninja ctags TAGS cscope dist clean
scripts/mtest2make.py +13 -20
index 2ef375fc6fb..af4ee56de54 100644
@@ -20,12 +20,12 @@ def names(self, base):
         return [base if speed == 'quick' else f'{base}-{speed}' for speed in self.speeds]
 
 
-print('''
+print(r'''
 SPEED = quick
 
-.speed.quick = $(foreach s,$(sort $(filter-out %-slow %-thorough, $1)), --suite $s)
-.speed.slow = $(foreach s,$(sort $(filter-out %-thorough, $1)), --suite $s)
-.speed.thorough = $(foreach s,$(sort $1), --suite $s)
+.speed.quick = $(sort $(filter-out %-slow %-thorough, $1))
+.speed.slow = $(sort $(filter-out %-thorough, $1))
+.speed.thorough = $(sort $1)
 
 TIMEOUT_MULTIPLIER ?= 1
 .mtestargs = --no-rebuild -t $(TIMEOUT_MULTIPLIER)
@@ -34,8 +34,10 @@ def names(self, base):
 endif
 .mtestargs += $(subst -j,--num-processes , $(filter-out -j, $(lastword -j1 $(filter -j%, $(MAKEFLAGS)))))
 
-.check.mtestargs = $(MTESTARGS) $(.mtestargs) $(if $(V),--verbose,--print-errorlogs)
-.bench.mtestargs = $(MTESTARGS) $(.mtestargs) --benchmark --verbose''')
+.check.mtestargs = $(MTESTARGS) $(.mtestargs) $(if $(V),--verbose,--print-errorlogs) \
+    $(foreach s, $(sort $(.check.mtest-suites)), --suite $s)
+.bench.mtestargs = $(MTESTARGS) $(.mtestargs) --benchmark --verbose \
+    $(foreach s, $(sort $(.bench.mtest-suites)), --suite $s)''')
 
 introspect = json.load(sys.stdin)
 
@@ -72,29 +74,20 @@ def emit_prolog(suites, prefix):
     print(f'all-{prefix}-targets = {all_targets}')
     print(f'all-{prefix}-xml = {all_xml}')
     print(f'.PHONY: {prefix} do-meson-{prefix} {prefix}-report.junit.xml $(all-{prefix}-targets) $(all-{prefix}-xml)')
-    print(f'ifeq ($(filter {prefix}, $(MAKECMDGOALS)),)')
-    print(f'.{prefix}.mtestargs += $(call .speed.$(SPEED), $(.{prefix}.mtest-suites))')
-    print(f'endif')
+    print(f'ninja-cmd-goals += $(foreach s, $(.{prefix}.mtest-suites), $(.{prefix}-$s.deps))')
     print(f'{prefix}-build: run-ninja')
     print(f'{prefix} $(all-{prefix}-targets): do-meson-{prefix}')
     print(f'do-meson-{prefix}: run-ninja; $(if $(MAKE.n),,+)$(MESON) test $(.{prefix}.mtestargs)')
     print(f'{prefix}-report.junit.xml $(all-{prefix}-xml): {prefix}-report%.junit.xml: run-ninja')
     print(f'\t$(MAKE) {prefix}$* MTESTARGS="$(MTESTARGS) --logbase {prefix}-report$*" && ln -f meson-logs/$@ .')
 
-def emit_suite_deps(name, suite, prefix):
+def emit_suite(name, suite, prefix):
     deps = ' '.join(suite.deps)
-    targets = [f'{prefix}-{name}', f'{prefix}-report-{name}.junit.xml', f'{prefix}', f'{prefix}-report.junit.xml',
-               f'{prefix}-build']
-    print()
+    targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml {prefix} {prefix}-report.junit.xml {prefix}-build'
+    names = ' '.join(suite.names(name))
     print(f'.{prefix}-{name}.deps = {deps}')
-    for t in targets:
-        print(f'.ninja-goals.{t} += $(.{prefix}-{name}.deps)')
-
-def emit_suite(name, suite, prefix):
-    emit_suite_deps(name, suite, prefix)
-    targets = f'{prefix}-{name} {prefix}-report-{name}.junit.xml {prefix} {prefix}-report.junit.xml'
     print(f'ifneq ($(filter {targets}, $(MAKECMDGOALS)),)')
-    print(f'.{prefix}.mtest-suites += ' + ' '.join(suite.names(name)))
+    print(f".{prefix}.mtest-suites += $(call .speed.$(SPEED), {names})")
     print(f'endif')
 
 targets = {t['id']: [os.path.relpath(f) for f in t['filename']]
Signature · 1 line
2.51.1
author
#28 lore raw

PATCH 14/22 mtest2make: add dependencies to the "speed-qualified" suite

In reply to John Snow

From: Paolo Bonzini <[email protected]>

Thorough tests may have more dependencies than faster ones. Dependencies are now looked up based on the suites being executed, not on the suites passed as goals to the makefile. Therefore, it is possible to limit dependencies to the speeds that need them.

---
 scripts/mtest2make.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/mtest2make.py +1 -1
index af4ee56de54..d32eef2f7f4 100644
@@ -59,13 +59,13 @@ def process_tests(test, targets, suites):
             s = s.split(':')[1]
             if s == 'slow' or s == 'thorough':
                 continue
+        suites[s].deps.update(deps)
         if s.endswith('-slow'):
             s = s[:-5]
             suites[s].speeds.append('slow')
         if s.endswith('-thorough'):
             s = s[:-9]
             suites[s].speeds.append('thorough')
-        suites[s].deps.update(deps)
 
 def emit_prolog(suites, prefix):
     all_targets = ' '.join((f'{prefix}-{k}' for k in suites.keys()))
Signature · 1 line
2.51.1
author
#30 lore raw

PATCH 16/22 meson, mkvenv: make functional tests depend on functests group

In reply to John Snow

Despite my efforts here, "make check" actually still wants to install the functests group even though it should only be applying to the "thorough" category. I'm not quite sure how to debug this just yet...

---
 tests/functional/meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/functional/meson.build +6 -1
index 725630d3082..b8424a10376 100644
@@ -57,16 +57,20 @@ foreach speed : ['quick', 'thorough']
       continue
     endif
 
+    test_deps = [roms, keymap_targets]
+
     if speed == 'quick'
       suites = ['func-quick', 'func-' + target_base]
       target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
                      + get_variable('tests_generic_' + sysmode)
+      test_deps += [pyvenv_checktests_group]
     else
       suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
       target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
+      test_deps += [pyvenv_functests_group]
     endif
 
-    test_deps = [roms, keymap_targets]
+
     test_env = environment()
     if have_tools
       test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
@@ -99,6 +103,7 @@ foreach speed : ['quick', 'thorough']
       precache = custom_target('func-precache-' + testname,
                                output: teststamp,
                                command: [python, testpath],
+                               depends: pyvenv_functests_group,
                                depend_files: files(testpath),
                                build_by_default: false,
                                env: test_precache_env)
Signature · 1 line
2.51.1
author
#40 lore raw

PATCH 20/22 meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml

In reply to John Snow

Add the local python package group into pythondeps.toml for the checktests group.

---
 pythondeps.toml | 1 +
 1 file changed, 1 insertion(+)
pythondeps.toml +1 -0
index b931d8bb578..d39a68e106e 100644
@@ -33,6 +33,7 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
 [checktests]
 "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
+"$SRCROOT/python/" = { }
 
 [functests]
 pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
Signature · 1 line
2.51.1
author
#39 lore raw

PATCH 19/22 mkvenv: add --no-build-isolation flag

In reply to John Snow

WIP. This is needed to process local installs for newer versions of pip/setuptools. There may be other options. Investigating.

---
 python/scripts/mkvenv.py | 1 +
 1 file changed, 1 insertion(+)
python/scripts/mkvenv.py +1 -0
index e38292b63a6..9cf7a6e2b2a 100644
@@ -677,6 +677,7 @@ def pip_install(
         "-m",
         "pip",
         "install",
+        "--no-build-isolation",
         "--disable-pip-version-check",
         "-v" if loud else "-q",
     ]
Signature · 1 line
2.51.1
author
#38 lore raw

PATCH 18/22 python/mkvenv: add mechanism to install local package(s)

In reply to John Snow

Currently, we "implicitly" install the local 'qemu' python package for 'make check-venv' with some logic inside tests/Makefile.include. I would like to make this installation explicit in pythondeps.toml instead.

The version constraint specification that Python specifies does not support relative paths, so it is difficult (or impossible?) to specify a path within the source tree, and we will need a workaround to do so.

By specifying a package name that starts with $SRCROOT, you can now specify a file path to a local package for installation. This is done to allow us to install the python packages hosted inside of the tree while also processing dependencies; i.e. so that our "qemu" package can specify that it needs "qemu.qmp", which soon will not be included in qemu.git.

---
 python/scripts/mkvenv.py | 4 ++++
 1 file changed, 4 insertions(+)
python/scripts/mkvenv.py +4 -0
index a22e3ee3394..e38292b63a6 100644
@@ -736,6 +736,10 @@ def _do_ensure(
     present = []
     canary = None
     for name, info in group.items():
+        if name.startswith("$SRCROOT/"):
+            srcroot = Path(__file__).parents[2]
+            absent.append(name.replace("$SRCROOT/", f"file:///{srcroot}/"))
+            continue
         constraint = _make_version_constraint(info, False)
         matcher = Matcher(name + constraint)
         print(f"mkvenv: checking for {matcher}", file=sys.stderr)
Signature · 1 line
2.51.1
author
#41 lore raw

PATCH 21/22 tests/Makefile: replace old "check-venv" target with meson target

In reply to John Snow

Note that this patch actually changes the meaning of check-venv slightly to how it has been operating in the past: this target now only installs the necessary patches to run "make check" and will no longer pull in dependencies for functional tests.

This winds up being safe to do because the meson dependencies will handle this satisfactorily; the target here could even be removed, but it's still useful as a manual invocation prior to running tests from outside the meson test runner system.

---
 tests/Makefile.include | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)
tests/Makefile.include +6 -19
index 40b114bd158..237d410ad83 100644
@@ -83,33 +83,16 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 .PHONY: distclean-tcg
 distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
 
-# Python venv for running tests
-
-.PHONY: check-venv
-
 # Build up our target list from the filtered list of ninja targets
 TARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets)))
 
-TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group
-
-quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
-    $(PYTHON) -m pip -q --disable-pip-version-check $1, \
-    "VENVPIP","$1")
-
-$(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
-	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-	$(MKVENV_ENSUREGROUP) $< checktests functests
-	$(call quiet-command, touch $@)
-
-check-venv: $(TESTS_VENV_TOKEN)
-
 FUNCTIONAL_TARGETS=$(patsubst %-softmmu,check-functional-%, $(filter %-softmmu,$(TARGETS)))
 .PHONY: $(FUNCTIONAL_TARGETS)
-$(FUNCTIONAL_TARGETS): check-venv
+$(FUNCTIONAL_TARGETS):
 	@$(MAKE) SPEED=thorough $(subst -functional,-func,$@)
 
 .PHONY: check-functional
-check-functional: check-venv
+check-functional:
 	@$(NINJA) precache-functional
 	@$(PYTHON) $(SRC_PATH)/scripts/clean_functional_cache.py
 	@QEMU_TEST_NO_DOWNLOAD=1 $(MAKE) SPEED=thorough check-func check-func-quick
@@ -117,6 +100,10 @@ check-functional: check-venv
 .PHONY: check-func check-func-quick
 check-func check-func-quick:
 
+.PHONY: check-venv
+check-venv:
+	@$(NINJA) pyvenv/checktests.group
+
 # Consolidated targets
 
 .PHONY: check check-clean
Signature · 1 line
2.51.1
author
#25 lore raw

PATCH 12/22 meson, mkvenv: make iotests depend on checktests group

In reply to John Snow
---
 tests/qemu-iotests/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/meson.build +1 -1
index d7bae71ced6..86a3541c0ae 100644
@@ -57,7 +57,7 @@ foreach format, speed: qemu_iotests_formats
       test('io-' + format + '-' + item,
            python,
            args: args,
-           depends: qemu_iotests_binaries,
+           depends: qemu_iotests_binaries + pyvenv_checktests_group,
            env: qemu_iotests_env,
            protocol: 'tap',
            timeout: 180,
Signature · 1 line
2.51.1
author
#31 lore raw

PATCH 17/22 tests: forcibly run 'make check-venv' for crash tests

In reply to John Snow

In order to convert the existing Makefile target from a manual invocation of mkvenv to one that uses the meson dependency system, we need to not suppress ninja here.

I'm not sure if this creates problems I am not aware of; but invoking ninja here is no longer spurious but will become necessary.

---
 .gitlab-ci.d/buildtest.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +2 -2
index 18d72d3058b..2cb2cf25b4a 100644
@@ -101,7 +101,7 @@ crash-test-debian:
     IMAGE: debian
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386
 
 build-system-fedora:
@@ -158,7 +158,7 @@ crash-test-fedora:
     IMAGE: fedora
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
     - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32
 
Signature · 1 line
2.51.1
author
#42 lore raw

PATCH 22/22 python: delete qemu.qmp

In reply to John Snow

Begin relying on the external python-qemu-qmp dependency instead, to prevent desync between the internal and external libraries.

---
 python/qemu/qmp/__init__.py   |   60 --
 python/qemu/qmp/error.py      |   53 --
 python/qemu/qmp/events.py     |  751 ----------------------
 python/qemu/qmp/legacy.py     |  339 ----------
 python/qemu/qmp/message.py    |  217 -------
 python/qemu/qmp/models.py     |  146 -----
 python/qemu/qmp/protocol.py   | 1101 ---------------------------------
 python/qemu/qmp/py.typed      |    0
 python/qemu/qmp/qmp_client.py |  732 ----------------------
 python/qemu/qmp/qmp_shell.py  |  689 ---------------------
 python/qemu/qmp/qmp_tui.py    |  665 --------------------
 python/qemu/qmp/util.py       |  150 -----
 python/qemu/utils/qom_fuse.py |    1 -
 python/setup.cfg              |   31 +-
 python/tests/minreqs.txt      |    8 +-
 python/tests/protocol.py      |  596 ------------------
 16 files changed, 6 insertions(+), 5533 deletions(-)
 delete mode 100644 python/qemu/qmp/__init__.py
 delete mode 100644 python/qemu/qmp/error.py
 delete mode 100644 python/qemu/qmp/events.py
 delete mode 100644 python/qemu/qmp/legacy.py
 delete mode 100644 python/qemu/qmp/message.py
 delete mode 100644 python/qemu/qmp/models.py
 delete mode 100644 python/qemu/qmp/protocol.py
 delete mode 100644 python/qemu/qmp/py.typed
 delete mode 100644 python/qemu/qmp/qmp_client.py
 delete mode 100644 python/qemu/qmp/qmp_shell.py
 delete mode 100644 python/qemu/qmp/qmp_tui.py
 delete mode 100644 python/qemu/qmp/util.py
 delete mode 100644 python/tests/protocol.py
python/qemu/qmp/__init__.py deleted +0 -60
deleted file mode 100644
index 058139dc3ca..00000000000
@@ -1,60 +0,0 @@
-"""
-QEMU Monitor Protocol (QMP) development library & tooling.
-
-This package provides a fairly low-level class for communicating
-asynchronously with QMP protocol servers, as implemented by QEMU, the
-QEMU Guest Agent, and the QEMU Storage Daemon.
-
-`QMPClient` provides the main functionality of this package. All errors
-raised by this library derive from `QMPError`, see `qmp.error` for
-additional detail. See `qmp.events` for an in-depth tutorial on
-managing QMP events.
-"""
-
-# Copyright (C) 2020-2022 John Snow for Red Hat, Inc.
-#
-# Authors:
-#  John Snow <[email protected]>
-#
-# Based on earlier work by Luiz Capitulino <[email protected]>.
-#
-# This work is licensed under the terms of the GNU LGPL, version 2 or
-# later. See the COPYING file in the top-level directory.
-
-import logging
-
-from .error import QMPError
-from .events import EventListener
-from .message import Message
-from .protocol import (
-    ConnectError,
-    Runstate,
-    SocketAddrT,
-    StateError,
-)
-from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient
-
-
-# Suppress logging unless an application engages it.
-logging.getLogger('qemu.qmp').addHandler(logging.NullHandler())
-
-
-# IMPORTANT: When modifying this list, update the Sphinx overview docs.
-# Anything visible in the qemu.qmp namespace should be on the overview page.
-__all__ = (
-    # Classes, most to least important
-    'QMPClient',
-    'Message',
-    'EventListener',
-    'Runstate',
-
-    # Exceptions, most generic to most explicit
-    'QMPError',
-    'StateError',
-    'ConnectError',
-    'ExecuteError',
-    'ExecInterruptedError',
-
-    # Type aliases
-    'SocketAddrT',
-)
python/qemu/qmp/error.py deleted +0 -53

53 lines not on this page · raw message

python/qemu/qmp/events.py deleted +0 -751

751 lines not on this page · raw message

python/qemu/qmp/legacy.py deleted +0 -339

339 lines not on this page · raw message

python/qemu/qmp/message.py deleted +0 -217

217 lines not on this page · raw message

python/qemu/qmp/models.py deleted +0 -146

146 lines not on this page · raw message

python/qemu/qmp/protocol.py deleted +0 -1101

1,101 lines not on this page · raw message

python/qemu/qmp/py.typed deleted +0 -0
deleted file mode 100644
index e69de29bb2d..00000000000
python/qemu/qmp/qmp_client.py deleted +0 -732

333 lines not on this page · raw message

python/qemu/qmp/qmp_shell.py deleted +0 -689

689 lines not on this page · raw message

python/qemu/qmp/qmp_tui.py deleted +0 -665

665 lines not on this page · raw message

python/qemu/qmp/util.py deleted +0 -150

150 lines not on this page · raw message

python/qemu/utils/qom_fuse.py +0 -1
index cf7e344bd53..e377ef6942f 100644

Lines of this file are not shown. View the raw message.

python/setup.cfg +3 -28
index f40f11396c9..c46a95f8d41 100644

Lines of this file are not shown. View the raw message.

python/tests/minreqs.txt +3 -5
index cd2e2a81c3d..855b5129c94 100644

Lines of this file are not shown. View the raw message.

python/tests/protocol.py deleted +0 -596

596 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.51.1

Part of the diff is not shown here. View the raw message.

#32 lore raw

Re: [PATCH 17/22] tests: forcibly run 'make check-venv' for crash tests

In reply to John Snow
Quoted 6 lines · John Snow

In order to convert the existing Makefile target from a manual invocation of mkvenv to one that uses the meson dependency system, we need to not suppress ninja here.

I'm not sure if this creates problems I am not aware of; but invoking ninja here is no longer spurious but will become necessary.

Yes, this will likely create problems. From the commit message that introduced NINJA=":"...

commit 4d3bd91b26a69b39a178744d3d6e5f23050afb23
Author: Thomas Huth <[email protected]>
Date: Mon Apr 24 10:22:35 2023 +0100

gitlab-ci: Avoid to re-run "configure" in the device-crash-test jobs

After "make check-venv" had been added to these jobs, they started to re-run "configure" each time since our logic in the makefile thinks that some files are out of date here. Avoid it with the same trick that we are using in buildtest-template.yml already by disabling the up-to-date check via NINJA=":".

Quoted 31 lines
---
 .gitlab-ci.d/buildtest.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +2 -2
index 18d72d3058b..2cb2cf25b4a 100644
@@ -101,7 +101,7 @@ crash-test-debian:
     IMAGE: debian
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386
 
 build-system-fedora:
@@ -158,7 +158,7 @@ crash-test-fedora:
     IMAGE: fedora
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
     - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32
 
Signature · 1 line
2.51.1

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#33 lore raw

Re: [PATCH 17/22] tests: forcibly run 'make check-venv' for crash tests

Il lun 17 nov 2025, 20:07 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 8 lines · John Snow
Quoted 6 lines

In order to convert the existing Makefile target from a manual invocation of mkvenv to one that uses the meson dependency system, we need to not suppress ninja here.

I'm not sure if this creates problems I am not aware of; but invoking ninja here is no longer spurious but will become necessary.

Quoted 7 lines

Yes, this will likely create problems. From the commit message that introduced NINJA=":"...

Avoid it with the same
trick that we are using in buildtest-template.yml already by disabling the up-to-date check via NINJA=":".

Move the check-venv call to buildtest-template.yml, right after configure? It's cheap enough.

Paolo

Quoted 46 lines
Quoted 12 lines
---
 .gitlab-ci.d/buildtest.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +0 -0
index 18d72d3058b..2cb2cf25b4a 100644

.gitlab-ci.d/buildtest.yml crash-test-debian: · line 105

Quoted 6 lines
.gitlab-ci.d/buildtest.yml +1 -1
@@ -101,7 +101,7 @@ crash-test-debian:
     IMAGE: debian
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only

./qemu-system-i386

.gitlab-ci.d/buildtest.yml crash-test-fedora: · line 163

Quoted 10 lines
.gitlab-ci.d/buildtest.yml +1 -1
 build-system-fedora:
@@ -158,7 +158,7 @@ crash-test-fedora:
     IMAGE: fedora
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
     - pyvenv/bin/python3 scripts/device-crash-test -q

./qemu-system-riscv32

Quoted 4 lines
.gitlab-ci.d/buildtest.yml +0 -1
--

2.51.1

With regards,
Daniel
--
|: https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-
https://fstop138.berrange.com :|
|: https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|

Reviewed-by on v1 9/22
#18 lore raw

Re: [PATCH 09/22] tests/iotests: Use configured python to run GitLab iotests

In reply to John Snow
Quoted 15 lines · John Snow

use the python (and the pyvenv) to run iotests instead of the system default python3 interpreter.

---
  .gitlab-ci.d/buildtest.yml | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +0 -0
index 44df116139b..c3a9e8428c2 100644
@@ -351,10 +351,10 @@ build-tcg-disabled:
      - make check-unit
      - make check-qapi-schema

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

Quoted 10 lines
.gitlab-ci.d/buildtest.yml +2 -2
      - cd tests/qemu-iotests/
-    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
+    - ../../pyvenv/bin/python3 ./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
-    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
+    - ../../pyvenv/bin/python3 ./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
Reviewed-by on v1 1/22
#2 lore raw

Re: [PATCH 01/22] python/mkvenv: ensure HAVE_LIB variables are actually constants

In reply to John Snow
Quoted 9 lines · John Snow

Pylint 4.x has refined checking for variable names that behave as constants vs ones that do not; unfortunately our tricky import machinery is perceived as these variables being re-assigned.

Add a temporary variable with an underscore and assign to the global constants precisely once to alleviate this new nag message. Add an ignore for this name for older versions of pylint that developers may have installed locally.

Quoted 8 lines

(In other words: there is no solution that will cater to both pre- and post- 4.x versions, so we target 4.x here and silence older versions.)

---
  python/scripts/mkvenv.py | 24 ++++++++++++++++--------
  python/setup.cfg         |  1 +
  2 files changed, 17 insertions(+), 8 deletions(-)
Reviewed-by on v1 2/22
#4 lore raw

Re: [PATCH 02/22] python/qapi: add an ignore for Pylint 4.x

In reply to John Snow
Quoted 13 lines · John Snow

Pylint 4.x wants to use a different regex for _Stub for some reason; just silence this.

---
  scripts/qapi/introspect.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi/introspect.py +0 -0
index 89ee5d5f176..7e28de2279a 100644

scripts/qapi/introspect.py line 65

Quoted 8 lines
scripts/qapi/introspect.py +1 -1
@@ -59,7 +59,7 @@
  #
  # Sadly, mypy does not support recursive types; so the _Stub alias is used to
  # mark the imprecision in the type model where we'd otherwise use JSONValue.
-_Stub = Any
+_Stub = Any  # pylint: disable=invalid-name
  _Scalar = Union[str, bool, None]
  _NonScalar = Union[Dict[str, _Stub], List[_Stub]]
  _Value = Union[_Scalar, _NonScalar]
Reviewed-by on v1 3/22
#6 lore raw

Re: [PATCH 03/22] python/qapi: delint import statements

In reply to John Snow
Quoted 20 lines · John Snow

Missed a spot with isort, which now causes the python-minreqs test on GitLab to fail. Fix it.

(Hint: the commands in python/tests/qapi-isort.sh can be run without the "-c" parameter to automatically adjust import statements according to our style rules. Maybe I should make a pre-submit hook that makes this adjustment automatically. What do you think?)

Fixes 5bd89761
---
  scripts/qapi/commands.py | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
scripts/qapi/commands.py +0 -0
index a82b5a2a5e6..9dede747205 100644
@@ -13,10 +13,7 @@
  See the COPYING file in the top-level directory.

scripts/qapi/commands.py line 19

Quoted 10 lines
scripts/qapi/commands.py +1 -4
  """
 
-from typing import (
-    List,
-    Optional,
-)
+from typing import List, Optional
 
  from .common import c_name, mcgen
  from .gen import (
Reviewed-by on v1 10/22
#21 lore raw

Re: [PATCH 10/22] tests/iotests: use "make check-venv" to prepare for running iotests

In reply to John Snow
Quoted 15 lines · John Snow

Soon, qemu.qmp will not be included in the qemu.git tree and so invoking the meson target for preparing the "checktests" mkvenv group will be necessary for this test to run successfully. Doing it now in its own patch separates this change from the big switcheroo patch.

---
  .gitlab-ci.d/buildtest.yml | 1 +
  1 file changed, 1 insertion(+)
.gitlab-ci.d/buildtest.yml +0 -0
index c3a9e8428c2..18d72d3058b 100644

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

Quoted 7 lines
.gitlab-ci.d/buildtest.yml +1 -0
@@ -350,6 +350,7 @@ build-tcg-disabled:
      - make -j"$JOBS"
      - make check-unit
      - make check-qapi-schema
+    - make check-venv
      - cd tests/qemu-iotests/
      - ../../pyvenv/bin/python3 ./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
Reviewed-by on v1 6/22
#12 lore raw

Re: [PATCH 06/22] python/mkvenv: rename 'testdeps' to 'functests'

In reply to John Snow
Quoted 31 lines · John Snow

pygdbmi is only needed for functional tests and not tests in general; to prepare for more universally required test dependencies, rename this dependency group "functests" instead.

In other words: we promise that "make check" will run offline in an isolated environment, but we do not make the same promises for functional tests, which require an internet connection.

---
  pythondeps.toml        | 2 +-
  tests/Makefile.include | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
pythondeps.toml +1 -1
index 1657953ff65..d814bb54d08 100644
@@ -31,6 +31,6 @@ meson = { accepted = ">=1.9.0", installed = "1.9.0", canary = "meson" }
  sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
  sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
-[testdeps]
+[functests]
  "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
  pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
tests/Makefile.include +0 -0
index d4dfbf3716d..6f86eb283d3 100644

tests/Makefile.include quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ · line 104

Quoted 8 lines
tests/Makefile.include +1 -1
@@ -98,7 +98,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
 
  $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
  	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-	$(MKVENV_ENSUREGROUP) $< testdeps
+	$(MKVENV_ENSUREGROUP) $< functests
  	$(call quiet-command, touch $@)
 
  check-venv: $(TESTS_VENV_TOKEN)

I'd maybe merge this with the next patch. Anyway:

Reviewed-by on v1 7/22
#15 lore raw

Re: [PATCH 07/22] python/mkvenv: add "checktests" dependency group

In reply to John Snow
Quoted 34 lines · John Snow

This group is intended for packages required to run "make check" successfully. Once qemu.qmp is fully divorced from the source tree, this will primarily mean the qemu.qmp package and the remaining in-tree python packages. It specifically excludes packages only needed to run the functional tests, which are not invoked by default for "make check".

Amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them.

---
  pythondeps.toml        | 4 +++-
  tests/Makefile.include | 2 +-
  2 files changed, 4 insertions(+), 2 deletions(-)
pythondeps.toml +3 -1
index d814bb54d08..b931d8bb578 100644
@@ -31,6 +31,8 @@ meson = { accepted = ">=1.9.0", installed = "1.9.0", canary = "meson" }
  sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
  sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
-[functests]
+[checktests]
  "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
+
+[functests]
  pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
tests/Makefile.include +0 -0
index 6f86eb283d3..40b114bd158 100644

tests/Makefile.include quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ · line 104

Quoted 8 lines
tests/Makefile.include +1 -1
@@ -98,7 +98,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
 
  $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
  	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-	$(MKVENV_ENSUREGROUP) $< functests
+	$(MKVENV_ENSUREGROUP) $< checktests functests
  	$(call quiet-command, touch $@)
 
  check-venv: $(TESTS_VENV_TOKEN)
author
#19 lore raw

Re: [PATCH 09/22] tests/iotests: Use configured python to run GitLab iotests

In reply to John Snow
Quoted 1 line · John Snow

use the

^configured

python (and the pyvenv) to run iotests instead of the system

Quoted 33 lines

default python3 interpreter.

---
 .gitlab-ci.d/buildtest.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +0 -1
index 44df116139b..c3a9e8428c2 100644
@@ -351,10 +351,10 @@ build-tcg-disabled:
     - make check-unit
     - make check-qapi-schema
     - cd tests/qemu-iotests/
-    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032

033 048
+ - ../../pyvenv/bin/python3 ./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

- - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102
122
+ - ../../pyvenv/bin/python3 ./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

--
2.51.1

author
#13 lore raw

Re: [PATCH 06/22] python/mkvenv: rename 'testdeps' to 'functests'

In reply to Thomas Huth
Quoted 41 lines · Thomas Huth

pythondeps.toml meson = { accepted = ">=1.9.0", installed = "1.9.0",

Quoted 19 lines · John Snow

pygdbmi is only needed for functional tests and not tests in general; to prepare for more universally required test dependencies, rename this dependency group "functests" instead.

In other words: we promise that "make check" will run offline in an isolated environment, but we do not make the same promises for functional tests, which require an internet connection.

---
  pythondeps.toml        | 2 +-
  tests/Makefile.include | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
pythondeps.toml +0 -0
index 1657953ff65..d814bb54d08 100644
@@ -31,6 +31,6 @@ meson = { accepted = ">=1.9.0", installed = "1.9.0",

canary = "meson" }

pythondeps.toml meson = { accepted = ">=1.9.0", installed = "1.9.0", · line 31

Quoted 1 line
pythondeps.toml +0 -0
  sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary =

"sphinx-build" }

Quoted 18 lines
pythondeps.toml +1 -1
  sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
-[testdeps]
+[functests]
  "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
  pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
tests/Makefile.include +1 -1
index d4dfbf3716d..6f86eb283d3 100644
@@ -98,7 +98,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
 
  $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
      $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-     $(MKVENV_ENSUREGROUP) $< testdeps
+     $(MKVENV_ENSUREGROUP) $< functests
      $(call quiet-command, touch $@)
 
Quoted 4 lines

tests/Makefile.include quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ · line 104

Quoted 1 line
tests/Makefile.include +0 -0
  check-venv: $(TESTS_VENV_TOKEN)

I'd maybe merge this with the next patch. Anyway:

Easy enough, sure!

Quoted 2 lines

Thanks!

author
#34 lore raw

Re: [PATCH 17/22] tests: forcibly run 'make check-venv' for crash tests

In reply to Paolo Bonzini
Quoted 21 lines · Paolo Bonzini

Il lun 17 nov 2025, 20:07 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 8 lines · John Snow
Quoted 6 lines

In order to convert the existing Makefile target from a manual invocation of mkvenv to one that uses the meson dependency system, we need to not suppress ninja here.

I'm not sure if this creates problems I am not aware of; but invoking ninja here is no longer spurious but will become necessary.

Quoted 7 lines

Yes, this will likely create problems. From the commit message that introduced NINJA=":"...

Avoid it with the same
trick that we are using in buildtest-template.yml already by disabling the up-to-date check via NINJA=":".

Quoted 5 lines

Move the check-venv call to buildtest-template.yml, right after configure? It's cheap enough.

Paolo

What's the root issue here? That there's enough of a time delay between the actual configure and the test running that it re-runs configure?

(And presumably this is bad mostly for wasted CI time...?)

Quoted 47 lines
Quoted 47 lines
Quoted 13 lines
---
 .gitlab-ci.d/buildtest.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +0 -0
index 18d72d3058b..2cb2cf25b4a 100644

.gitlab-ci.d/buildtest.yml crash-test-debian: · line 105

Quoted 6 lines
.gitlab-ci.d/buildtest.yml +1 -1
@@ -101,7 +101,7 @@ crash-test-debian:
     IMAGE: debian
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only

./qemu-system-i386

.gitlab-ci.d/buildtest.yml crash-test-fedora: · line 163

Quoted 10 lines
.gitlab-ci.d/buildtest.yml +1 -1
 build-system-fedora:
@@ -158,7 +158,7 @@ crash-test-fedora:
     IMAGE: fedora
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
     - pyvenv/bin/python3 scripts/device-crash-test -q

./qemu-system-riscv32

Quoted 4 lines
.gitlab-ci.d/buildtest.yml +0 -1
--

2.51.1

With regards,
Daniel
--
|: https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-
https://fstop138.berrange.com :|
|: https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|

#35 lore raw

Re: [PATCH 17/22] tests: forcibly run 'make check-venv' for crash tests

Il mar 18 nov 2025, 22:50 John Snow <[email protected]> ha scritto:

Quoted 26 lines · Paolo Bonzini
Quoted 23 lines

Il lun 17 nov 2025, 20:07 Daniel P. Berrangé <[email protected]> ha scritto:

Quoted 16 lines · John Snow
Quoted 6 lines

In order to convert the existing Makefile target from a manual invocation of mkvenv to one that uses the meson dependency system, we need to not suppress ninja here.

I'm not sure if this creates problems I am not aware of; but invoking ninja here is no longer spurious but will become necessary.

Yes, this will likely create problems. From the commit message that introduced NINJA=":"...

Avoid it with the same
trick that we are using in buildtest-template.yml already by
disabling
the up-to-date check via NINJA=":".

Quoted 9 lines
Quoted 5 lines

Move the check-venv call to buildtest-template.yml, right after configure? It's cheap enough.

Paolo

What's the root issue here? That there's enough of a time delay between the actual configure and the test running that it re-runs configure?

That the git repo is cloned again and is therefore newer than the artifacts. That triggers a full rebuild.

Quoted 52 lines

(And presumably this is bad mostly for wasted CI time...?)

Quoted 48 lines
Quoted 48 lines
Quoted 13 lines
---
 .gitlab-ci.d/buildtest.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +0 -0
index 18d72d3058b..2cb2cf25b4a 100644

.gitlab-ci.d/buildtest.yml crash-test-debian: · line 105

Quoted 6 lines
.gitlab-ci.d/buildtest.yml +1 -1
@@ -101,7 +101,7 @@ crash-test-debian:
     IMAGE: debian
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only

./qemu-system-i386

.gitlab-ci.d/buildtest.yml crash-test-fedora: · line 162

Quoted 9 lines
.gitlab-ci.d/buildtest.yml +1 -1
 build-system-fedora:
@@ -158,7 +158,7 @@ crash-test-fedora:
     IMAGE: fedora
   script:
     - cd build
-    - make NINJA=":" check-venv
+    - make check-venv
     - pyvenv/bin/python3 scripts/device-crash-test -q

./qemu-system-ppc

.gitlab-ci.d/buildtest.yml crash-test-fedora: · line 163

Quoted 1 line
.gitlab-ci.d/buildtest.yml +0 -0
     - pyvenv/bin/python3 scripts/device-crash-test -q

./qemu-system-riscv32

Quoted 4 lines
.gitlab-ci.d/buildtest.yml +0 -1
--

2.51.1

With regards,
Daniel
--
|: https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-
https://fstop138.berrange.com :|
|: https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|

#9 lore raw

Re: [PATCH 05/22] python/mkvenv: bump 'qemu.qmp' dependency for testdeps

In reply to John Snow
Quoted 16 lines · John Snow

First up, use the newest v0.0.5 instead of the older v0.0.3.

Secondly, the use of a period in the key name does not behave as expected when installing and checking for dependencies, so quote this string instead.

---
  pythondeps.toml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
pythondeps.toml +0 -0
index 98e99e79005..1657953ff65 100644

pythondeps.toml sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" } · line 35

Quoted 5 lines
pythondeps.toml +1 -1
@@ -32,5 +32,5 @@ sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
  sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
  [testdeps]
-qemu.qmp = { accepted = ">=0.0.3", installed = "0.0.3" }
+"qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }

Question from a still-python-ignorant: Isn't a dot in a python module name a bad idea after all? I mean if at one point in time, the "qemu" module comes to live and also contains a "qmp" submodule, isn't this calling for trouble?

Maybe it would be a good point in time now to start populating https://pypi.org/project/qemu instead?

Thomas

Reviewed-by on v1 22/22
#43 lore raw

Re: [PATCH 22/22] python: delete qemu.qmp

In reply to John Snow
Quoted 5 lines · John Snow

Begin relying on the external python-qemu-qmp dependency instead, to prevent desync between the internal and external libraries.

---

...

python/qemu/utils/qom_fuse.py line 52

Quoted 12 lines
python/qemu/utils/qom_fuse.py +0 -1
index cf7e344bd53..e377ef6942f 100644
@@ -47,7 +47,6 @@
 
  import fuse
  from fuse import FUSE, FuseOSError, Operations
-
  from qemu.qmp import ExecuteError
 
  from .qom_common import QOMCommand

Nit: The above change looks unrelated.

Apart from that:

Acked-by on v1 11/22
#23 lore raw

Re: [PATCH 11/22] python: add vendored qemu.qmp package

In reply to John Snow
Quoted 16 lines · John Snow

In anticipation of deleting the python/qemu/qmp source from the tree, add a vendored version of the qemu.qmp package to ensure that "make check" can be run in isolated build environments, offline.

---
  python/scripts/vendor.py                      |   2 ++
  python/wheels/qemu_qmp-0.0.5-py3-none-any.whl | Bin 0 -> 72263 bytes
  2 files changed, 2 insertions(+)

create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl

python/scripts/vendor.py +0 -0
index 33ac7a45de0..36cd27046e7 100755

python/scripts/vendor.py def main() -> int: · line 48

Quoted 6 lines
python/scripts/vendor.py +2 -0
@@ -43,6 +43,8 @@ def main() -> int:
      packages = {
          "meson==1.9.0":
          "45e51ddc41e37d961582d06e78c48e0f9039011587f3495c4d6b0781dad92357",
+        "qemu.qmp==0.0.5":
+        "e05782d6df5844b34e0d2f7c68693525da074deef7b641c1401dda6e4e3d6303",
      }

I wonder why I did not have to add pycotap here when I added a wheel for that...?

Anyway, for your patch, FWIW:

#36 lore raw

Re: [PATCH 17/22] tests: forcibly run 'make check-venv' for crash tests

In reply to Paolo Bonzini
Quoted 36 lines · Paolo Bonzini

Il mar 18 nov 2025, 22:50 John Snow <[email protected] <mailto:[email protected]>> ha scritto:

On Mon, Nov 17, 2025, 3:47 PM Paolo Bonzini <[email protected] <mailto:[email protected]>> wrote:

Il lun 17 nov 2025, 20:07 Daniel P. Berrangé <[email protected] <mailto:[email protected]>> ha scritto:

On Mon, Nov 17, 2025 at 01:51:25PM -0500, John Snow wrote:
> In order to convert the existing Makefile target from a manual > invocation of mkvenv to one that uses the meson dependency
system, we
> need to not suppress ninja here.
>
> I'm not sure if this creates problems I am not aware of; but
invoking
> ninja here is no longer spurious but will become necessary.

Yes, this will likely create problems. From the commit message that introduced NINJA=":"...

 Avoid it with the same
    trick that we are using in buildtest-template.yml already
by disabling
    the up-to-date check via NINJA=":".

Move the check-venv call to buildtest-template.yml, right after configure? It's cheap enough.

Quoted 8 lines

Paolo

What's the root issue here? That there's enough of a time delay between the actual configure and the test running that it re-runs configure?

That the git repo is cloned again and is therefore newer than the artifacts. That triggers a full rebuild.

Right. At least for the other "functional" and "check-system" jobs in our CI, this was a big issue, calling "make check-functional/qtest/iotest" there triggered a rebuild of all binaries, increasing our CI runtime significantly.

For the "crash test" jobs, it was mainly about avoiding to rerun the "configure" step for cosmetical reasons each time the job runs. The rebuild of the qemu binaries is triggered by "make check-iotests/qtests/function" in the other jobs, and not by "make check-venv" alone, so it's not as bad as in the other jobs here:
Without your patch, the jobs take about 16 minutes (crash-test-debian) and 10 minutes (crash-test-fedora):

https://gitlab.com/thuth/qemu/-/jobs/12138792667
https://gitlab.com/thuth/qemu/-/jobs/12138792674

With your patch applied:

https://gitlab.com/thuth/qemu/-/jobs/12139438583
https://gitlab.com/thuth/qemu/-/jobs/12139438599

the jobs take approx. the same amount of time, so I think it's OK here to drop the NINJA=":" again.

But I think we should give Paolo's idea a try and move the "make check-venv" to buildtest-template.yml instead. In fact, that might even help to slightly decrease the total runtime of the jobs since all the other "check" jobs don't have to do this again (for example the check-functional jobs are running it, too, see: https://gitlab.com/qemu-project/qemu/-/jobs/12139584312#L1051).

Thomas

author
#10 lore raw

Re: [PATCH 05/22] python/mkvenv: bump 'qemu.qmp' dependency for testdeps

In reply to Thomas Huth
Quoted 20 lines · Thomas Huth
Quoted 18 lines · John Snow

First up, use the newest v0.0.5 instead of the older v0.0.3.

Secondly, the use of a period in the key name does not behave as expected when installing and checking for dependencies, so quote this string instead.

---
  pythondeps.toml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
pythondeps.toml +0 -0
index 98e99e79005..1657953ff65 100644
@@ -32,5 +32,5 @@ sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
  sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
Quoted 7 lines

pythondeps.toml sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" } · line 35

Quoted 3 lines
pythondeps.toml +1 -1
  [testdeps]
-qemu.qmp = { accepted = ">=0.0.3", installed = "0.0.3" }
+"qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }

Question from a still-python-ignorant: Isn't a dot in a python module name a bad idea after all? I mean if at one point in time, the "qemu" module comes to live and also contains a "qmp" submodule, isn't this calling for trouble?

The "qemu" package that lives in our tree is actually a namespace that contains several namespaced packages: qmp, machine, utils, etc. It just so happens that the internal "qemu" package comes along with "qemu.qmp".

I probably ought to update that placeholder qemu package and have it at least pull in qemu.qmp as a dependency ...

Quoted 6 lines

Maybe it would be a good point in time now to start populating
https://pypi.org/project/qemu instead?

Thomas

author
#44 lore raw

Re: [PATCH 22/22] python: delete qemu.qmp

In reply to Thomas Huth
Quoted 14 lines · Thomas Huth
Quoted 5 lines · John Snow

Begin relying on the external python-qemu-qmp dependency instead, to prevent desync between the internal and external libraries.

---

...

Quoted 6 lines
python/qemu/utils/qom_fuse.py +0 -0
index cf7e344bd53..e377ef6942f 100644
@@ -47,7 +47,6 @@
 
Quoted 8 lines

python/qemu/utils/qom_fuse.py line 52

Quoted 6 lines
python/qemu/utils/qom_fuse.py +0 -1
  import fuse
  from fuse import FUSE, FuseOSError, Operations
-
  from qemu.qmp import ExecuteError
 
  from .qom_common import QOMCommand

Nit: The above change looks unrelated.

It's actually related! "qemu.qmp" goes from being a "second party" package to a "third party" package because of the removal. Thus, it gets regrouped with other third party packages in the import order.

The import order is:

- first party (python stdlib)
- third party (PyPI stuff)
- second party (local imports, different package)
- local imports (local imports, same package)

Quoted 4 lines

Apart from that:

author
#24 lore raw

Re: [PATCH 11/22] python: add vendored qemu.qmp package

In reply to Thomas Huth
Quoted 13 lines · Thomas Huth
Quoted 11 lines · John Snow

In anticipation of deleting the python/qemu/qmp source from the tree, add a vendored version of the qemu.qmp package to ensure that "make check" can be run in isolated build environments, offline.

---
  python/scripts/vendor.py                      |   2 ++
  python/wheels/qemu_qmp-0.0.5-py3-none-any.whl | Bin 0 -> 72263 bytes
  2 files changed, 2 insertions(+)

create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl

Quoted 14 lines

python/scripts/vendor.py def main() -> int: · line 48

Quoted 11 lines
python/scripts/vendor.py +2 -0
index 33ac7a45de0..36cd27046e7 100755
@@ -43,6 +43,8 @@ def main() -> int:
      packages = {
          "meson==1.9.0":
          "45e51ddc41e37d961582d06e78c48e0f9039011587f3495c4d6b0781dad92357",
+        "qemu.qmp==0.0.5":
+        "e05782d6df5844b34e0d2f7c68693525da074deef7b641c1401dda6e4e3d6303",
      }

I wonder why I did not have to add pycotap here when I added a wheel for that...?

It's only a script we run manually - it doesn't break anything to skip over it. It just helps to have a script available that can do the vendoring for you and verify the checksums. Ease of convenience for future maintainers, etc.

Quoted 4 lines

Anyway, for your patch, FWIW:

author
#37 lore raw

Re: [PATCH 17/22] tests: forcibly run 'make check-venv' for crash tests

In reply to Thomas Huth
Quoted 93 lines · Thomas Huth
Quoted 7 lines · Paolo Bonzini

Il mar 18 nov 2025, 22:50 John Snow <[email protected] <mailto:[email protected]>> ha scritto:

Quoted 6 lines

On Mon, Nov 17, 2025, 3:47 PM Paolo Bonzini <[email protected] <mailto:[email protected]>> wrote:

Il lun 17 nov 2025, 20:07 Daniel P. Berrangé <

[email protected]

Quoted 4 lines

<mailto:[email protected]>> ha scritto:

On Mon, Nov 17, 2025 at 01:51:25PM -0500, John Snow wrote:
> In order to convert the existing Makefile target from a

manual

Quoted 5 lines

> invocation of mkvenv to one that uses the meson dependency
system, we
> need to not suppress ninja here.
>
> I'm not sure if this creates problems I am not aware of;

but

Quoted 2 lines

invoking
> ninja here is no longer spurious but will become

necessary.

Quoted 2 lines

Yes, this will likely create problems. From the commit

message that

Quoted 4 lines

introduced NINJA=":"...

Avoid it with the same
trick that we are using in buildtest-template.yml

already

Quoted 11 lines

by disabling
the up-to-date check via NINJA=":".

Move the check-venv call to buildtest-template.yml, right after configure? It's cheap enough.

Paolo

What's the root issue here? That there's enough of a time delay

between

Quoted 4 lines

the actual configure and the test running that it re-runs configure?

That the git repo is cloned again and is therefore newer than the

artifacts.

Quoted 1 line

That triggers a full rebuild.

Right. At least for the other "functional" and "check-system" jobs in our CI, this was a big issue, calling "make check-functional/qtest/iotest" there
triggered a rebuild of all binaries, increasing our CI runtime significantly.

For the "crash test" jobs, it was mainly about avoiding to rerun the "configure" step for cosmetical reasons each time the job runs. The rebuild
of the qemu binaries is triggered by "make check-iotests/qtests/function" in
the other jobs, and not by "make check-venv" alone, so it's not as bad as in
the other jobs here:
Without your patch, the jobs take about 16 minutes (crash-test-debian) and 10 minutes (crash-test-fedora):

https://gitlab.com/thuth/qemu/-/jobs/12138792667
https://gitlab.com/thuth/qemu/-/jobs/12138792674

With your patch applied:

https://gitlab.com/thuth/qemu/-/jobs/12139438583
https://gitlab.com/thuth/qemu/-/jobs/12139438599

the jobs take approx. the same amount of time, so I think it's OK here to drop the NINJA=":" again.

But I think we should give Paolo's idea a try and move the "make check-venv"
to buildtest-template.yml instead. In fact, that might even help to slightly
decrease the total runtime of the jobs since all the other "check" jobs don't have to do this again (for example the check-functional jobs are running it, too, see:
https://gitlab.com/qemu-project/qemu/-/jobs/12139584312#L1051).

Quoted 2 lines

Thomas

Ah, I see now, thanks! I can think of some remedies for this. No problem.

#27 lore raw

Re: [PATCH 13/22] mtest2make: cleanup mtest-suites variables

In reply to John Snow
Quoted 7 lines · John Snow

From: Paolo Bonzini <[email protected]>

Remove the "--suite" argument from the .*.mtest-suites variables, and add it only when actually computing the arguments to "meson test". This makes it possible to look at the set of suites to set ninja-cmd-goals, instead of doing it via many different .ninja-goals.* variables.

Quoted 6 lines

As a bonus, this removes code duplication between emit_suite_deps and its caller emit_suite. Since emit_suite_deps would now be one or two lines of code, integrate it into emit_suite directly.

This and the other two patches are now in master.

Paolo