aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-07-14 18:09:09 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-07-14 18:09:09 +0100
commita9649a719a44894b81f38dc1c5c1888ee684acef (patch)
tree05a7ed7f571035cd2637cc0ce5ae9722de6468aa /python
parent1f966c7c11bbe77f3de5f50911de7c3a74594bfe (diff)
parentc4e2d499c94fb7d6ea43d28e2613559861ef5d79 (diff)
downloadqemu-a9649a719a44894b81f38dc1c5c1888ee684acef.zip
qemu-a9649a719a44894b81f38dc1c5c1888ee684acef.tar.gz
qemu-a9649a719a44894b81f38dc1c5c1888ee684acef.tar.bz2
Merge remote-tracking branch 'remotes/cleber-gitlab/tags/python-next-pull-request' into staging
Python and Acceptance Tests - New SMMUv3 and Intel IOMMU tests - Respect "cpu" tags and reduce boiler plate code - Improved logging of qemu execution output - Other misc improvements # gpg: Signature made Tue 13 Jul 2021 22:11:36 BST # gpg: using RSA key 7ABB96EB8B46B94D5E0FE9BB657E8D33A5F209F3 # gpg: Good signature from "Cleber Rosa <crosa@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 7ABB 96EB 8B46 B94D 5E0F E9BB 657E 8D33 A5F2 09F3 * remotes/cleber-gitlab/tags/python-next-pull-request: (23 commits) tests/acceptance/cpu_queries.py: use the proper logging channels tests/acceptance/linux_ssh_mips_malta.py: drop identical setUp Acceptance tests: do not try to reuse packages from the system python: Configure tox to skip missing interpreters tests/acceptance: Handle cpu tag on x86_cpu_model_versions tests tests/acceptance: Add set_vm_arg() to the Test class python/qemu: Add args property to the QEMUMachine class tests/acceptance: Tagging tests with "cpu:VALUE" tests/acceptance: Let the framework handle "cpu:VALUE" tagged tests tests/acceptance: Fix mismatch on cpu tagged tests tests/acceptance: Automatic set -cpu to the test vm tests/acceptance: Tag NetBSD tests as 'os:netbsd' avocado_qemu: Add Intel iommu tests avocado_qemu: Add SMMUv3 tests Acceptance Tests: Add default kernel params and pxeboot url to the KNOWN_DISTROS collection avocado_qemu: Fix KNOWN_DISTROS map into the LinuxDistro class tests/acceptance: Ignore binary data sent on serial console Acceptance Tests: support choosing specific distro and version Acceptance Tests: move definition of distro checksums to the framework Acceptance Tests: rename attribute holding the distro image checksum ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'python')
-rw-r--r--python/Makefile5
-rw-r--r--python/qemu/machine/machine.py22
-rw-r--r--python/setup.cfg1
3 files changed, 24 insertions, 4 deletions
diff --git a/python/Makefile b/python/Makefile
index ac46ae3..fe27a3e 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -1,4 +1,5 @@
QEMU_VENV_DIR=.dev-venv
+QEMU_TOX_EXTRA_ARGS ?=
.PHONY: help
help:
@@ -15,6 +16,8 @@ help:
@echo " These tests use the newest dependencies."
@echo " Requires: Python 3.6 - 3.10, and tox."
@echo " Hint (Fedora): 'sudo dnf install python3-tox python3.10'"
+ @echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra"
+ @echo " arguments to tox".
@echo ""
@echo "make check-dev:"
@echo " Run tests in a venv against your default python3 version."
@@ -87,7 +90,7 @@ check:
.PHONY: check-tox
check-tox:
- @tox
+ @tox $(QEMU_TOX_EXTRA_ARGS)
.PHONY: clean
clean:
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index d47ab3d..971ed7e 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -96,7 +96,8 @@ class QEMUMachine:
socket_scm_helper: Optional[str] = None,
sock_dir: Optional[str] = None,
drain_console: bool = False,
- console_log: Optional[str] = None):
+ console_log: Optional[str] = None,
+ log_dir: Optional[str] = None):
'''
Initialize a QEMUMachine
@@ -110,6 +111,7 @@ class QEMUMachine:
@param sock_dir: where to create socket (defaults to base_temp_dir)
@param drain_console: (optional) True to drain console socket to buffer
@param console_log: (optional) path to console log file
+ @param log_dir: where to create and keep log files
@note: Qemu process is not started until launch() is used.
'''
# pylint: disable=too-many-arguments
@@ -123,6 +125,7 @@ class QEMUMachine:
self._name = name or "qemu-%d" % os.getpid()
self._base_temp_dir = base_temp_dir
self._sock_dir = sock_dir or self._base_temp_dir
+ self._log_dir = log_dir
self._socket_scm_helper = socket_scm_helper
if monitor_address is not None:
@@ -313,9 +316,12 @@ class QEMUMachine:
args.extend(['-device', device])
return args
- def _pre_launch(self) -> None:
- self._qemu_log_path = os.path.join(self.temp_dir, self._name + ".log")
+ @property
+ def args(self) -> List[str]:
+ """Returns the list of arguments given to the QEMU binary."""
+ return self._args
+ def _pre_launch(self) -> None:
if self._console_set:
self._remove_files.append(self._console_address)
@@ -332,6 +338,7 @@ class QEMUMachine:
# NOTE: Make sure any opened resources are *definitely* freed in
# _post_shutdown()!
# pylint: disable=consider-using-with
+ self._qemu_log_path = os.path.join(self.log_dir, self._name + ".log")
self._qemu_log_file = open(self._qemu_log_path, 'wb')
def _post_launch(self) -> None:
@@ -770,3 +777,12 @@ class QEMUMachine:
self._temp_dir = tempfile.mkdtemp(prefix="qemu-machine-",
dir=self._base_temp_dir)
return self._temp_dir
+
+ @property
+ def log_dir(self) -> str:
+ """
+ Returns a directory to be used for writing logs
+ """
+ if self._log_dir is None:
+ return self.temp_dir
+ return self._log_dir
diff --git a/python/setup.cfg b/python/setup.cfg
index 11f71d5..14bab90 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -121,6 +121,7 @@ multi_line_output=3
[tox:tox]
envlist = py36, py37, py38, py39, py310
+skip_missing_interpreters = true
[testenv]
allowlist_externals = make