python: drop qemu.qmp from qemu.git tree
v6 cover python: drop qemu.qmp from qemu.git tree
Hello!
This series drops the in-tree version of our python-qemu-qmp package ("qemu.qmp") in favor of the version hosted on PyPI, whose repository is located at https://gitlab.com/qemu-project/python-qemu-qmp.
GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2272170300
This version reflects Dan's suggestion to always install the in-tree Python packages by default.
The major effects of this patch series are:
1. qemu.qmp and the python/ directory will be installed to the configure-time venv (build/pyvenv) by default.
2. qemu.qmp will be installed from PyPI or vendored packages instead of being utilized directly from the qemu.git tree.
3. "make check-venv" is removed as it is no longer needed.
4. functional test dependencies are installed as-needed when running those tests.
5. Unfortunately, python3-wheel and python3-setuptools are now required on the host system if tests are to be executed and >= Python 3.13 is used.
6. An awful lot of deleted lines of code, and a lot fewer headaches managing two nearly-identical copies of this source code. O:-)
v6:
- Added workaround for configure-less VM tests
v5:
- Changed the local package install mechanism as per Paolo's advice
- Changed "file://" mechanism for local installs, following the msys2 test fixes upstream that did the same
- Fix typo in cover letter (thuth)
- Fixed comments around mkvenv invocations; functests group will *always* use the --online flag, whether or not it was configured. (danpb)
- Please, let this nightmare be over
v4:
- Rename "checktests" group to "tooling", install it by default alongside meson at configure-time.
- Remove "check-venv" entirely.
- Update python/README.rst to reflect the new paradigm
- Update many scripts that import qemu.qmp to give new errors when they are run outside of the configure venv
KNOWN ISSUES IN V4:
- The last patch is an RFC based on Thomas' observations, I don't have a strong opinion on if we want it or not.
- Removing "make check-venv" causes the VM tests to rebuild more often; I was not sure how to replace the old conditional behavior in an equivalent manner. Suggestions, anyone...?
v3:
- Fixed FreeBSD vm test
- Fixed Cirrus macOS test (Needed setuptools as a dep, "file:///" had one too many forward slashes, which works fine for older pip/setuptools, but was incompatibly fixed recently.)
- Fixed an issue that prevented installing the local python packages in an offline, isolated build environment (need --no-isolated-build and pip environment variable flags)
- Added the python3-wheel and python3-setuptools build dependencies to lcitool, owing to the above issues
- Ensured that the $download flag (for PyPI access) from configure is carried over into pytest/meson.build invocations. This defaults to "enabled", so test dependencies should not have any issue being fetched on most developer workstations and build environments.
- Fixed several bugs in the mkvenv.py local package installation mechanism.
- Flags and workarounds added for installing local packages offline now apply *only* to local package installations, and not "normal" depspecs.
- Reordered patches into more logical "phases" for easier review (I hope...?)
Known issues: "make check-build" still installs all of the test dependencies to the pyvenv. I'm not sure if this is desired or not, but I ran into problems preventing it from doing this without breaking a ton of CI tests. I'll continue to investigate this, but wanted to send this v3 out.
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
--js
John Snow (16):
python/mkvenv: create timestamp file for each group "ensured" python/mkvenv: bump 'qemu.qmp' dependency for testdeps python/mkvenv: add 'tooling' and 'functests' dependency groups python/mkvenv: add mechanism to install local package(s) meson, mkvenv: add functests custom target
tests: Use configured python to run GitLab iotests
tests: use "run" script to execute device-crash-test tests/lcitool: add python3 wheel and setuptools deps for qemu
python: add vendored qemu.qmp package
meson, mkvenv: make functional tests depend on functests group meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
configure: unconditionally install "tooling" group
tests: replace check-venv with vm-venv target
scripts: nudge users to use 'run' script for scripts that import
qemu.qmp
python: delete qemu.qmp
python: update README.rst to reflect qemu.qmp's removal
python/README.rst | 52 +- configure | 2 +- meson.build | 1 + .gitlab-ci.d/buildtest.yml | 26 +- .gitlab-ci.d/cirrus/freebsd-14.vars | 2 +- .gitlab-ci.d/cirrus/macos-14.vars | 2 +- .gitlab-ci.d/windows.yml | 2 + 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 | 43 +- 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 | 27 + scripts/compare-machine-types.py | 7 +- scripts/device-crash-test | 5 +- scripts/qmp/qemu-ga-client | 13 +- scripts/qmp/qmp-shell | 13 +- scripts/qmp/qmp-shell-wrap | 13 +- scripts/qmp/qom-fuse | 13 +- scripts/qmp/qom-get | 13 +- scripts/qmp/qom-list | 13 +- scripts/qmp/qom-set | 13 +- scripts/qmp/qom-tree | 13 +- scripts/qmp_helper.py | 9 +- scripts/render_block_graph.py | 10 +- scripts/simplebench/bench_block_job.py | 10 +- tests/Makefile.include | 22 +- tests/docker/dockerfiles/alpine.docker | 2 + tests/docker/dockerfiles/centos9.docker | 2 + tests/functional/meson.build | 5 +- tests/lcitool/projects/qemu.yml | 2 + tests/migration-stress/guestperf/engine.py | 15 +- tests/vm/Makefile.include | 18 +- tests/vm/generated/freebsd.json | 2 + 49 files changed, 254 insertions(+), 5670 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.52.0
PATCH v6 1/16 python/mkvenv: create timestamp file for each group "ensured"
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
@@ -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.52.0
PATCH v6 2/16 python/mkvenv: bump 'qemu.qmp' dependency for testdeps
In reply to John SnowFirst 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.52.0
PATCH v6 3/16 python/mkvenv: add 'tooling' and 'functests' dependency groups
In reply to John Snow'tooling' contains depedencies required to run various tools (like qmp-shell) as well as dependencies 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. By the end of this series, however, "check-venv" will be eliminated in favor of always installing "tooling" at configure time and allowing "functests" to be installed on-demand as needed by meson/ninja.
--- 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.10.0", installed = "1.10.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 various tooling +# and tests that should always be installed at configure time. It should +# only include dependencies that can be guaranteed via configure from +# system packages, or python packages we vendor. +[tooling] "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } + +# 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
@@ -107,7 +107,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) $< tooling functests $(call quiet-command, touch $@) check-venv: $(TESTS_VENV_TOKEN)
Signature · 1 line
2.52.0
PATCH v6 4/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.
This patch adds a path constraint that can be used in lieu of version constraints to specify that a package should be installed from the source tree instead of from PyPI or vendored packages. 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.
On the downsides, installing packages through mkvenv/ensuregroup means that there are extra steps we need to take in order to install a local package *offline*; namely we must disable build isolation (so we have access to setuptools) and we must also include python3-wheel in QEMU's build dependencies in order for "make check" to run successfully when in an offline, isolated environment. These extra dependencies are handled in a forthcoming commit; for now, nothing is utilizing this new pathway.
--- python/scripts/mkvenv.py | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-)
python/scripts/mkvenv.py +31 -6
@@ -662,6 +662,7 @@ def pip_install( args: Sequence[str], online: bool = False, wheels_dir: Optional[Union[str, Path]] = None, + env: Optional[Dict[str, str]] = None, ) -> None: """ Use pip to install a package or package(s) as specified in @args.
@@ -687,6 +688,7 @@ def pip_install( full_args += list(args) subprocess.run( full_args, + env=env, check=True, )
@@ -733,9 +735,14 @@ def _do_ensure( :param wheels_dir: If specified, search this path for packages. """ absent = [] + local_packages = [] present = [] canary = None for name, info in group.items(): + if "path" in info: + pkgpath = Path(__file__).parents[2].joinpath(info["path"]) + local_packages.append(str(pkgpath)) + continue constraint = _make_version_constraint(info, False) matcher = Matcher(name + constraint) print(f"mkvenv: checking for {matcher}", file=sys.stderr)
@@ -770,15 +777,33 @@ def _do_ensure( print(f"mkvenv: installing {', '.join(absent)}", file=sys.stderr) try: pip_install(args=absent, online=online, wheels_dir=wheels_dir) - return None + absent = [] except subprocess.CalledProcessError: pass - return diagnose( - absent[0], - online, - wheels_dir, - canary, + if absent: + return diagnose( + absent[0], + online, + wheels_dir, + canary, + ) + + # Handle local packages separately and last so we can use different + # installation arguments (-e), and so that any dependencies that may + # be covered above will be handled according to the depfile + # specifications. + if local_packages: + print(f"mkvenv: installing {', '.join(local_packages)}", + file=sys.stderr) + env = dict(os.environ) + env['PIP_CONFIG_SETTINGS'] = "editable_mode=compat" + pip_install( + args=["--no-build-isolation", + "-e"] + local_packages, + online=online, + wheels_dir=wheels_dir, + env=env, ) return None
Signature · 1 line
2.52.0
PATCH v6 5/16 meson, mkvenv: add functests custom target
In reply to John Snowadd the "pyvenv_functests_group" target to meson. This target will invoke mkvenv.py to install the associated dependency group to the build/pyvenv directory.
A "pyvenv_tooling_group" is not included here as it is the plan to always install this group by default, so it will not need an on-demand trigger.
--- meson.build | 1 + pyvenv/meson.build | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pyvenv/meson.build
meson.build +1 -0
@@ -4556,6 +4556,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 +27 -0
@@ -0,0 +1,27 @@ +# Note that this file only controls "optional" dependency groups; groups +# unconditionally installed at configure time are handled in configure +# instead; namely: meson, sphinx, and the tooling groups. + +# Note that this command may or may not include the "--online" flag +# based on configuration. +ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split() + +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 is allowed to (and must) rely on internet to fetch from +# PyPI. Force the use of the --online flag here. +pyvenv_functests_group = custom_target( + 'pyvenv_functests_group', + output: 'functests.group', + input: pyvenv_common_deps, + command: ensuregroup_cmd + [ + '--online', + '--dir', pyvenv_wheel_dir, + '@INPUT0@', + 'functests', + ], +)
Signature · 1 line
2.52.0
PATCH v6 6/16 tests: Use configured python to run GitLab iotests
In reply to John Snowuse the configured python (and the pyvenv) to run iotests instead of the system default python3 interpreter. Use the new "run" script in the build directory to execute the command inside the meson developer environment, templated in qemu.git/run.in.
--- .gitlab-ci.d/buildtest.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
.gitlab-ci.d/buildtest.yml +9 -9
@@ -350,15 +350,15 @@ build-tcg-disabled: - make -j"$JOBS" - 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 - 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 - 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 - - cd ../.. + - ./run tests/qemu-iotests/check -raw 001 002 003 004 005 008 009 + 010 011 012 021 025 032 033 048 052 063 077 086 101 104 106 + 113 148 150 151 152 157 159 160 163 170 171 184 192 194 208 + 221 226 227 236 253 277 image-fleecing + - ./run tests/qemu-iotests/check -qcow2 028 051 056 057 058 065 068 + 082 085 091 095 096 102 122 124 132 139 142 144 145 151 152 + 155 157 165 194 196 200 202 208 209 216 218 227 234 246 247 + 248 250 254 255 257 258 260 261 262 263 264 270 272 273 277 + 279 image-fleecing - make distclean build-user:
Signature · 1 line
2.52.0
PATCH v6 7/16 tests: use "run" script to execute device-crash-test
In reply to John SnowInstead of invoking python from the configure venv manually, instruct developers to use the "run" script instead. Change the test invocation to be a good example going forward.
--- .gitlab-ci.d/buildtest.yml | 6 +++--- scripts/device-crash-test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
.gitlab-ci.d/buildtest.yml +3 -3
@@ -102,7 +102,7 @@ crash-test-debian: script: - cd build - make NINJA=":" check-venv - - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386 + - ./run scripts/device-crash-test -q --tcg-only ./qemu-system-i386 build-system-fedora: extends:
@@ -159,8 +159,8 @@ crash-test-fedora: 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 + - ./run scripts/device-crash-test -q ./qemu-system-ppc + - ./run scripts/device-crash-test -q ./qemu-system-riscv32 build-system-centos: extends:
scripts/device-crash-test +1 -1
@@ -42,7 +42,7 @@ except ModuleNotFoundError as exc: print(f"Module '{exc.name}' not found.") print(" Try 'make check-venv' from your build directory,") print(" and then one way to run this script is like so:") - print(f' > $builddir/pyvenv/bin/python3 "{path}"') + print(f' > $builddir/run "{path}"') sys.exit(1) logger = logging.getLogger('device-crash-test')
Signature · 1 line
2.52.0
PATCH v6 8/16 tests/lcitool: add python3 wheel and setuptools deps for qemu
In reply to John SnowInstalling local dependencies while offline, without PyPI access, requires the python3-setuptools and python3-wheel packages. Most distributions have these available anyway for one reason or another, but not all of them.
If you are asking yourself "Wait, aren't these packages guaranteed via installation of pip, via the ensurepip module, which mkvenv takes immense pains to provide for us?" - Well... since Python 3.13, "pip" does not actually come with "setuptools" or "wheel" anymore, and so if we want to build and install a python package, we actually need these available in the host environment.
(Note that you don't need these packages just to install a pre-built package, you only need them to *build* a package. With cutting edge setuptools and pip, all locally installed packages, even in editable mode, must be "built" first before being installed. Thus, these dependencies are being added specifically to facilitate installing qemu.git/python/qemu to the configure-time venv.)
--- .gitlab-ci.d/cirrus/freebsd-14.vars | 2 +- .gitlab-ci.d/cirrus/macos-14.vars | 2 +- .gitlab-ci.d/windows.yml | 2 ++ tests/docker/dockerfiles/alpine.docker | 2 ++ tests/docker/dockerfiles/centos9.docker | 2 ++ tests/lcitool/projects/qemu.yml | 2 ++ tests/vm/generated/freebsd.json | 2 ++ 7 files changed, 12 insertions(+), 2 deletions(-)
.gitlab-ci.d/cirrus/freebsd-14.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PACKAGING_COMMAND='pkg' PIP3='/usr/local/bin/pip' -PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka coreutils ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd' +PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka coreutils ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-setuptools py311-sphinx py311-sphinx_rtd_theme py311-tomli py311-wheel python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd' PYPI_PKGS='' PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/cirrus/macos-14.vars +1 -1
@@ -12,5 +12,5 @@ NINJA='/opt/homebrew/bin/ninja' PACKAGING_COMMAND='brew' PIP3='/opt/homebrew/bin/pip3' PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd' -PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli' +PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli setuptools wheel' PYTHON='/opt/homebrew/bin/python3'
.gitlab-ci.d/windows.yml +2 -0
@@ -89,6 +89,8 @@ msys2-64bit: mingw-w64-x86_64-pkgconf mingw-w64-x86_64-python mingw-w64-x86_64-python-certifi + mingw-w64-x86_64-python-setuptools + mingw-w64-x86_64-python-wheel mingw-w64-x86_64-rust mingw-w64-x86_64-rust-bindgen mingw-w64-x86_64-zstd"
tests/docker/dockerfiles/alpine.docker +2 -0
@@ -87,8 +87,10 @@ RUN apk update && \ py3-numpy \ py3-pillow \ py3-pip \ + py3-setuptools \ py3-sphinx \ py3-sphinx_rtd_theme \ + py3-wheel \ py3-yaml \ python3 \ rpm2cpio \
tests/docker/dockerfiles/centos9.docker +2 -0
@@ -101,9 +101,11 @@ RUN dnf distro-sync -y && \ python3-numpy \ python3-pillow \ python3-pip \ + python3-setuptools \ python3-sphinx \ python3-sphinx_rtd_theme \ python3-tomli \ + python3-wheel \ rdma-core-devel \ rust \ rust-std-static \
tests/lcitool/projects/qemu.yml +2 -0
@@ -98,11 +98,13 @@ packages: - python3-pillow - python3-pip - python3-PyYAML + - python3-setuptools - python3-sphinx - python3-sphinx-rtd-theme - python3-sqlite3 - python3-tomli - python3-venv + - python3-wheel - rpm2cpio - rust - rust-std
tests/vm/generated/freebsd.json +2 -0
@@ -57,9 +57,11 @@ "py311-pillow", "py311-pip", "py311-pyyaml", + "py311-setuptools", "py311-sphinx", "py311-sphinx_rtd_theme", "py311-tomli", + "py311-wheel", "python3", "rpm2cpio", "rust",
Signature · 1 line
2.52.0
PATCH v6 9/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.10.0": "4b27aafce281e652dcb437b28007457411245d975c48b5db3a797d3e93ae1585", + "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.52.0
PATCH v6 10/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 will run with just the "tooling" group, which we intend to install by default at configure time in a forthcoming commit.
--- tests/functional/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tests/functional/meson.build +4 -1
@@ -57,6 +57,8 @@ 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', []) \
@@ -64,9 +66,9 @@ foreach speed : ['quick', 'thorough'] 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 +101,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.52.0
PATCH v6 11/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 tooling This makes qemu.qmp, qemu.machine and qemu.utils packages unconditionally available for tests and scripts.
--- 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" } # system packages, or python packages we vendor. [tooling] "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } +"qemu" = { path = "python/" } # This test group is for functional tests, and can include dependencies # fetched from PyPI.
Signature · 1 line
2.52.0
Re: [PATCH v6 11/16] meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
Quoted 14 lines · John Snow
Add the local python package group into pythondeps.toml for the tooling This makes qemu.qmp, qemu.machine and qemu.utils packages unconditionally available for tests and scripts.
Signed-off-by John Snow <[email protected]>--- pythondeps.toml | 1 + 1 file changed, 1 insertion(+)pythondeps.toml +0
-0
pythondeps.toml sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } · line 43
Quoted 7 lines
pythondeps.toml +1
-0@@ -37,6 +37,7 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } # system packages, or python packages we vendor. [tooling] "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" } +"qemu" = { path = "python/" } # This test group is for functional tests, and can include dependencies # fetched from PyPI.
PATCH v6 12/16 configure: unconditionally install "tooling" group
In reply to John SnowAlongside meson, always ensure our in-tree tooling group and its out-of-tree dependency, qemu.qmp, is always installed.
As a result, several "check-venv" invocations can be removed from various testing scripts.
--- configure | 2 +- .gitlab-ci.d/buildtest.yml | 2 -- scripts/device-crash-test | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-)
configure +1 -1
@@ -966,7 +966,7 @@ mkvenv="$python ${source_path}/python/scripts/mkvenv.py" # Finish preparing the virtual environment using vendored .whl files $mkvenv ensuregroup --dir "${source_path}/python/wheels" \ - ${source_path}/pythondeps.toml meson || exit 1 + ${source_path}/pythondeps.toml meson tooling || exit 1 # At this point, we expect Meson to be installed and available. # We expect mkvenv or pip to have created pyvenv/bin/meson for us.
.gitlab-ci.d/buildtest.yml +0 -2
@@ -101,7 +101,6 @@ crash-test-debian: IMAGE: debian script: - cd build - - make NINJA=":" check-venv - ./run scripts/device-crash-test -q --tcg-only ./qemu-system-i386 build-system-fedora:
@@ -158,7 +157,6 @@ crash-test-fedora: IMAGE: fedora script: - cd build - - make NINJA=":" check-venv - ./run scripts/device-crash-test -q ./qemu-system-ppc - ./run scripts/device-crash-test -q ./qemu-system-riscv32
scripts/device-crash-test +1 -2
@@ -40,8 +40,7 @@ try: except ModuleNotFoundError as exc: path = Path(__file__).resolve() print(f"Module '{exc.name}' not found.") - print(" Try 'make check-venv' from your build directory,") - print(" and then one way to run this script is like so:") + print(" Try running this script like so:") print(f' > $builddir/run "{path}"') sys.exit(1)
Signature · 1 line
2.52.0
PATCH v6 13/16 tests: replace check-venv with vm-venv target
In reply to John SnowWith the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, we do not need the explicit "check-venv" target.
...However, to facilitate running VM tests without running configure, we move some of the former logic into tests/vm/Makefile.include to create a new venv (vm-venv) on-demand when running VM tests from the source tree.
--- tests/Makefile.include | 22 ++-------------------- tests/vm/Makefile.include | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 24 deletions(-)
tests/Makefile.include +2 -20
@@ -21,7 +21,6 @@ ifneq ($(filter $(all-check-targets), check-softfloat),) endif @echo @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" - @echo " $(MAKE) check-venv Creates a Python venv for tests" @echo " $(MAKE) check-clean Clean the tests and related data" @echo @echo "The following are useful for CI builds"
@@ -92,33 +91,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) $< tooling 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
tests/vm/Makefile.include +14 -4
@@ -2,13 +2,23 @@ # Hack to allow running in an unconfigured build tree ifeq ($(realpath $(SRC_PATH)),$(realpath .)) -VM_PYTHON = PYTHONPATH=$(SRC_PATH)/python /usr/bin/env python3 -VM_VENV = +VM_PYTHON = $(SRC_PATH)/vm-venv/bin/python3 +VM_VENV = vm-venv else VM_PYTHON = $(PYTHON) -VM_VENV = check-venv +VM_VENV = endif +VM_VENV_TOKEN=$(SRC_PATH)/vm-venv/tooling.group $(SRC_PATH)/vm-venv/functests.group + +$(VM_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml + /usr/bin/env python3 $(SRC_PATH)/python/scripts/mkvenv.py create vm-venv + $(SRC_PATH)/vm-venv/bin/python3 $(SRC_PATH)/python/scripts/mkvenv.py ensuregroup --online $(SRC_PATH)/pythondeps.toml tooling functests + +.PHONY: vm-venv +vm-venv: $(VM_VENV_TOKEN) +# end hackery + .PHONY: vm-build-all vm-clean-all EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)
@@ -102,7 +112,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(if $(LOG_CONSOLE),--log-console) \ --source-path $(SRC_PATH) \ --image "$@" \ - $(if $(filter-out check-venv, $?), --force) \ + --force \ --build-image $@, \ " VM-IMAGE $*")
Signature · 1 line
2.52.0
Re: [PATCH v6 13/16] tests: replace check-venv with vm-venv target
Quoted 71 lines · John Snow
With the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, we do not need the explicit "check-venv" target.
...However, to facilitate running VM tests without running configure, we move some of the former logic into tests/vm/Makefile.include to create a new venv (vm-venv) on-demand when running VM tests from the source tree.
Signed-off-by John Snow <[email protected]>--- tests/Makefile.include | 22 ++-------------------- tests/vm/Makefile.include | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 24 deletions(-)tests/Makefile.include +2
-20@@ -21,7 +21,6 @@ ifneq ($(filter $(all-check-targets), check-softfloat),) endif @echo @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" - @echo " $(MAKE) check-venv Creates a Python venv for tests" @echo " $(MAKE) check-clean Clean the tests and related data" @echo @echo "The following are useful for CI builds"@@ -92,33 +91,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) $< tooling 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-quicktests/vm/Makefile.include +0
-1@@ -2,13 +2,23 @@ # Hack to allow running in an unconfigured build tree ifeq ($(realpath $(SRC_PATH)),$(realpath .)) -VM_PYTHON = PYTHONPATH=$(SRC_PATH)/python /usr/bin/env python3
tests/vm/Makefile.include line 12
Quoted 10 lines
tests/vm/Makefile.include +4
-2-VM_VENV = +VM_PYTHON = $(SRC_PATH)/vm-venv/bin/python3 +VM_VENV = vm-venv else VM_PYTHON = $(PYTHON) -VM_VENV = check-venv +VM_VENV = endif +VM_VENV_TOKEN=$(SRC_PATH)/vm-venv/tooling.group $(SRC_PATH)/vm-venv/functests.group
Which group should the following be fixed in?
make vm-build-openbsd V=1
leads too:
DEBUG:root:ssh_cmd: ssh -t -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=1 -p 34187 -i /home/alex/lsrc/qemu.git/vm-test-0fzv014h.tmp/id_rsa -o IdentitiesOnly=yes -o SendEnv=https_proxy -o SendEnv=http_proxy -o SendEnv=ftp_proxy -o SendEnv=no_proxy [email protected] set -e; rm -rf /home/qemu/qemu-test.* cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); mkdir src build; cd src; tar -xf /dev/rsd1c; cd ../build; ../src/configure --cc=cc --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib ; gmake --output-sync -j16 all check V=1; Warning: Permanently added '[127.0.0.1]:34187' (ED25519) to the list of known hosts. python determined to be '/usr/local/bin/python3' python version: Python 3.12.11 mkvenv: Creating non-isolated virtual environment at 'pyvenv' mkvenv: checking for meson>=1.5.0 mkvenv: checking for pycotap>=1.1.0 mkvenv: checking for qemu.qmp>=0.0.5 mkvenv: installing meson==1.10.0, pycotap==1.3.1, qemu.qmp==0.0.5 mkvenv: installing /home/qemu/qemu-test.lk7TCA/src/python ERROR: Exception: Traceback (most recent call last): File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 106, in _run_wrapper status = _inner_run() ^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 97, in _inner_run return self.run(options, args) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper return func(self, options, args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/commands/install.py", line 386, in run requirement_set = resolver.resolve( ^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 76, in resolve collected = self.factory.collect_root_requirements(root_reqs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 545, in collect_root_requirements reqs = list( ^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 501, in _make_requirements_from_install_req cand = self._make_base_candidate_from_link( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 212, in _make_base_candidate_from_link self._editable_candidate_cache[link] = EditableCandidate( ^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 329, in __init__ super().__init__( File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 159, in __init__ self.dist = self._prepare() ^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 236, in _prepare dist = self._prepare_distribution() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 339, in _prepare_distribution return self._factory.preparer.prepare_editable_requirement(self._ireq) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/operations/prepare.py", line 698, in prepare_editable_requirement dist = _get_prepared_distribution( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/operations/prepare.py", line 72, in _get_prepared_distribution abstract_dist.prepare_distribution_metadata( File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/distributions/sdist.py", line 69, in prepare_distribution_metadata self.req.prepare_metadata() File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/req/req_install.py", line 567, in prepare_metadata and self.supports_pyproject_editable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/functools.py", line 998, in __get__ val = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/req/req_install.py", line 258, in supports_pyproject_editable return "build_editable" in self.pep517_backend._supported_features() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 180, in _supported_features return self._call_hook("_supported_features", {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 402, in _call_hook raise BackendUnavailable( pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'setuptools.build_meta' mkvenv did not complete successfully: Traceback (most recent call last): File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 965, in main ensure_group( File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 859, in ensure_group result = _do_ensure(to_install, online, wheels_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 801, in _do_ensure pip_install( File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 689, in pip_install subprocess.run( File "/usr/local/lib/python3.12/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/home/qemu/qemu-test.lk7TCA/build/pyvenv/bin/python3', '-m', 'pip', 'install', '--disable-pip-version-check', '-q', '--no-index', '--find-links', '/home/qemu/qemu-test.lk7TCA/src/python/wheels', '--no-build-isolation', '-e', '/home/qemu/qemu-test.lk7TCA/src/python']' returned non-zero exit status 2. Connection to 127.0.0.1 closed. DEBUG:qemu.machine.machine:Shutting down VM appliance; timeout=90 DEBUG:qemu.machine.machine:Attempting graceful termination DEBUG:qemu.machine.machine:Closing console socket DEBUG:qemu.machine.machine:Politely asking QEMU to terminate DEBUG:qemu.qmp.protocol.7f9dfba48ec0:--> { "execute": "quit" } DEBUG:qemu.qmp.protocol.7f9dfba48ec0:<-- { "timestamp": { "seconds": 1770671483, "microseconds": 668804 }, "event": "NIC_RX_FILTER_CHANGED", "data": { "path": "/machine/peripheral-anon/device[0]/virtio-backend" } } DEBUG:qemu.qmp.protocol.7f9dfba48ec0:<-- { "timestamp": { "seconds": 1770671497, "microseconds": 530684 }, "event": "SHUTDOWN", "data": { "guest": false, "reason": "host-qmp-quit" } } DEBUG:qemu.qmp.protocol.7f9dfba48ec0:<-- { "return": {} } INFO:qemu.qmp.protocol.7f9dfba48ec0:Task.Reader: EOFError DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Reader: failure: | Traceback (most recent call last): | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 914, in _bh_loop_forever | await async_fn() | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 952, in _bh_recv_message | msg = await self._recv() | ^^^^^^^^^^^^^^^^^^ | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 1053, in _recv | message = await self._do_recv() | ^^^^^^^^^^^^^^^^^^^^^ | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/qmp_client.py", line 459, in _do_recv | msg_bytes = await self._readline() | ^^^^^^^^^^^^^^^^^^^^^^ | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 1021, in _readline | raise EOFError | EOFError
DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Transitioning from 'Runstate.RUNNING' to 'Runstate.DISCONNECTING'. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Scheduling disconnect. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Reader: exiting. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Cancelling writer task. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Waiting for tasks to complete ... DEBUG:qemu.qmp.protocol.7f9dfba48ec0:disconnect() called. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Writer: cancelled. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Writer: exiting. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Closing StreamWriter. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Waiting for StreamWriter to close ... DEBUG:qemu.qmp.protocol.7f9dfba48ec0:StreamWriter closed. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Disconnected. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:QMP Disconnected. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Transitioning from 'Runstate.DISCONNECTING' to 'Runstate.IDLE'. DEBUG:qemu.machine.machine:Waiting (timeout=90) for QEMU process (pid=2646179) to terminate DEBUG:qemu.machine.machine:Cleaning up after VM process
make: *** [tests/vm/Makefile.include:121: vm-build-openbsd] Error 3
Hmm maybe that failure is in the build itself...
Quoted 20 lines
tests/vm/Makefile.include +10
-1+ +$(VM_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml + /usr/bin/env python3 $(SRC_PATH)/python/scripts/mkvenv.py create vm-venv + $(SRC_PATH)/vm-venv/bin/python3 $(SRC_PATH)/python/scripts/mkvenv.py ensuregroup --online $(SRC_PATH)/pythondeps.toml tooling functests + +.PHONY: vm-venv +vm-venv: $(VM_VENV_TOKEN) +# end hackery + .PHONY: vm-build-all vm-clean-all EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)@@ -102,7 +112,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(if $(LOG_CONSOLE),--log-console) \ --source-path $(SRC_PATH) \ --image "$@" \ - $(if $(filter-out check-venv, $?), --force) \ + --force \ --build-image $@, \ " VM-IMAGE $*")
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH v6 13/16] tests: replace check-venv with vm-venv target
Quoted 264 lines · Alex Bennée
Quoted 71 lines · John Snow
With the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, we do not need the explicit "check-venv" target.
...However, to facilitate running VM tests without running configure, we move some of the former logic into tests/vm/Makefile.include to create a new venv (vm-venv) on-demand when running VM tests from the source tree.
Signed-off-by John Snow <[email protected]>--- tests/Makefile.include | 22 ++-------------------- tests/vm/Makefile.include | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 24 deletions(-)tests/Makefile.include +2
-20@@ -21,7 +21,6 @@ ifneq ($(filter $(all-check-targets), check-softfloat),) endif @echo @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" - @echo " $(MAKE) check-venv Creates a Python venv for tests" @echo " $(MAKE) check-clean Clean the tests and related data" @echo @echo "The following are useful for CI builds"@@ -92,33 +91,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) $< tooling 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-quicktests/vm/Makefile.include +0
-1@@ -2,13 +2,23 @@ # Hack to allow running in an unconfigured build tree ifeq ($(realpath $(SRC_PATH)),$(realpath .)) -VM_PYTHON = PYTHONPATH=$(SRC_PATH)/python /usr/bin/env python3tests/vm/Makefile.include line 12
Quoted 10 lines
tests/vm/Makefile.include +4
-2-VM_VENV = +VM_PYTHON = $(SRC_PATH)/vm-venv/bin/python3 +VM_VENV = vm-venv else VM_PYTHON = $(PYTHON) -VM_VENV = check-venv +VM_VENV = endif +VM_VENV_TOKEN=$(SRC_PATH)/vm-venv/tooling.group $(SRC_PATH)/vm-venv/functests.groupWhich group should the following be fixed in?
make vm-build-openbsd V=1
leads too:
DEBUG:root:ssh_cmd: ssh -t -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=1 -p 34187 -i /home/alex/lsrc/qemu.git/vm-test-0fzv014h.tmp/id_rsa -o IdentitiesOnly=yes -o SendEnv=https_proxy -o SendEnv=http_proxy -o SendEnv=ftp_proxy -o SendEnv=no_proxy [email protected] set -e; rm -rf /home/qemu/qemu-test.* cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); mkdir src build; cd src; tar -xf /dev/rsd1c; cd ../build; ../src/configure --cc=cc --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib ; gmake --output-sync -j16 all check V=1; Warning: Permanently added '[127.0.0.1]:34187' (ED25519) to the list of known hosts. python determined to be '/usr/local/bin/python3' python version: Python 3.12.11 mkvenv: Creating non-isolated virtual environment at 'pyvenv' mkvenv: checking for meson>=1.5.0 mkvenv: checking for pycotap>=1.1.0 mkvenv: checking for qemu.qmp>=0.0.5 mkvenv: installing meson==1.10.0, pycotap==1.3.1, qemu.qmp==0.0.5 mkvenv: installing /home/qemu/qemu-test.lk7TCA/src/python ERROR: Exception: Traceback (most recent call last): File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 106, in _run_wrapper status = _inner_run() ^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 97, in _inner_run return self.run(options, args) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper return func(self, options, args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/commands/install.py", line 386, in run requirement_set = resolver.resolve( ^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 76, in resolve collected = self.factory.collect_root_requirements(root_reqs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 545, in collect_root_requirements reqs = list( ^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 501, in _make_requirements_from_install_req cand = self._make_base_candidate_from_link( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 212, in _make_base_candidate_from_link self._editable_candidate_cache[link] = EditableCandidate( ^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 329, in __init__ super().__init__( File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 159, in __init__ self.dist = self._prepare() ^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 236, in _prepare dist = self._prepare_distribution() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 339, in _prepare_distribution return self._factory.preparer.prepare_editable_requirement(self._ireq) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/operations/prepare.py", line 698, in prepare_editable_requirement dist = _get_prepared_distribution( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/operations/prepare.py", line 72, in _get_prepared_distribution abstract_dist.prepare_distribution_metadata( File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/distributions/sdist.py", line 69, in prepare_distribution_metadata self.req.prepare_metadata() File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/req/req_install.py", line 567, in prepare_metadata and self.supports_pyproject_editable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/functools.py", line 998, in __get__ val = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_internal/req/req_install.py", line 258, in supports_pyproject_editable return "build_editable" in self.pep517_backend._supported_features() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 180, in _supported_features return self._call_hook("_supported_features", {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/build/pyvenv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 402, in _call_hook raise BackendUnavailable( pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'setuptools.build_meta' mkvenv did not complete successfully: Traceback (most recent call last): File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 965, in main ensure_group( File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 859, in ensure_group result = _do_ensure(to_install, online, wheels_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 801, in _do_ensure pip_install( File "/home/qemu/qemu-test.lk7TCA/src/python/scripts/mkvenv.py", line 689, in pip_install subprocess.run( File "/usr/local/lib/python3.12/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/home/qemu/qemu-test.lk7TCA/build/pyvenv/bin/python3', '-m', 'pip', 'install', '--disable-pip-version-check', '-q', '--no-index', '--find-links', '/home/qemu/qemu-test.lk7TCA/src/python/wheels', '--no-build-isolation', '-e', '/home/qemu/qemu-test.lk7TCA/src/python']' returned non-zero exit status 2. Connection to 127.0.0.1 closed. DEBUG:qemu.machine.machine:Shutting down VM appliance; timeout=90 DEBUG:qemu.machine.machine:Attempting graceful termination DEBUG:qemu.machine.machine:Closing console socket DEBUG:qemu.machine.machine:Politely asking QEMU to terminate DEBUG:qemu.qmp.protocol.7f9dfba48ec0:--> { "execute": "quit" } DEBUG:qemu.qmp.protocol.7f9dfba48ec0:<-- { "timestamp": { "seconds": 1770671483, "microseconds": 668804 }, "event": "NIC_RX_FILTER_CHANGED", "data": { "path": "/machine/peripheral-anon/device[0]/virtio-backend" } } DEBUG:qemu.qmp.protocol.7f9dfba48ec0:<-- { "timestamp": { "seconds": 1770671497, "microseconds": 530684 }, "event": "SHUTDOWN", "data": { "guest": false, "reason": "host-qmp-quit" } } DEBUG:qemu.qmp.protocol.7f9dfba48ec0:<-- { "return": {} } INFO:qemu.qmp.protocol.7f9dfba48ec0:Task.Reader: EOFError DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Reader: failure: | Traceback (most recent call last): | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 914, in _bh_loop_forever | await async_fn() | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 952, in _bh_recv_message | msg = await self._recv() | ^^^^^^^^^^^^^^^^^^ | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 1053, in _recv | message = await self._do_recv() | ^^^^^^^^^^^^^^^^^^^^^ | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/qmp_client.py", line 459, in _do_recv | msg_bytes = await self._readline() | ^^^^^^^^^^^^^^^^^^^^^^ | File "/home/alex/lsrc/qemu.git/vm-venv/lib/python3.13/site-packages/qemu/qmp/protocol.py", line 1021, in _readline | raise EOFError | EOFErrorDEBUG:qemu.qmp.protocol.7f9dfba48ec0:Transitioning from 'Runstate.RUNNING' to 'Runstate.DISCONNECTING'. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Scheduling disconnect. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Reader: exiting. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Cancelling writer task. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Waiting for tasks to complete ... DEBUG:qemu.qmp.protocol.7f9dfba48ec0:disconnect() called. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Writer: cancelled. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Task.Writer: exiting. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Closing StreamWriter. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Waiting for StreamWriter to close ... DEBUG:qemu.qmp.protocol.7f9dfba48ec0:StreamWriter closed. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Disconnected. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:QMP Disconnected. DEBUG:qemu.qmp.protocol.7f9dfba48ec0:Transitioning from 'Runstate.DISCONNECTING' to 'Runstate.IDLE'. DEBUG:qemu.machine.machine:Waiting (timeout=90) for QEMU process (pid=2646179) to terminate DEBUG:qemu.machine.machine:Cleaning up after VM process
make: *** [tests/vm/Makefile.include:121: vm-build-openbsd] Error 3Hmm maybe that failure is in the build itself...
Quoted 11 lines
tests/vm/Makefile.include +9
-0+ +$(VM_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml + /usr/bin/env python3 $(SRC_PATH)/python/scripts/mkvenv.py create vm-venv + $(SRC_PATH)/vm-venv/bin/python3 $(SRC_PATH)/python/scripts/mkvenv.py ensuregroup --online $(SRC_PATH)/pythondeps.toml tooling functests + +.PHONY: vm-venv +vm-venv: $(VM_VENV_TOKEN) +# end hackery + .PHONY: vm-build-all vm-clean-all
Quoted 14 lines
tests/vm/Makefile.include $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ · line 117
Quoted 9 lines
tests/vm/Makefile.include +1
-1EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)@@ -102,7 +112,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(if $(LOG_CONSOLE),--log-console) \ --source-path $(SRC_PATH) \ --image "$@" \ - $(if $(filter-out check-venv, $?), --force) \ + --force \ --build-image $@, \ " VM-IMAGE $*")--
Alex Bennée
Virtualisation Tech Lead @ Linaro
Before patch:
vm-build-freebsd: OK
vm-build-openbsd: OK
vm-build-netbsd: fails
after patch **with recent upstream testing fix applied**:
vm-build-freebsd: OK
vm-build-openbsd: fails (!)
vm-build-netbsd: still fails.
... Oops! This is a genuine oversight, the openbsd package needs "py3-setuptools" added to its pkg list. I will correct that and do some more testing.
PATCH v6 14/16 scripts: nudge users to use 'run' script for scripts that import qemu.qmp
In reply to John SnowNow that qmp has to be installed and isn't local, we can no longer offer a simple forwarder for these scripts (nor path hacks) and hope that it works. Encourage users to use the 'run' script to use these scripts instead.
--- scripts/compare-machine-types.py | 7 ++----- scripts/qmp/qemu-ga-client | 13 ++++++------- scripts/qmp/qmp-shell | 13 ++++++------- scripts/qmp/qmp-shell-wrap | 13 ++++++------- scripts/qmp/qom-fuse | 13 ++++++------- scripts/qmp/qom-get | 13 ++++++------- scripts/qmp/qom-list | 13 ++++++------- scripts/qmp/qom-set | 13 ++++++------- scripts/qmp/qom-tree | 13 ++++++------- scripts/qmp_helper.py | 9 ++------- scripts/render_block_graph.py | 10 +++++++--- scripts/simplebench/bench_block_job.py | 10 +++++++--- tests/migration-stress/guestperf/engine.py | 15 ++++++++++++--- 13 files changed, 78 insertions(+), 77 deletions(-)
scripts/compare-machine-types.py +2 -5
@@ -27,19 +27,16 @@ # along with this program; if not, see <http://www.gnu.org/licenses/>. import sys -from os import path from argparse import ArgumentParser, RawTextHelpFormatter, Namespace import pandas as pd from contextlib import ExitStack from typing import Optional, List, Dict, Generator, Tuple, Union, Any, Set try: - qemu_dir = path.abspath(path.dirname(path.dirname(__file__))) - sys.path.append(path.join(qemu_dir, 'python')) from qemu.machine import QEMUMachine except ModuleNotFoundError as exc: - print(f"Module '{exc.name}' not found.") - print("Try export PYTHONPATH=top-qemu-dir/python or run from top-qemu-dir") + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) sys.exit(1)
scripts/qmp/qemu-ga-client +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils import qemu_ga_client - - -if __name__ == '__main__': - sys.exit(qemu_ga_client.main()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qemu-ga-client [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qmp-shell +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.qmp import qmp_shell - - -if __name__ == '__main__': - qmp_shell.main() +print( + "This script has moved; after running configure," + " please use '$builddir/run qmp-shell [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qmp-shell-wrap +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.qmp import qmp_shell - - -if __name__ == '__main__': - qmp_shell.main_wrap() +print( + "This script has moved; after running configure," + " please use '$builddir/run qmp-shell-wrap [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-fuse +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom_fuse import QOMFuse - - -if __name__ == '__main__': - sys.exit(QOMFuse.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-fuse [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-get +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMGet - - -if __name__ == '__main__': - sys.exit(QOMGet.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-get [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-list +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMList - - -if __name__ == '__main__': - sys.exit(QOMList.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-list [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-set +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMSet - - -if __name__ == '__main__': - sys.exit(QOMSet.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-set [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp/qom-tree +6 -7
@@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.utils.qom import QOMTree - - -if __name__ == '__main__': - sys.exit(QOMTree.entry_point()) +print( + "This script has moved; after running configure," + " please use '$builddir/run qom-tree [...]' instead.", + file=sys.stderr +) +sys.exit(1)
scripts/qmp_helper.py +2 -7
@@ -13,17 +13,12 @@ import sys from datetime import datetime -from os import path as os_path try: - qemu_dir = os_path.abspath(os_path.dirname(os_path.dirname(__file__))) - sys.path.append(os_path.join(qemu_dir, 'python')) - from qemu.qmp.legacy import QEMUMonitorProtocol - except ModuleNotFoundError as exc: - print(f"Module '{exc.name}' not found.") - print("Try export PYTHONPATH=top-qemu-dir/python or run from top-qemu-dir") + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) sys.exit(1) from base64 import b64encode
scripts/render_block_graph.py +7 -3
@@ -24,9 +24,13 @@ import json from graphviz import Digraph -sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python')) -from qemu.qmp import QMPError -from qemu.qmp.legacy import QEMUMonitorProtocol +try: + from qemu.qmp import QMPError + from qemu.qmp.legacy import QEMUMonitorProtocol +except ModuleNotFoundError as exc: + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) + sys.exit(1) def perm(arr):
scripts/simplebench/bench_block_job.py +7 -3
@@ -25,9 +25,13 @@ import socket import json -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) -from qemu.machine import QEMUMachine -from qemu.qmp import ConnectError +try: + from qemu.machine import QEMUMachine + from qemu.qmp import ConnectError +except ModuleNotFoundError as exc: + print(f"Module '{exc.name}' not found.", file=sys.stderr) + print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr) + sys.exit(1) def bench_block_job(cmd, cmd_args, qemu_args):
tests/migration-stress/guestperf/engine.py +12 -3
@@ -27,9 +27,18 @@ from guestperf.report import Report, ReportResult from guestperf.timings import TimingRecord, Timings -sys.path.append(os.path.join(os.path.dirname(__file__), - '..', '..', '..', 'python')) -from qemu.machine import QEMUMachine +try: + from qemu.machine import QEMUMachine +except ModuleNotFoundError as exc: + print( + f"Module '{exc.name}' not found.\n" + "It should be installed as part of the configure-time " + "virtual environment in $builddir/pyvenv.\n" + "Try re-running this script as:\n" + f"> $builddir/run {' '.join(sys.argv)}", + file=sys.stderr + ) + sys.exit(1) # multifd supported compression algorithms MULTIFD_CMP_ALGS = ("zlib", "zstd", "qpl", "uadk")
Signature · 1 line
2.52.0
PATCH v6 15/16 python: delete qemu.qmp
In reply to John SnowStart relying on the external python-qemu-qmp dependency instead, to prevent desync between the internal and external libraries.
This library is now entirely independent; to contribute changes, see
https://gitlab.com/qemu-project/python-qemu-qmp/
--- 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.52.0
Part of the diff is not shown here. View the raw message.
PATCH v6 16/16 python: update README.rst to reflect qemu.qmp's removal
In reply to John SnowIt is no longer simply possible to just use this directory as if it were an installed package now that it has dependencies, so update the README to reflect this.
--- python/README.rst | 52 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-)
python/README.rst +45 -7
@@ -3,7 +3,17 @@ QEMU Python Tooling This directory houses Python tooling used by the QEMU project to build, configure, and test QEMU. It is organized by namespace (``qemu``), and -then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc). +then by package (e.g. ``qemu/machine``, ``qemu/utils``, etc). + +These tools and libraries are installed to the QEMU configure-time +Python virtual environment by default (see qemu.git/pythondeps.toml +"tooling" group), and are available for use by any Python script +executed by the build system. To have these libraries available for +manual invocations of scripts, use of the "run" script in your build +directory is recommended. + +General structure +----------------- ``setup.py`` is used by ``pip`` to install this tooling to the current environment. ``setup.cfg`` provides the packaging configuration used by
@@ -20,9 +30,9 @@ environment. ``setup.cfg`` provides the packaging configuration used by If you append the ``--editable`` or ``-e`` argument to either invocation above, pip will install in "editable" mode. This installs the package as -a forwarder ("qemu.egg-link") that points to the source tree. In so -doing, the installed package always reflects the latest version in your -source tree. +a forwarder that points to the source tree. In so doing, the installed +package always reflects the latest version in your source tree. This is +the mode used to install these packages at configure time. Installing ".[devel]" instead of "." will additionally pull in required packages for testing this package. They are not runtime requirements,
@@ -40,8 +50,18 @@ for more information. Using these packages without installing them -------------------------------------------- -These packages may be used without installing them first, by using one -of two tricks: +It is no longer recommended to try to use these packages without +installing them to a virtual environment, but depending on your use +case, it may still be possible to do. + +The "qemu.qmp" library is now hosted outside of the qemu.git repository, +and the "qemu.machine" library that remains in-tree here has qemu.qmp as +a dependency. It is possible to install "qemu.qmp" independently and +then use the rest of these packages without installing them, but be +advised that if future dependencies are introduced, bypassing the +installation phase may introduce breakages to your script in the future. + +That said, you can use these packages without installing them by either: 1. Set your PYTHONPATH environment variable to include this source directory, e.g. ``~/src/qemu/python``. See
@@ -61,8 +81,26 @@ invoke them without installation, you can invoke e.g.: ``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell`` +**It is strongly advised to just use the configure-time venv instead.** +After running configure, simply use the run script available in the QEMU +build directory: + +``> $builddir/run qmp-shell`` + The mappings between console script name and python module path can be -found in ``setup.cfg``. +found in ``setup.cfg``, but the console scripts available are listed +here for reference: + +* ``qemu-ga-client`` +* ``qmp-shell`` +* ``qmp-shell-wrap`` +* ``qmp-tui`` (prototype urwid interface for async QMP) +* ``qom`` +* ``qom-fuse`` (requires fusepy to be installed!) +* ``qom-get`` +* ``qom-list`` +* ``qom-set`` +* ``qom-tree`` Files in this directory
Signature · 1 line
2.52.0