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 <jsnow@redhat.com>
---
tests/Makefile.include | 22 ++--------------------
tests/vm/Makefile.include | 18 ++++++++++++++----
2 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index f28c9e329aa..2a203e23718 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -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
diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index 14188bba1c6..217bc706c20 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -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 $*")
--
2.52.0
John Snow <jsnow@redhat.com> writes:
> 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 <jsnow@redhat.com>
> ---
> tests/Makefile.include | 22 ++--------------------
> tests/vm/Makefile.include | 18 ++++++++++++++----
> 2 files changed, 16 insertions(+), 24 deletions(-)
>
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index f28c9e329aa..2a203e23718 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -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
> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
> index 14188bba1c6..217bc706c20 100644
> --- a/tests/vm/Makefile.include
> +++ b/tests/vm/Makefile.include
> @@ -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
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 qemu@127.0.0.1
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...
> +
> +$(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 $*")
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
© 2016 - 2026 Red Hat, Inc.