python: drop qemu.qmp from qemu.git tree
v2 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.
v2:
- move "make check-venv" earlier in GitLab CI/CD pipeline, to avoid re-running configure
- Fix functional tests not using PyPI to fetch pygdbmi package
- Remove pre-requisites which are now merged
I think this series is probably close, but with some attention needed on the mkvenv packages to allow installing the local python packages. Everything else feels good-to-go, as far as I can tell.
(Cool diffstat.)
--js
John Snow (16):
python/mkvenv: create timestamp file for each group "ensured" python/mkvenv: bump 'qemu.qmp' dependency for testdeps python/mkvenv: add 'checktests' and 'functests' dependency groups 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: conditionally run "make check-venv" during build phase
tests: 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
meson.build | 1 + .gitlab-ci.d/buildtest-template.yml | 4 + .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 | 11 + python/scripts/vendor.py | 2 + python/setup.cfg | 31 +- 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 | 13 +- pyvenv/meson.build | 36 + tests/Makefile.include | 25 +- tests/functional/meson.build | 7 +- tests/qemu-iotests/meson.build | 2 +- 27 files changed, 89 insertions(+), 5560 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
PATCH v2 2/16 python/mkvenv: bump 'qemu.qmp' dependency for testdeps
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
@@ -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
PATCH v2 1/16 python/mkvenv: create timestamp file for each group "ensured"
In reply to John SnowEach 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
@@ -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
PATCH v2 7/16 python: add vendored qemu.qmp package
In reply to John SnowIn 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
@@ -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
Signature · 1 line
2.51.1
PATCH v2 10/16 tests: conditionally run "make check-venv" during build phase
In reply to John SnowSome tests need test dependencies, some tests don't. Instead of running "make check" manually, use a CI variable for the template that allows us to front-load the testing dependencies without needing to incur another re-configure command.
--- .gitlab-ci.d/buildtest-template.yml | 4 ++++ 1 file changed, 4 insertions(+)
.gitlab-ci.d/buildtest-template.yml +4 -0
@@ -32,6 +32,10 @@ then pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ; fi || exit 1; + - if test -n "$SETUP_CHECK_VENV"; + then + make check-venv; + fi; - section_end configure - section_start build "Building QEMU" - $MAKE -j"$JOBS"
Signature · 1 line
2.51.1
PATCH v2 13/16 mkvenv: add --no-build-isolation flag
In reply to John SnowRFC/WIP - The issue being worked around here is the fact that if we install our local python packages to the pyvenv environment, we need additional libraries available to actually "build" the package to install it; our alpine linux environment doesn't have the necessary packages and so testing fails at this step unless we allow it to use the existing packages already installed to perform the build.
I'm not sure why it's just Alpine, or if there's a smarter way to solve this, or why this issue doesn't impact our existing methods of installing the local packages.
For me to investigate.
--- python/scripts/mkvenv.py | 1 + 1 file changed, 1 insertion(+)
python/scripts/mkvenv.py +1 -0
@@ -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
PATCH v2 16/16 python: delete qemu.qmp
In reply to John SnowBegin 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
@@ -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
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/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.
PATCH v2 5/16 tests/iotests: Use configured python to run GitLab iotests
In reply to John Snowuse 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
@@ -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
PATCH v2 8/16 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
@@ -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
PATCH v2 4/16 meson, mkvenv: add checktests and functests custom targets
In reply to John Snowadd "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 | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 pyvenv/meson.build
meson.build +1 -0
@@ -4587,6 +4587,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 +36 -0
@@ -0,0 +1,36 @@ +# 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' + + +# This group must be available offline +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' ], +) + +# This group is allowed to fetch from PyPI. +pyvenv_functests_group = custom_target( + 'pyvenv_functests_group', + output: 'functests.group', + input: pyvenv_common_deps, + depends: pyvenv_checktests_group, + command: [ python, '@INPUT1@', + 'ensuregroup', + '--online', + '--dir', pyvenv_wheel_dir, + '@INPUT0@', + 'functests' ], +)
Signature · 1 line
2.51.1
PATCH v2 12/16 python/mkvenv: add mechanism to install local package(s)
In reply to John SnowCurrently, 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.
This also has the benefit of being able to specify in a declarative configuration file that our pyvenv environment *will* have our local python packages installed and available without any PYTHONPATH hacks, which should simplify iotests, device-crash-test and functional tests without needing to manage local inclusion paths in environment variables.
--- python/scripts/mkvenv.py | 4 ++++ 1 file changed, 4 insertions(+)
python/scripts/mkvenv.py +4 -0
@@ -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
PATCH v2 3/16 python/mkvenv: add 'checktests' and 'functests' dependency groups
In reply to John Snow'checktests' contains depedencies *required* to run "make check", and as such, we promise that these dependencies can be sourced from the user's distribution repository or from vendored packages so that "make check" can be executed offline in an isolated build environment.
In contrast, pygdbmi is only needed for functional tests and not tests in general; we do not make the same offline/isolated guarantees for functional tests, and this dependency group is allowed to fetch dependencies from PyPI at runtime.
For the time being, Amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them.
--- pythondeps.toml | 10 +++++++++- tests/Makefile.include | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)
pythondeps.toml +9 -1
@@ -31,6 +31,14 @@ 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] +# This test group is for dependencies required to run "make check" +# successfully, and should only include depedencies that can be +# guaranteed via configure from system packages, or python packages we +# vendor. +[checktests] "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } + +# This test group is for functional tests, and can include dependencies +# fetched from PyPI. +[functests] pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
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) $< checktests functests $(call quiet-command, touch $@) check-venv: $(TESTS_VENV_TOKEN)
Signature · 1 line
2.51.1
PATCH v2 15/16 tests/Makefile: replace old "check-venv" target with meson target
In reply to John SnowWith new meson dependencies in place, swap the "check-venv" command to one that invokes the meson dependency system to ensure the appropriate testing dependencies are installed to the pyvenv.
This command is not required when running "make check" as the meson dependency system is aware that it needs to install the testing deps to run that suite, however, for certain manual test invocations (device-crash-test, iotests when run manually) this make target serves as a convenient way to explicitly request those dependencies be added to the pyvenv.
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 functional tests satisfactorily; running "make check-functional" will pull in any additional dependencies needed to run that portion of the test suite on its own.
--- tests/Makefile.include | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
tests/Makefile.include +6 -19
@@ -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
PATCH v2 9/16 meson, mkvenv: make functional tests depend on functests group
In reply to John SnowNote that only the thorough group requires the extra testing dependencies; the quick group is guaranteed to run with our minimal testing dependency set.
--- tests/functional/meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tests/functional/meson.build +6 -1
@@ -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
PATCH v2 11/16 tests: run 'make check-venv' for crash tests
In reply to John SnowThe device crash tests aren't expressed in the meson dependency system, so we manually install the necessary test dependencies here.
--- .gitlab-ci.d/buildtest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +2 -2
@@ -99,9 +99,9 @@ crash-test-debian: artifacts: true variables: IMAGE: debian + SETUP_CHECK_VENV: 1 script: - cd build - - make NINJA=":" check-venv - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386 build-system-fedora:
@@ -156,9 +156,9 @@ crash-test-fedora: artifacts: true variables: IMAGE: fedora + SETUP_CHECK_VENV: 1 script: - cd build - - make NINJA=":" 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
PATCH v2 14/16 meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
In reply to John SnowAdd the local python package group into pythondeps.toml for the checktests group. This makes qemu.qmp, qemu.machine and qemu.utils packages unconditionally available for tests.
--- pythondeps.toml | 1 + 1 file changed, 1 insertion(+)
pythondeps.toml +1 -0
@@ -37,6 +37,7 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } # vendor. [checktests] "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } +"$SRCROOT/python/" = { } # This test group is for functional tests, and can include dependencies # fetched from PyPI.
Signature · 1 line
2.51.1
PATCH v2 6/16 tests/iotests: use "make check-venv" to prepare for running iotests
In reply to John SnowSoon, 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
@@ -348,6 +348,7 @@ build-tcg-disabled: --disable-docs --disable-sdl --disable-gtk --disable-vnc || { cat config.log meson-logs/meson-log.txt && exit 1; } - make -j"$JOBS" + - make check-venv - make check-unit - make check-qapi-schema - cd tests/qemu-iotests/
Signature · 1 line
2.51.1
Re: [PATCH v2 02/16] python/mkvenv: bump 'qemu.qmp' dependency for testdeps
In reply to John SnowQuoted 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.
Signed-off-by John Snow <[email protected]>--- pythondeps.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)pythondeps.toml +0
-0
pythondeps.toml sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" } · line 36
Quoted 6 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" } pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
Quoted 7 lines · John Snow
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.
v2:
Quoted 8 lines
- move "make check-venv" earlier in GitLab CI/CD pipeline, to avoid re-running configure
- Fix functional tests not using PyPI to fetch pygdbmi package
- Remove pre-requisites which are now mergedI think this series is probably close, but with some attention needed on the mkvenv packages to allow installing the local python packages. Everything else feels good-to-go, as far as I can tell.
Hi John,
I gave the series a try in the CI, but the macOS and FreeBSD jobs are failing now:
https://gitlab.com/thuth/qemu/-/jobs/12211713065
https://gitlab.com/thuth/qemu/-/jobs/12211713061
Have a look at .gitlab-ci.d/cirrus/README.rst if you want to enable these jobs in your gitlab CI, too.
HTH,
Thomas
Re: [PATCH v2 10/16] tests: conditionally run "make check-venv" during build phase
In reply to John SnowQuoted 15 lines · John Snow
Some tests need test dependencies, some tests don't. Instead of running "make check" manually, use a CI variable for the template that allows us to front-load the testing dependencies without needing to incur another re-configure command.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest-template.yml | 4 ++++ 1 file changed, 4 insertions(+).gitlab-ci.d/buildtest-template.yml +0
-0
.gitlab-ci.d/buildtest-template.yml line 38
Quoted 7 lines
.gitlab-ci.d/buildtest-template.yml +4
-0@@ -32,6 +32,10 @@ then pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ; fi || exit 1; + - if test -n "$SETUP_CHECK_VENV"; + then + make check-venv; + fi;
I'm not sure, but I think this is likely not quite working as you intended it. The above code hunk is added to native_build_job_template, i.e. it's executed for the build-* jobs, but in the next patch, you only set the environment variable on the crash-test-* jobs. I don't think that the environment variables propagate backward from a later job to an earlier one.
Looking at the output of another build job, e.g. build-system-alpine:
https://gitlab.com/thuth/qemu/-/jobs/12211712932#L2156
... it looks like pygdbmi is now also always installed there, i.e. something else triggers "check-venv" on all build jobs now, and that's why you were able to drop the "check-venv" in the crash-test-* jobs in the next patch now. No clue what's causing this now, but IMHO it should be fine if we just unconditionally do "check-venv" in all build jobs anyway (we also need the venv in a bunch of other test jobs anyway), so I'd rather do the "make check-venv" in this patch unconditionally here, and drop the next patch that sets SETUP_CHECK_VENV in the crash-test jobs. WDYT?
Thomas
Quoted 22 lines · Thomas Huth
Quoted 7 lines · John Snow
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.
v2:
Quoted 8 lines
- move "make check-venv" earlier in GitLab CI/CD pipeline, to avoid re-running configure
- Fix functional tests not using PyPI to fetch pygdbmi package
- Remove pre-requisites which are now mergedI think this series is probably close, but with some attention needed on the mkvenv packages to allow installing the local python packages. Everything else feels good-to-go, as far as I can tell.
Hi John,
I gave the series a try in the CI, but the macOS and FreeBSD jobs are failing now:
Quoted 9 lines
https://gitlab.com/thuth/qemu/-/jobs/12211713065
https://gitlab.com/thuth/qemu/-/jobs/12211713061Have a look at
.gitlab-ci.d/cirrus/README.rstif you want to enable these jobs in your gitlab CI, too.HTH,
Thomas
Ah, nuts. OK, let me get those and then I'll apply any of your RBs that still apply.
Thanks for the check.
Quoted 1 line
Re: [PATCH v2 10/16] tests: conditionally run "make check-venv" during build phase
In reply to Thomas HuthQuoted 47 lines · Thomas Huth
Review
Quoted 11 lines · John Snow
Some tests need test dependencies, some tests don't. Instead of running "make check" manually, use a CI variable for the template that allows us to front-load the testing dependencies without needing to incur another re-configure command.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest-template.yml | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/.gitlab-ci.d/buildtest-template.yml.gitlab-ci.d/buildtest-template.yml line 38
Quoted 11 lines
index
d866cb12bb1..cfa123d3a10100644.gitlab-ci.d/buildtest-template.yml +4
-0@@ -32,6 +32,10 @@ then pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ; fi || exit 1; + - if test -n "$SETUP_CHECK_VENV"; + then + make check-venv; + fi;I'm not sure, but I think this is likely not quite working as you intended it. The above code hunk is added to
native_build_job_template, i.e. it's executed for the build-* jobs, but in the next patch, you only set the environment variable on the crash-test-* jobs. I don't think that the environment variables propagate backward from a later job to an earlier one.Looking at the output of another build job, e.g. build-system-alpine:
https://gitlab.com/thuth/qemu/-/jobs/12211712932#L2156
... it looks like pygdbmi is now also always installed there, i.e. something
else triggers "check-venv" on all build jobs now, and that's why you were able to drop the "check-venv" in the crash-test-* jobs in the next patch now. No clue what's causing this now, but IMHO it should be fine if we just
unconditionally do "check-venv" in all build jobs anyway (we also need the venv in a bunch of other test jobs anyway), so I'd rather do the "make check-venv" in this patch unconditionally here, and drop the next patch that
setsSETUP_CHECK_VENVin the crash-test jobs. WDYT?
Quoted 2 lines
Thomas
... Huh. Well, I think it's probably fine to do it unconditionally for now, but in the future we might have even more deps that might cause more delays, so it'd be nice to have this mechanism working.
Shame on me for not noticing. The CI runs just take so long that I'm delighted when they pass 🫠
Lemme look into it, but you might be right that the unconditional approach might be best...
Quoted 1 line
Re: [PATCH v2 10/16] tests: conditionally run "make check-venv" during build phase
In reply to Thomas HuthQuoted 43 lines · Thomas Huth
Quoted 15 lines · John Snow
Some tests need test dependencies, some tests don't. Instead of running "make check" manually, use a CI variable for the template that allows us to front-load the testing dependencies without needing to incur another re-configure command.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest-template.yml | 4 ++++ 1 file changed, 4 insertions(+).gitlab-ci.d/buildtest-template.yml +0
-0.gitlab-ci.d/buildtest-template.yml line 38
Quoted 7 lines
.gitlab-ci.d/buildtest-template.yml +4
-0@@ -32,6 +32,10 @@ then pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ; fi || exit 1; + - if test -n "$SETUP_CHECK_VENV"; + then + make check-venv; + fi;I'm not sure, but I think this is likely not quite working as you intended it. The above code hunk is added to
native_build_job_template, i.e. it's executed for the build-* jobs, but in the next patch, you only set the environment variable on the crash-test-* jobs. I don't think that the environment variables propagate backward from a later job to an earlier one.Looking at the output of another build job, e.g. build-system-alpine:
https://gitlab.com/thuth/qemu/-/jobs/12211712932#L2156
... it looks like pygdbmi is now also always installed there, i.e. something else triggers "check-venv" on all build jobs now, and that's why you were able to drop the "check-venv" in the crash-test-* jobs in the next patch now. No clue what's causing this now, but IMHO it should be fine if we just unconditionally do "check-venv" in all build jobs anyway (we also need the venv in a bunch of other test jobs anyway), so I'd rather do the "make check-venv" in this patch unconditionally here, and drop the next patch that sets
SETUP_CHECK_VENVin the crash-test jobs. WDYT?
Quoted 2 lines
Thomas
Yeah, it wasn't working. Oops, and good catch.
I moved "make check-venv" into the build-system-debian/fedora phases instead and that works like I expect.
However, the pygdbmi bit is still confusing. Apparently both of the new ensuregroup targets get installed with "make check-build", even though they aren't used for building anything. I'm trying to sift through the make system interplay to figure out why it's part of that target...
--js
Re: [PATCH v2 10/16] tests: conditionally run "make check-venv" during build phase
Quoted 50 lines · John Snow
Quoted 43 lines · Thomas Huth
Quoted 15 lines · John Snow
Some tests need test dependencies, some tests don't. Instead of running "make check" manually, use a CI variable for the template that allows us to front-load the testing dependencies without needing to incur another re-configure command.
Signed-off-by John Snow <[email protected]>--- .gitlab-ci.d/buildtest-template.yml | 4 ++++ 1 file changed, 4 insertions(+).gitlab-ci.d/buildtest-template.yml +0
-0.gitlab-ci.d/buildtest-template.yml line 38
Quoted 7 lines
.gitlab-ci.d/buildtest-template.yml +4
-0@@ -32,6 +32,10 @@ then pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ; fi || exit 1; + - if test -n "$SETUP_CHECK_VENV"; + then + make check-venv; + fi;I'm not sure, but I think this is likely not quite working as you intended it. The above code hunk is added to
native_build_job_template, i.e. it's executed for the build-* jobs, but in the next patch, you only set the environment variable on the crash-test-* jobs. I don't think that the environment variables propagate backward from a later job to an earlier one.Looking at the output of another build job, e.g. build-system-alpine:
https://gitlab.com/thuth/qemu/-/jobs/12211712932#L2156
... it looks like pygdbmi is now also always installed there, i.e. something else triggers "check-venv" on all build jobs now, and that's why you were able to drop the "check-venv" in the crash-test-* jobs in the next patch now. No clue what's causing this now, but IMHO it should be fine if we just unconditionally do "check-venv" in all build jobs anyway (we also need the venv in a bunch of other test jobs anyway), so I'd rather do the "make check-venv" in this patch unconditionally here, and drop the next patch that sets
SETUP_CHECK_VENVin the crash-test jobs. WDYT?Quoted 2 lines
Thomas
Yeah, it wasn't working. Oops, and good catch.
Quoted 8 lines
I moved "make check-venv" into the build-system-debian/fedora phases instead and that works like I expect.
However, the pygdbmi bit is still confusing. Apparently both of the new ensuregroup targets get installed with "make check-build", even though they aren't used for building anything. I'm trying to sift through the make system interplay to figure out why it's part of that target...
It's something to do with mtest2make, I think, adding the func test / precache deps to the "check-build" target in Makefile.mtest - but I'm not exactly sure where to make the incision here or what consequences it might have.
I notice that the python test dependencies seem to get added here regardless of if they are defined for the tests themselves, or for the precache targets. Odd.
I think I need to consult with Paolo.