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 -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEeruW64tGuU1eD+m7ZX6NM6XyCfMFAmDuAYgACgkQZX6NM6Xy CfNdzhAAq1EN78aKeUhRDQukBm1y5zJuxNMwlLHqrRg/z7pML9A9lsMVZtkfVUuM rDxOsLArEfvOw1YksyKg7zYUtDjXTTKfwS0JC5HLiAjEd9/sUiTMZQPNjpfZtvT0 wQt1n1OOm5oQzWAAHyya+R5B7PlZubF1dj79HgdPym4kSHP3/EkwbRKhDQwKGcWT Ddl38nuCXG31u8HHU6hLllv+m9e8jxhdEN3cCjb9fYffprNoVaj9oRZ4uoDITlM+ f/D37vb4GmWi92dwrtxsCWWTGLr1W0TZGS5EWhj5lg294b/MJ10rbSgnIjxVSzvI cuJxGPXfXZhXcFA6K0imXvRFfpkCjAfNTlI2ccngCrUXmrTh386PNxhe8gBKsZko o4HBaNTkSSG/xZssmxuk8eCxzdxNmWeew7ZgJV15cgo8//8Vvn9UxbtueBdkzcZN 5ofY+NpgHQpImiq4cDaT2Eokw4AueAOrXceE5Do57Dtyl6+y8UZG7aTWHxqx+6tq wsZflHTPaIBDY9nxzr3K0zB6RBSHG/X7BNewrMobcQ10FLOUiMC1twUq4jfEo3qN kf42peIER2pzRHifLeJCsCNecQpVr6tCIfDAE/TXs82HDSeI1vVFR7GeoRaFpLLk jVx4UqD178ejSt5GXvNipR/PaOha1ZlojZoVPoHFptjS3nE2prs= =25zZ -----END PGP SIGNATURE----- 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>
This commit is contained in:
commit
a9649a719a
@ -43,6 +43,7 @@ check-python-tox:
|
|||||||
- make -C python check-tox
|
- make -C python check-tox
|
||||||
variables:
|
variables:
|
||||||
GIT_DEPTH: 1
|
GIT_DEPTH: 1
|
||||||
|
QEMU_TOX_EXTRA_ARGS: --skip-missing-interpreters=false
|
||||||
needs:
|
needs:
|
||||||
job: python-container
|
job: python-container
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
@ -171,6 +171,7 @@ L: qemu-arm@nongnu.org
|
|||||||
S: Maintained
|
S: Maintained
|
||||||
F: hw/arm/smmu*
|
F: hw/arm/smmu*
|
||||||
F: include/hw/arm/smmu*
|
F: include/hw/arm/smmu*
|
||||||
|
F: tests/acceptance/smmu.py
|
||||||
|
|
||||||
AVR TCG CPUs
|
AVR TCG CPUs
|
||||||
M: Michael Rolnik <mrolnik@gmail.com>
|
M: Michael Rolnik <mrolnik@gmail.com>
|
||||||
|
@ -904,6 +904,17 @@ name. If one is not given explicitly, it will either be set to
|
|||||||
``None``, or, if the test is tagged with one (and only one)
|
``None``, or, if the test is tagged with one (and only one)
|
||||||
``:avocado: tags=arch:VALUE`` tag, it will be set to ``VALUE``.
|
``:avocado: tags=arch:VALUE`` tag, it will be set to ``VALUE``.
|
||||||
|
|
||||||
|
cpu
|
||||||
|
~~~
|
||||||
|
|
||||||
|
The cpu model that will be set to all QEMUMachine instances created
|
||||||
|
by the test.
|
||||||
|
|
||||||
|
The ``cpu`` attribute will be set to the test parameter of the same
|
||||||
|
name. If one is not given explicitly, it will either be set to
|
||||||
|
``None ``, or, if the test is tagged with one (and only one)
|
||||||
|
``:avocado: tags=cpu:VALUE`` tag, it will be set to ``VALUE``.
|
||||||
|
|
||||||
machine
|
machine
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
@ -922,6 +933,39 @@ The preserved value of the ``qemu_bin`` parameter or the result of the
|
|||||||
dynamic probe for a QEMU binary in the current working directory or
|
dynamic probe for a QEMU binary in the current working directory or
|
||||||
source tree.
|
source tree.
|
||||||
|
|
||||||
|
LinuxTest
|
||||||
|
~~~~~~~~~
|
||||||
|
|
||||||
|
Besides the attributes present on the ``avocado_qemu.Test`` base
|
||||||
|
class, the ``avocado_qemu.LinuxTest`` adds the following attributes:
|
||||||
|
|
||||||
|
distro
|
||||||
|
......
|
||||||
|
|
||||||
|
The name of the Linux distribution used as the guest image for the
|
||||||
|
test. The name should match the **Provider** column on the list
|
||||||
|
of images supported by the avocado.utils.vmimage library:
|
||||||
|
|
||||||
|
https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmimage.html#supported-images
|
||||||
|
|
||||||
|
distro_version
|
||||||
|
..............
|
||||||
|
|
||||||
|
The version of the Linux distribution as the guest image for the
|
||||||
|
test. The name should match the **Version** column on the list
|
||||||
|
of images supported by the avocado.utils.vmimage library:
|
||||||
|
|
||||||
|
https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmimage.html#supported-images
|
||||||
|
|
||||||
|
distro_checksum
|
||||||
|
...............
|
||||||
|
|
||||||
|
The sha256 hash of the guest image file used for the test.
|
||||||
|
|
||||||
|
If this value is not set in the code or by a test parameter (with the
|
||||||
|
same name), no validation on the integrity of the image will be
|
||||||
|
performed.
|
||||||
|
|
||||||
Parameter reference
|
Parameter reference
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
@ -950,6 +994,12 @@ architecture of a kernel or disk image to boot a VM with.
|
|||||||
This parameter has a direct relation with the ``arch`` attribute. If
|
This parameter has a direct relation with the ``arch`` attribute. If
|
||||||
not given, it will default to None.
|
not given, it will default to None.
|
||||||
|
|
||||||
|
cpu
|
||||||
|
~~~
|
||||||
|
|
||||||
|
The cpu model that will be set to all QEMUMachine instances created
|
||||||
|
by the test.
|
||||||
|
|
||||||
machine
|
machine
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
@ -962,6 +1012,38 @@ qemu_bin
|
|||||||
|
|
||||||
The exact QEMU binary to be used on QEMUMachine.
|
The exact QEMU binary to be used on QEMUMachine.
|
||||||
|
|
||||||
|
LinuxTest
|
||||||
|
~~~~~~~~~
|
||||||
|
|
||||||
|
Besides the parameters present on the ``avocado_qemu.Test`` base
|
||||||
|
class, the ``avocado_qemu.LinuxTest`` adds the following parameters:
|
||||||
|
|
||||||
|
distro
|
||||||
|
......
|
||||||
|
|
||||||
|
The name of the Linux distribution used as the guest image for the
|
||||||
|
test. The name should match the **Provider** column on the list
|
||||||
|
of images supported by the avocado.utils.vmimage library:
|
||||||
|
|
||||||
|
https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmimage.html#supported-images
|
||||||
|
|
||||||
|
distro_version
|
||||||
|
..............
|
||||||
|
|
||||||
|
The version of the Linux distribution as the guest image for the
|
||||||
|
test. The name should match the **Version** column on the list
|
||||||
|
of images supported by the avocado.utils.vmimage library:
|
||||||
|
|
||||||
|
https://avocado-framework.readthedocs.io/en/latest/guides/writer/libs/vmimage.html#supported-images
|
||||||
|
|
||||||
|
distro_checksum
|
||||||
|
...............
|
||||||
|
|
||||||
|
The sha256 hash of the guest image file used for the test.
|
||||||
|
|
||||||
|
If this value is not set in the code or by this parameter no
|
||||||
|
validation on the integrity of the image will be performed.
|
||||||
|
|
||||||
Skipping tests
|
Skipping tests
|
||||||
--------------
|
--------------
|
||||||
The Avocado framework provides Python decorators which allow for easily skip
|
The Avocado framework provides Python decorators which allow for easily skip
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
QEMU_VENV_DIR=.dev-venv
|
QEMU_VENV_DIR=.dev-venv
|
||||||
|
QEMU_TOX_EXTRA_ARGS ?=
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@ -15,6 +16,8 @@ help:
|
|||||||
@echo " These tests use the newest dependencies."
|
@echo " These tests use the newest dependencies."
|
||||||
@echo " Requires: Python 3.6 - 3.10, and tox."
|
@echo " Requires: Python 3.6 - 3.10, and tox."
|
||||||
@echo " Hint (Fedora): 'sudo dnf install python3-tox python3.10'"
|
@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 ""
|
||||||
@echo "make check-dev:"
|
@echo "make check-dev:"
|
||||||
@echo " Run tests in a venv against your default python3 version."
|
@echo " Run tests in a venv against your default python3 version."
|
||||||
@ -87,7 +90,7 @@ check:
|
|||||||
|
|
||||||
.PHONY: check-tox
|
.PHONY: check-tox
|
||||||
check-tox:
|
check-tox:
|
||||||
@tox
|
@tox $(QEMU_TOX_EXTRA_ARGS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -96,7 +96,8 @@ class QEMUMachine:
|
|||||||
socket_scm_helper: Optional[str] = None,
|
socket_scm_helper: Optional[str] = None,
|
||||||
sock_dir: Optional[str] = None,
|
sock_dir: Optional[str] = None,
|
||||||
drain_console: bool = False,
|
drain_console: bool = False,
|
||||||
console_log: Optional[str] = None):
|
console_log: Optional[str] = None,
|
||||||
|
log_dir: Optional[str] = None):
|
||||||
'''
|
'''
|
||||||
Initialize a QEMUMachine
|
Initialize a QEMUMachine
|
||||||
|
|
||||||
@ -110,6 +111,7 @@ class QEMUMachine:
|
|||||||
@param sock_dir: where to create socket (defaults to base_temp_dir)
|
@param sock_dir: where to create socket (defaults to base_temp_dir)
|
||||||
@param drain_console: (optional) True to drain console socket to buffer
|
@param drain_console: (optional) True to drain console socket to buffer
|
||||||
@param console_log: (optional) path to console log file
|
@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.
|
@note: Qemu process is not started until launch() is used.
|
||||||
'''
|
'''
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
@ -123,6 +125,7 @@ class QEMUMachine:
|
|||||||
self._name = name or "qemu-%d" % os.getpid()
|
self._name = name or "qemu-%d" % os.getpid()
|
||||||
self._base_temp_dir = base_temp_dir
|
self._base_temp_dir = base_temp_dir
|
||||||
self._sock_dir = sock_dir or self._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
|
self._socket_scm_helper = socket_scm_helper
|
||||||
|
|
||||||
if monitor_address is not None:
|
if monitor_address is not None:
|
||||||
@ -313,9 +316,12 @@ class QEMUMachine:
|
|||||||
args.extend(['-device', device])
|
args.extend(['-device', device])
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def _pre_launch(self) -> None:
|
@property
|
||||||
self._qemu_log_path = os.path.join(self.temp_dir, self._name + ".log")
|
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:
|
if self._console_set:
|
||||||
self._remove_files.append(self._console_address)
|
self._remove_files.append(self._console_address)
|
||||||
|
|
||||||
@ -332,6 +338,7 @@ class QEMUMachine:
|
|||||||
# NOTE: Make sure any opened resources are *definitely* freed in
|
# NOTE: Make sure any opened resources are *definitely* freed in
|
||||||
# _post_shutdown()!
|
# _post_shutdown()!
|
||||||
# pylint: disable=consider-using-with
|
# 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')
|
self._qemu_log_file = open(self._qemu_log_path, 'wb')
|
||||||
|
|
||||||
def _post_launch(self) -> None:
|
def _post_launch(self) -> None:
|
||||||
@ -770,3 +777,12 @@ class QEMUMachine:
|
|||||||
self._temp_dir = tempfile.mkdtemp(prefix="qemu-machine-",
|
self._temp_dir = tempfile.mkdtemp(prefix="qemu-machine-",
|
||||||
dir=self._base_temp_dir)
|
dir=self._base_temp_dir)
|
||||||
return self._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
|
||||||
|
@ -121,6 +121,7 @@ multi_line_output=3
|
|||||||
|
|
||||||
[tox:tox]
|
[tox:tox]
|
||||||
envlist = py36, py37, py38, py39, py310
|
envlist = py36, py37, py38, py39, py310
|
||||||
|
skip_missing_interpreters = true
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
allowlist_externals = make
|
allowlist_externals = make
|
||||||
|
@ -96,7 +96,7 @@ AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGETS)))
|
|||||||
|
|
||||||
$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
|
$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
|
||||||
$(call quiet-command, \
|
$(call quiet-command, \
|
||||||
$(PYTHON) -m venv --system-site-packages $@, \
|
$(PYTHON) -m venv $@, \
|
||||||
VENV, $@)
|
VENV, $@)
|
||||||
$(call quiet-command, \
|
$(call quiet-command, \
|
||||||
$(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
|
$(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
|
||||||
|
@ -86,14 +86,17 @@ def _console_interaction(test, success_message, failure_message,
|
|||||||
assert not keep_sending or send_string
|
assert not keep_sending or send_string
|
||||||
if vm is None:
|
if vm is None:
|
||||||
vm = test.vm
|
vm = test.vm
|
||||||
console = vm.console_socket.makefile()
|
console = vm.console_socket.makefile(mode='rb', encoding='utf-8')
|
||||||
console_logger = logging.getLogger('console')
|
console_logger = logging.getLogger('console')
|
||||||
while True:
|
while True:
|
||||||
if send_string:
|
if send_string:
|
||||||
vm.console_socket.sendall(send_string.encode())
|
vm.console_socket.sendall(send_string.encode())
|
||||||
if not keep_sending:
|
if not keep_sending:
|
||||||
send_string = None # send only once
|
send_string = None # send only once
|
||||||
msg = console.readline().strip()
|
try:
|
||||||
|
msg = console.readline().decode().strip()
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
msg = None
|
||||||
if not msg:
|
if not msg:
|
||||||
continue
|
continue
|
||||||
console_logger.debug(msg)
|
console_logger.debug(msg)
|
||||||
@ -210,6 +213,9 @@ class Test(avocado.Test):
|
|||||||
self.arch = self.params.get('arch',
|
self.arch = self.params.get('arch',
|
||||||
default=self._get_unique_tag_val('arch'))
|
default=self._get_unique_tag_val('arch'))
|
||||||
|
|
||||||
|
self.cpu = self.params.get('cpu',
|
||||||
|
default=self._get_unique_tag_val('cpu'))
|
||||||
|
|
||||||
self.machine = self.params.get('machine',
|
self.machine = self.params.get('machine',
|
||||||
default=self._get_unique_tag_val('machine'))
|
default=self._get_unique_tag_val('machine'))
|
||||||
|
|
||||||
@ -219,9 +225,13 @@ class Test(avocado.Test):
|
|||||||
if self.qemu_bin is None:
|
if self.qemu_bin is None:
|
||||||
self.cancel("No QEMU binary defined or found in the build tree")
|
self.cancel("No QEMU binary defined or found in the build tree")
|
||||||
|
|
||||||
def _new_vm(self, *args):
|
def _new_vm(self, name, *args):
|
||||||
self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
|
self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
|
||||||
vm = QEMUMachine(self.qemu_bin, sock_dir=self._sd.name)
|
vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
|
||||||
|
sock_dir=self._sd.name, log_dir=self.logdir)
|
||||||
|
self.log.debug('QEMUMachine "%s" created', name)
|
||||||
|
self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir)
|
||||||
|
self.log.debug('QEMUMachine "%s" log_dir: %s', name, vm.log_dir)
|
||||||
if args:
|
if args:
|
||||||
vm.add_args(*args)
|
vm.add_args(*args)
|
||||||
return vm
|
return vm
|
||||||
@ -234,11 +244,34 @@ class Test(avocado.Test):
|
|||||||
if not name:
|
if not name:
|
||||||
name = str(uuid.uuid4())
|
name = str(uuid.uuid4())
|
||||||
if self._vms.get(name) is None:
|
if self._vms.get(name) is None:
|
||||||
self._vms[name] = self._new_vm(*args)
|
self._vms[name] = self._new_vm(name, *args)
|
||||||
|
if self.cpu is not None:
|
||||||
|
self._vms[name].add_args('-cpu', self.cpu)
|
||||||
if self.machine is not None:
|
if self.machine is not None:
|
||||||
self._vms[name].set_machine(self.machine)
|
self._vms[name].set_machine(self.machine)
|
||||||
return self._vms[name]
|
return self._vms[name]
|
||||||
|
|
||||||
|
def set_vm_arg(self, arg, value):
|
||||||
|
"""
|
||||||
|
Set an argument to list of extra arguments to be given to the QEMU
|
||||||
|
binary. If the argument already exists then its value is replaced.
|
||||||
|
|
||||||
|
:param arg: the QEMU argument, such as "-cpu" in "-cpu host"
|
||||||
|
:type arg: str
|
||||||
|
:param value: the argument value, such as "host" in "-cpu host"
|
||||||
|
:type value: str
|
||||||
|
"""
|
||||||
|
if not arg or not value:
|
||||||
|
return
|
||||||
|
if arg not in self.vm.args:
|
||||||
|
self.vm.args.extend([arg, value])
|
||||||
|
else:
|
||||||
|
idx = self.vm.args.index(arg) + 1
|
||||||
|
if idx < len(self.vm.args):
|
||||||
|
self.vm.args[idx] = value
|
||||||
|
else:
|
||||||
|
self.vm.args.append(value)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
for vm in self._vms.values():
|
for vm in self._vms.values():
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
@ -299,6 +332,103 @@ class LinuxSSHMixIn:
|
|||||||
f'Guest command failed: {command}')
|
f'Guest command failed: {command}')
|
||||||
return stdout_lines, stderr_lines
|
return stdout_lines, stderr_lines
|
||||||
|
|
||||||
|
class LinuxDistro:
|
||||||
|
"""Represents a Linux distribution
|
||||||
|
|
||||||
|
Holds information of known distros.
|
||||||
|
"""
|
||||||
|
#: A collection of known distros and their respective image checksum
|
||||||
|
KNOWN_DISTROS = {
|
||||||
|
'fedora': {
|
||||||
|
'31': {
|
||||||
|
'x86_64':
|
||||||
|
{'checksum': ('e3c1b309d9203604922d6e255c2c5d09'
|
||||||
|
'8a309c2d46215d8fc026954f3c5c27a0'),
|
||||||
|
'pxeboot_url': ('https://archives.fedoraproject.org/'
|
||||||
|
'pub/archive/fedora/linux/releases/31/'
|
||||||
|
'Everything/x86_64/os/images/pxeboot/'),
|
||||||
|
'kernel_params': ('root=UUID=b1438b9b-2cab-4065-a99a-'
|
||||||
|
'08a96687f73c ro no_timer_check '
|
||||||
|
'net.ifnames=0 console=tty1 '
|
||||||
|
'console=ttyS0,115200n8'),
|
||||||
|
},
|
||||||
|
'aarch64':
|
||||||
|
{'checksum': ('1e18d9c0cf734940c4b5d5ec592facae'
|
||||||
|
'd2af0ad0329383d5639c997fdf16fe49'),
|
||||||
|
'pxeboot_url': 'https://archives.fedoraproject.org/'
|
||||||
|
'pub/archive/fedora/linux/releases/31/'
|
||||||
|
'Everything/aarch64/os/images/pxeboot/',
|
||||||
|
'kernel_params': ('root=UUID=b6950a44-9f3c-4076-a9c2-'
|
||||||
|
'355e8475b0a7 ro earlyprintk=pl011,0x9000000'
|
||||||
|
' ignore_loglevel no_timer_check'
|
||||||
|
' printk.time=1 rd_NO_PLYMOUTH'
|
||||||
|
' console=ttyAMA0'),
|
||||||
|
},
|
||||||
|
'ppc64':
|
||||||
|
{'checksum': ('7c3528b85a3df4b2306e892199a9e1e4'
|
||||||
|
'3f991c506f2cc390dc4efa2026ad2f58')},
|
||||||
|
's390x':
|
||||||
|
{'checksum': ('4caaab5a434fd4d1079149a072fdc789'
|
||||||
|
'1e354f834d355069ca982fdcaf5a122d')},
|
||||||
|
},
|
||||||
|
'32': {
|
||||||
|
'aarch64':
|
||||||
|
{'checksum': ('b367755c664a2d7a26955bbfff985855'
|
||||||
|
'adfa2ca15e908baf15b4b176d68d3967'),
|
||||||
|
'pxeboot_url': ('http://dl.fedoraproject.org/pub/fedora/linux/'
|
||||||
|
'releases/32/Server/aarch64/os/images/'
|
||||||
|
'pxeboot/'),
|
||||||
|
'kernel_params': ('root=UUID=3df75b65-be8d-4db4-8655-'
|
||||||
|
'14d95c0e90c5 ro no_timer_check net.ifnames=0'
|
||||||
|
' console=tty1 console=ttyS0,115200n8'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'33': {
|
||||||
|
'aarch64':
|
||||||
|
{'checksum': ('e7f75cdfd523fe5ac2ca9eeece68edc1'
|
||||||
|
'a81f386a17f969c1d1c7c87031008a6b'),
|
||||||
|
'pxeboot_url': ('http://dl.fedoraproject.org/pub/fedora/linux/'
|
||||||
|
'releases/33/Server/aarch64/os/images/'
|
||||||
|
'pxeboot/'),
|
||||||
|
'kernel_params': ('root=UUID=d20b3ffa-6397-4a63-a734-'
|
||||||
|
'1126a0208f8a ro no_timer_check net.ifnames=0'
|
||||||
|
' console=tty1 console=ttyS0,115200n8'
|
||||||
|
' console=tty0'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, name, version, arch):
|
||||||
|
self.name = name
|
||||||
|
self.version = version
|
||||||
|
self.arch = arch
|
||||||
|
try:
|
||||||
|
info = self.KNOWN_DISTROS.get(name).get(version).get(arch)
|
||||||
|
except AttributeError:
|
||||||
|
# Unknown distro
|
||||||
|
info = None
|
||||||
|
self._info = info or {}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def checksum(self):
|
||||||
|
"""Gets the cloud-image file checksum"""
|
||||||
|
return self._info.get('checksum', None)
|
||||||
|
|
||||||
|
@checksum.setter
|
||||||
|
def checksum(self, value):
|
||||||
|
self._info['checksum'] = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pxeboot_url(self):
|
||||||
|
"""Gets the repository url where pxeboot files can be found"""
|
||||||
|
return self._info.get('pxeboot_url', None)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def default_kernel_params(self):
|
||||||
|
"""Gets the default kernel parameters"""
|
||||||
|
return self._info.get('kernel_params', None)
|
||||||
|
|
||||||
|
|
||||||
class LinuxTest(Test, LinuxSSHMixIn):
|
class LinuxTest(Test, LinuxSSHMixIn):
|
||||||
"""Facilitates having a cloud-image Linux based available.
|
"""Facilitates having a cloud-image Linux based available.
|
||||||
@ -308,12 +438,39 @@ class LinuxTest(Test, LinuxSSHMixIn):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
timeout = 900
|
timeout = 900
|
||||||
chksum = None
|
distro = None
|
||||||
username = 'root'
|
username = 'root'
|
||||||
password = 'password'
|
password = 'password'
|
||||||
|
|
||||||
|
def _set_distro(self):
|
||||||
|
distro_name = self.params.get(
|
||||||
|
'distro',
|
||||||
|
default=self._get_unique_tag_val('distro'))
|
||||||
|
if not distro_name:
|
||||||
|
distro_name = 'fedora'
|
||||||
|
|
||||||
|
distro_version = self.params.get(
|
||||||
|
'distro_version',
|
||||||
|
default=self._get_unique_tag_val('distro_version'))
|
||||||
|
if not distro_version:
|
||||||
|
distro_version = '31'
|
||||||
|
|
||||||
|
self.distro = LinuxDistro(distro_name, distro_version, self.arch)
|
||||||
|
|
||||||
|
# The distro checksum behaves differently than distro name and
|
||||||
|
# version. First, it does not respect a tag with the same
|
||||||
|
# name, given that it's not expected to be used for filtering
|
||||||
|
# (distro name versions are the natural choice). Second, the
|
||||||
|
# order of precedence is: parameter, attribute and then value
|
||||||
|
# from KNOWN_DISTROS.
|
||||||
|
distro_checksum = self.params.get('distro_checksum',
|
||||||
|
default=None)
|
||||||
|
if distro_checksum:
|
||||||
|
self.distro.checksum = distro_checksum
|
||||||
|
|
||||||
def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
|
def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
|
||||||
super(LinuxTest, self).setUp()
|
super(LinuxTest, self).setUp()
|
||||||
|
self._set_distro()
|
||||||
self.vm.add_args('-smp', '2')
|
self.vm.add_args('-smp', '2')
|
||||||
self.vm.add_args('-m', '1024')
|
self.vm.add_args('-m', '1024')
|
||||||
# The following network device allows for SSH connections
|
# The following network device allows for SSH connections
|
||||||
@ -351,12 +508,14 @@ class LinuxTest(Test, LinuxSSHMixIn):
|
|||||||
self.log.info('Downloading/preparing boot image')
|
self.log.info('Downloading/preparing boot image')
|
||||||
# Fedora 31 only provides ppc64le images
|
# Fedora 31 only provides ppc64le images
|
||||||
image_arch = self.arch
|
image_arch = self.arch
|
||||||
if image_arch == 'ppc64':
|
if self.distro.name == 'fedora':
|
||||||
image_arch = 'ppc64le'
|
if image_arch == 'ppc64':
|
||||||
|
image_arch = 'ppc64le'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
boot = vmimage.get(
|
boot = vmimage.get(
|
||||||
'fedora', arch=image_arch, version='31',
|
self.distro.name, arch=image_arch, version=self.distro.version,
|
||||||
checksum=self.chksum,
|
checksum=self.distro.checksum,
|
||||||
algorithm='sha256',
|
algorithm='sha256',
|
||||||
cache_dir=self.cache_dirs[0],
|
cache_dir=self.cache_dirs[0],
|
||||||
snapshot_dir=self.workdir)
|
snapshot_dir=self.workdir)
|
||||||
|
@ -20,8 +20,6 @@ class BootLinuxX8664(LinuxTest):
|
|||||||
:avocado: tags=arch:x86_64
|
:avocado: tags=arch:x86_64
|
||||||
"""
|
"""
|
||||||
|
|
||||||
chksum = 'e3c1b309d9203604922d6e255c2c5d098a309c2d46215d8fc026954f3c5c27a0'
|
|
||||||
|
|
||||||
def test_pc_i440fx_tcg(self):
|
def test_pc_i440fx_tcg(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc
|
:avocado: tags=machine:pc
|
||||||
@ -66,8 +64,6 @@ class BootLinuxAarch64(LinuxTest):
|
|||||||
:avocado: tags=machine:gic-version=2
|
:avocado: tags=machine:gic-version=2
|
||||||
"""
|
"""
|
||||||
|
|
||||||
chksum = '1e18d9c0cf734940c4b5d5ec592facaed2af0ad0329383d5639c997fdf16fe49'
|
|
||||||
|
|
||||||
def add_common_args(self):
|
def add_common_args(self):
|
||||||
self.vm.add_args('-bios',
|
self.vm.add_args('-bios',
|
||||||
os.path.join(BUILD_DIR, 'pc-bios',
|
os.path.join(BUILD_DIR, 'pc-bios',
|
||||||
@ -83,7 +79,6 @@ class BootLinuxAarch64(LinuxTest):
|
|||||||
"""
|
"""
|
||||||
self.require_accelerator("tcg")
|
self.require_accelerator("tcg")
|
||||||
self.vm.add_args("-accel", "tcg")
|
self.vm.add_args("-accel", "tcg")
|
||||||
self.vm.add_args("-cpu", "max")
|
|
||||||
self.vm.add_args("-machine", "virt,gic-version=2")
|
self.vm.add_args("-machine", "virt,gic-version=2")
|
||||||
self.add_common_args()
|
self.add_common_args()
|
||||||
self.launch_and_wait(set_up_ssh_connection=False)
|
self.launch_and_wait(set_up_ssh_connection=False)
|
||||||
@ -96,7 +91,6 @@ class BootLinuxAarch64(LinuxTest):
|
|||||||
"""
|
"""
|
||||||
self.require_accelerator("tcg")
|
self.require_accelerator("tcg")
|
||||||
self.vm.add_args("-accel", "tcg")
|
self.vm.add_args("-accel", "tcg")
|
||||||
self.vm.add_args("-cpu", "max")
|
|
||||||
self.vm.add_args("-machine", "virt,gic-version=3")
|
self.vm.add_args("-machine", "virt,gic-version=3")
|
||||||
self.add_common_args()
|
self.add_common_args()
|
||||||
self.launch_and_wait(set_up_ssh_connection=False)
|
self.launch_and_wait(set_up_ssh_connection=False)
|
||||||
@ -108,7 +102,6 @@ class BootLinuxAarch64(LinuxTest):
|
|||||||
"""
|
"""
|
||||||
self.require_accelerator("kvm")
|
self.require_accelerator("kvm")
|
||||||
self.vm.add_args("-accel", "kvm")
|
self.vm.add_args("-accel", "kvm")
|
||||||
self.vm.add_args("-cpu", "host")
|
|
||||||
self.vm.add_args("-machine", "virt,gic-version=host")
|
self.vm.add_args("-machine", "virt,gic-version=host")
|
||||||
self.add_common_args()
|
self.add_common_args()
|
||||||
self.launch_and_wait(set_up_ssh_connection=False)
|
self.launch_and_wait(set_up_ssh_connection=False)
|
||||||
@ -119,8 +112,6 @@ class BootLinuxPPC64(LinuxTest):
|
|||||||
:avocado: tags=arch:ppc64
|
:avocado: tags=arch:ppc64
|
||||||
"""
|
"""
|
||||||
|
|
||||||
chksum = '7c3528b85a3df4b2306e892199a9e1e43f991c506f2cc390dc4efa2026ad2f58'
|
|
||||||
|
|
||||||
def test_pseries_tcg(self):
|
def test_pseries_tcg(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pseries
|
:avocado: tags=machine:pseries
|
||||||
@ -136,8 +127,6 @@ class BootLinuxS390X(LinuxTest):
|
|||||||
:avocado: tags=arch:s390x
|
:avocado: tags=arch:s390x
|
||||||
"""
|
"""
|
||||||
|
|
||||||
chksum = '4caaab5a434fd4d1079149a072fdc7891e354f834d355069ca982fdcaf5a122d'
|
|
||||||
|
|
||||||
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
|
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
|
||||||
def test_s390_ccw_virtio_tcg(self):
|
def test_s390_ccw_virtio_tcg(self):
|
||||||
"""
|
"""
|
||||||
|
@ -239,6 +239,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
:avocado: tags=arch:mips64el
|
:avocado: tags=arch:mips64el
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
|
:avocado: tags=cpu:5KEc
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
|
kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
|
||||||
'raw/9ad2df38/mips/malta/mips64el/'
|
'raw/9ad2df38/mips/malta/mips64el/'
|
||||||
@ -258,8 +259,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
|
||||||
+ 'console=ttyS0 console=tty '
|
+ 'console=ttyS0 console=tty '
|
||||||
+ 'rdinit=/sbin/init noreboot')
|
+ 'rdinit=/sbin/init noreboot')
|
||||||
self.vm.add_args('-cpu', '5KEc',
|
self.vm.add_args('-kernel', kernel_path,
|
||||||
'-kernel', kernel_path,
|
|
||||||
'-initrd', initrd_path,
|
'-initrd', initrd_path,
|
||||||
'-append', kernel_command_line,
|
'-append', kernel_command_line,
|
||||||
'-no-reboot')
|
'-no-reboot')
|
||||||
@ -287,7 +287,6 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
+ 'mem=256m@@0x0 '
|
+ 'mem=256m@@0x0 '
|
||||||
+ 'console=ttyS0')
|
+ 'console=ttyS0')
|
||||||
self.vm.add_args('-no-reboot',
|
self.vm.add_args('-no-reboot',
|
||||||
'-cpu', 'I7200',
|
|
||||||
'-kernel', kernel_path,
|
'-kernel', kernel_path,
|
||||||
'-append', kernel_command_line)
|
'-append', kernel_command_line)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
@ -299,6 +298,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
:avocado: tags=arch:mipsel
|
:avocado: tags=arch:mipsel
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
|
:avocado: tags=cpu:I7200
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
||||||
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
||||||
@ -311,6 +311,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
:avocado: tags=arch:mipsel
|
:avocado: tags=arch:mipsel
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
|
:avocado: tags=cpu:I7200
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
||||||
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
||||||
@ -323,6 +324,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
:avocado: tags=arch:mipsel
|
:avocado: tags=arch:mipsel
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
|
:avocado: tags=cpu:I7200
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
||||||
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
||||||
@ -335,6 +337,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
:avocado: tags=arch:aarch64
|
:avocado: tags=arch:aarch64
|
||||||
:avocado: tags=machine:virt
|
:avocado: tags=machine:virt
|
||||||
:avocado: tags=accel:tcg
|
:avocado: tags=accel:tcg
|
||||||
|
:avocado: tags=cpu:cortex-a53
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
|
||||||
'/linux/releases/29/Everything/aarch64/os/images/pxeboot'
|
'/linux/releases/29/Everything/aarch64/os/images/pxeboot'
|
||||||
@ -905,6 +908,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
:avocado: tags=arch:arm
|
:avocado: tags=arch:arm
|
||||||
:avocado: tags=machine:orangepi-pc
|
:avocado: tags=machine:orangepi-pc
|
||||||
:avocado: tags=device:sd
|
:avocado: tags=device:sd
|
||||||
|
:avocado: tags=os:netbsd
|
||||||
"""
|
"""
|
||||||
# This test download a 304MB compressed image and expand it to 2GB
|
# This test download a 304MB compressed image and expand it to 2GB
|
||||||
deb_url = ('http://snapshot.debian.org/archive/debian/'
|
deb_url = ('http://snapshot.debian.org/archive/debian/'
|
||||||
@ -1167,9 +1171,9 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:ppc64
|
:avocado: tags=arch:ppc64
|
||||||
:avocado: tags=machine:ppce500
|
:avocado: tags=machine:ppce500
|
||||||
|
:avocado: tags=cpu:e5500
|
||||||
"""
|
"""
|
||||||
tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
|
tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
|
||||||
self.vm.add_args('-cpu', 'e5500')
|
|
||||||
self.do_test_advcal_2018('19', tar_hash, 'uImage')
|
self.do_test_advcal_2018('19', tar_hash, 'uImage')
|
||||||
|
|
||||||
def test_ppc_g3beige(self):
|
def test_ppc_g3beige(self):
|
||||||
@ -1211,7 +1215,7 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:xtensa
|
:avocado: tags=arch:xtensa
|
||||||
:avocado: tags=machine:lx60
|
:avocado: tags=machine:lx60
|
||||||
|
:avocado: tags=cpu:dc233c
|
||||||
"""
|
"""
|
||||||
tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
|
tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
|
||||||
self.vm.add_args('-cpu', 'dc233c')
|
|
||||||
self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')
|
self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')
|
||||||
|
@ -48,7 +48,6 @@ class BootXenBase(LinuxKernelTest):
|
|||||||
|
|
||||||
xen_command_line = self.XEN_COMMON_COMMAND_LINE
|
xen_command_line = self.XEN_COMMON_COMMAND_LINE
|
||||||
self.vm.add_args('-machine', 'virtualization=on',
|
self.vm.add_args('-machine', 'virtualization=on',
|
||||||
'-cpu', 'cortex-a57',
|
|
||||||
'-m', '768',
|
'-m', '768',
|
||||||
'-kernel', xen_path,
|
'-kernel', xen_path,
|
||||||
'-append', xen_command_line,
|
'-append', xen_command_line,
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
# This work is licensed under the terms of the GNU GPL, version 2 or
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||||
# later. See the COPYING file in the top-level directory.
|
# later. See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from avocado_qemu import Test
|
from avocado_qemu import Test
|
||||||
|
|
||||||
class QueryCPUModelExpansion(Test):
|
class QueryCPUModelExpansion(Test):
|
||||||
@ -27,7 +25,7 @@ class QueryCPUModelExpansion(Test):
|
|||||||
|
|
||||||
cpus = self.vm.command('query-cpu-definitions')
|
cpus = self.vm.command('query-cpu-definitions')
|
||||||
for c in cpus:
|
for c in cpus:
|
||||||
print(repr(c))
|
self.log.info("Checking CPU: %s", c)
|
||||||
self.assertNotIn('', c['unavailable-features'], c['name'])
|
self.assertNotIn('', c['unavailable-features'], c['name'])
|
||||||
|
|
||||||
for c in cpus:
|
for c in cpus:
|
||||||
|
119
tests/acceptance/intel_iommu.py
Normal file
119
tests/acceptance/intel_iommu.py
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
# INTEL_IOMMU Functional tests
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Author:
|
||||||
|
# Eric Auger <eric.auger@redhat.com>
|
||||||
|
#
|
||||||
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||||
|
# later. See the COPYING file in the top-level directory.
|
||||||
|
import os
|
||||||
|
|
||||||
|
from avocado import skipIf
|
||||||
|
from avocado_qemu import LinuxTest
|
||||||
|
|
||||||
|
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
|
||||||
|
class IntelIOMMU(LinuxTest):
|
||||||
|
"""
|
||||||
|
:avocado: tags=arch:x86_64
|
||||||
|
:avocado: tags=distro:fedora
|
||||||
|
:avocado: tags=distro_version:31
|
||||||
|
:avocado: tags=machine:q35
|
||||||
|
:avocado: tags=accel:kvm
|
||||||
|
:avocado: tags=intel_iommu
|
||||||
|
"""
|
||||||
|
|
||||||
|
IOMMU_ADDON = ',iommu_platform=on,disable-modern=off,disable-legacy=on'
|
||||||
|
kernel_path = None
|
||||||
|
initrd_path = None
|
||||||
|
kernel_params = None
|
||||||
|
|
||||||
|
def set_up_boot(self):
|
||||||
|
path = self.download_boot()
|
||||||
|
self.vm.add_args('-device', 'virtio-blk-pci,bus=pcie.0,scsi=off,' +
|
||||||
|
'drive=drv0,id=virtio-disk0,bootindex=1,'
|
||||||
|
'werror=stop,rerror=stop' + self.IOMMU_ADDON)
|
||||||
|
self.vm.add_args('-device', 'virtio-gpu-pci' + self.IOMMU_ADDON)
|
||||||
|
self.vm.add_args('-drive',
|
||||||
|
'file=%s,if=none,cache=writethrough,id=drv0' % path)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(IntelIOMMU, self).setUp(None, 'virtio-net-pci' + self.IOMMU_ADDON)
|
||||||
|
|
||||||
|
def add_common_args(self):
|
||||||
|
self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
|
||||||
|
self.vm.add_args('-object',
|
||||||
|
'rng-random,id=rng0,filename=/dev/urandom')
|
||||||
|
|
||||||
|
def common_vm_setup(self, custom_kernel=None):
|
||||||
|
self.require_accelerator("kvm")
|
||||||
|
self.add_common_args()
|
||||||
|
self.vm.add_args("-accel", "kvm")
|
||||||
|
|
||||||
|
if custom_kernel is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
kernel_url = self.distro.pxeboot_url + 'vmlinuz'
|
||||||
|
initrd_url = self.distro.pxeboot_url + 'initrd.img'
|
||||||
|
self.kernel_path = self.fetch_asset(kernel_url)
|
||||||
|
self.initrd_path = self.fetch_asset(initrd_url)
|
||||||
|
|
||||||
|
def run_and_check(self):
|
||||||
|
if self.kernel_path:
|
||||||
|
self.vm.add_args('-kernel', self.kernel_path,
|
||||||
|
'-append', self.kernel_params,
|
||||||
|
'-initrd', self.initrd_path)
|
||||||
|
self.launch_and_wait()
|
||||||
|
self.ssh_command('cat /proc/cmdline')
|
||||||
|
self.ssh_command('dmesg | grep -e DMAR -e IOMMU')
|
||||||
|
self.ssh_command('find /sys/kernel/iommu_groups/ -type l')
|
||||||
|
self.ssh_command('dnf -y install numactl-devel')
|
||||||
|
|
||||||
|
def test_intel_iommu(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=intel_iommu_intremap
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.vm.add_args('-device', 'intel-iommu,intremap=on')
|
||||||
|
self.vm.add_args('-machine', 'kernel_irqchip=split')
|
||||||
|
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' quiet intel_iommu=on')
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
def test_intel_iommu_strict(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=intel_iommu_strict
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.vm.add_args('-device', 'intel-iommu,intremap=on')
|
||||||
|
self.vm.add_args('-machine', 'kernel_irqchip=split')
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' quiet intel_iommu=on,strict')
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
def test_intel_iommu_strict_cm(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=intel_iommu_strict_cm
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.vm.add_args('-device', 'intel-iommu,intremap=on,caching-mode=on')
|
||||||
|
self.vm.add_args('-machine', 'kernel_irqchip=split')
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' quiet intel_iommu=on,strict')
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
def test_intel_iommu_pt(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=intel_iommu_pt
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.vm.add_args('-device', 'intel-iommu,intremap=on')
|
||||||
|
self.vm.add_args('-machine', 'kernel_irqchip=split')
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' quiet intel_iommu=on iommu=pt')
|
||||||
|
self.run_and_check()
|
@ -19,6 +19,8 @@ from avocado.utils import archive
|
|||||||
from avocado.utils import ssh
|
from avocado.utils import ssh
|
||||||
|
|
||||||
|
|
||||||
|
@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
|
||||||
|
@skipUnless(ssh.SSH_CLIENT_BINARY, 'No SSH client available')
|
||||||
class LinuxSSH(Test, LinuxSSHMixIn):
|
class LinuxSSH(Test, LinuxSSHMixIn):
|
||||||
|
|
||||||
timeout = 150 # Not for 'configure --enable-debug --enable-debug-tcg'
|
timeout = 150 # Not for 'configure --enable-debug --enable-debug-tcg'
|
||||||
@ -65,11 +67,6 @@ class LinuxSSH(Test, LinuxSSHMixIn):
|
|||||||
kernel_hash = self.IMAGE_INFO[endianess]['kernel_hash'][wordsize]
|
kernel_hash = self.IMAGE_INFO[endianess]['kernel_hash'][wordsize]
|
||||||
return kernel_url, kernel_hash
|
return kernel_url, kernel_hash
|
||||||
|
|
||||||
@skipUnless(ssh.SSH_CLIENT_BINARY, 'No SSH client available')
|
|
||||||
@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
|
|
||||||
def setUp(self):
|
|
||||||
super(LinuxSSH, self).setUp()
|
|
||||||
|
|
||||||
def ssh_disconnect_vm(self):
|
def ssh_disconnect_vm(self):
|
||||||
self.ssh_session.quit()
|
self.ssh_session.quit()
|
||||||
|
|
||||||
|
@ -62,7 +62,6 @@ class MaltaMachineFramebuffer(Test):
|
|||||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
||||||
'clocksource=GIC console=tty0 console=ttyS0')
|
'clocksource=GIC console=tty0 console=ttyS0')
|
||||||
self.vm.add_args('-kernel', kernel_path,
|
self.vm.add_args('-kernel', kernel_path,
|
||||||
'-cpu', 'I6400',
|
|
||||||
'-smp', '%u' % cpu_cores_count,
|
'-smp', '%u' % cpu_cores_count,
|
||||||
'-vga', 'std',
|
'-vga', 'std',
|
||||||
'-append', kernel_command_line)
|
'-append', kernel_command_line)
|
||||||
@ -96,7 +95,7 @@ class MaltaMachineFramebuffer(Test):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:mips64el
|
:avocado: tags=arch:mips64el
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=cpu:i6400
|
:avocado: tags=cpu:I6400
|
||||||
"""
|
"""
|
||||||
self.do_test_i6400_framebuffer_logo(1)
|
self.do_test_i6400_framebuffer_logo(1)
|
||||||
|
|
||||||
@ -105,7 +104,7 @@ class MaltaMachineFramebuffer(Test):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:mips64el
|
:avocado: tags=arch:mips64el
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=cpu:i6400
|
:avocado: tags=cpu:I6400
|
||||||
:avocado: tags=mips:smp
|
:avocado: tags=mips:smp
|
||||||
"""
|
"""
|
||||||
self.do_test_i6400_framebuffer_logo(7)
|
self.do_test_i6400_framebuffer_logo(7)
|
||||||
@ -115,7 +114,7 @@ class MaltaMachineFramebuffer(Test):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:mips64el
|
:avocado: tags=arch:mips64el
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=cpu:i6400
|
:avocado: tags=cpu:I6400
|
||||||
:avocado: tags=mips:smp
|
:avocado: tags=mips:smp
|
||||||
"""
|
"""
|
||||||
self.do_test_i6400_framebuffer_logo(8)
|
self.do_test_i6400_framebuffer_logo(8)
|
||||||
|
@ -25,11 +25,11 @@ from avocado_qemu import Test
|
|||||||
class OmittedCPUProps(Test):
|
class OmittedCPUProps(Test):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=arch:x86_64
|
:avocado: tags=arch:x86_64
|
||||||
|
:avocado: tags=cpu:qemu64
|
||||||
"""
|
"""
|
||||||
def test_no_die_id(self):
|
def test_no_die_id(self):
|
||||||
self.vm.add_args('-nodefaults', '-S')
|
self.vm.add_args('-nodefaults', '-S')
|
||||||
self.vm.add_args('-smp', '1,sockets=2,cores=2,threads=2,maxcpus=8')
|
self.vm.add_args('-smp', '1,sockets=2,cores=2,threads=2,maxcpus=8')
|
||||||
self.vm.add_args('-cpu', 'qemu64')
|
|
||||||
self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=1,core-id=0,thread-id=0')
|
self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=1,core-id=0,thread-id=0')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertEquals(len(self.vm.command('query-cpus-fast')), 2)
|
self.assertEquals(len(self.vm.command('query-cpus-fast')), 2)
|
||||||
|
@ -27,6 +27,7 @@ class IbmPrep40pMachine(Test):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:ppc
|
:avocado: tags=arch:ppc
|
||||||
:avocado: tags=machine:40p
|
:avocado: tags=machine:40p
|
||||||
|
:avocado: tags=os:netbsd
|
||||||
:avocado: tags=slowness:high
|
:avocado: tags=slowness:high
|
||||||
"""
|
"""
|
||||||
bios_url = ('http://ftpmirror.your.org/pub/misc/'
|
bios_url = ('http://ftpmirror.your.org/pub/misc/'
|
||||||
@ -64,6 +65,7 @@ class IbmPrep40pMachine(Test):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:ppc
|
:avocado: tags=arch:ppc
|
||||||
:avocado: tags=machine:40p
|
:avocado: tags=machine:40p
|
||||||
|
:avocado: tags=os:netbsd
|
||||||
"""
|
"""
|
||||||
drive_url = ('https://cdn.netbsd.org/pub/NetBSD/iso/7.1.2/'
|
drive_url = ('https://cdn.netbsd.org/pub/NetBSD/iso/7.1.2/'
|
||||||
'NetBSD-7.1.2-prep.iso')
|
'NetBSD-7.1.2-prep.iso')
|
||||||
|
@ -156,8 +156,7 @@ class ReplayKernelNormal(ReplayKernelBase):
|
|||||||
'console=ttyAMA0')
|
'console=ttyAMA0')
|
||||||
console_pattern = 'VFS: Cannot open root device'
|
console_pattern = 'VFS: Cannot open root device'
|
||||||
|
|
||||||
self.run_rr(kernel_path, kernel_command_line, console_pattern,
|
self.run_rr(kernel_path, kernel_command_line, console_pattern)
|
||||||
args=('-cpu', 'cortex-a53'))
|
|
||||||
|
|
||||||
def test_arm_virt(self):
|
def test_arm_virt(self):
|
||||||
"""
|
"""
|
||||||
@ -301,7 +300,7 @@ class ReplayKernelNormal(ReplayKernelBase):
|
|||||||
tar_url = ('https://www.qemu-advent-calendar.org'
|
tar_url = ('https://www.qemu-advent-calendar.org'
|
||||||
'/2018/download/day19.tar.xz')
|
'/2018/download/day19.tar.xz')
|
||||||
file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
|
file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
|
||||||
self.do_test_advcal_2018(file_path, 'uImage', ('-cpu', 'e5500'))
|
self.do_test_advcal_2018(file_path, 'uImage')
|
||||||
|
|
||||||
def test_ppc_g3beige(self):
|
def test_ppc_g3beige(self):
|
||||||
"""
|
"""
|
||||||
@ -348,8 +347,7 @@ class ReplayKernelNormal(ReplayKernelBase):
|
|||||||
tar_url = ('https://www.qemu-advent-calendar.org'
|
tar_url = ('https://www.qemu-advent-calendar.org'
|
||||||
'/2018/download/day02.tar.xz')
|
'/2018/download/day02.tar.xz')
|
||||||
file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
|
file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
|
||||||
self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf',
|
self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf')
|
||||||
args=('-cpu', 'dc233c'))
|
|
||||||
|
|
||||||
@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
|
@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
|
||||||
class ReplayKernelSlow(ReplayKernelBase):
|
class ReplayKernelSlow(ReplayKernelBase):
|
||||||
@ -394,6 +392,7 @@ class ReplayKernelSlow(ReplayKernelBase):
|
|||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
:avocado: tags=slowness:high
|
:avocado: tags=slowness:high
|
||||||
|
:avocado: tags=cpu:5KEc
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
|
kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
|
||||||
'raw/9ad2df38/mips/malta/mips64el/'
|
'raw/9ad2df38/mips/malta/mips64el/'
|
||||||
@ -414,7 +413,7 @@ class ReplayKernelSlow(ReplayKernelBase):
|
|||||||
'rdinit=/sbin/init noreboot')
|
'rdinit=/sbin/init noreboot')
|
||||||
console_pattern = 'Boot successful.'
|
console_pattern = 'Boot successful.'
|
||||||
self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
|
self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
|
||||||
args=('-initrd', initrd_path, '-cpu', '5KEc'))
|
args=('-initrd', initrd_path))
|
||||||
|
|
||||||
def do_test_mips_malta32el_nanomips(self, kernel_path_xz):
|
def do_test_mips_malta32el_nanomips(self, kernel_path_xz):
|
||||||
kernel_path = self.workdir + "kernel"
|
kernel_path = self.workdir + "kernel"
|
||||||
@ -426,14 +425,14 @@ class ReplayKernelSlow(ReplayKernelBase):
|
|||||||
'mem=256m@@0x0 '
|
'mem=256m@@0x0 '
|
||||||
'console=ttyS0')
|
'console=ttyS0')
|
||||||
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
console_pattern = 'Kernel command line: %s' % kernel_command_line
|
||||||
self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
|
self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)
|
||||||
args=('-cpu', 'I7200'))
|
|
||||||
|
|
||||||
def test_mips_malta32el_nanomips_4k(self):
|
def test_mips_malta32el_nanomips_4k(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=arch:mipsel
|
:avocado: tags=arch:mipsel
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
|
:avocado: tags=cpu:I7200
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
||||||
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
||||||
@ -447,6 +446,7 @@ class ReplayKernelSlow(ReplayKernelBase):
|
|||||||
:avocado: tags=arch:mipsel
|
:avocado: tags=arch:mipsel
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
|
:avocado: tags=cpu:I7200
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
||||||
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
||||||
@ -460,6 +460,7 @@ class ReplayKernelSlow(ReplayKernelBase):
|
|||||||
:avocado: tags=arch:mipsel
|
:avocado: tags=arch:mipsel
|
||||||
:avocado: tags=machine:malta
|
:avocado: tags=machine:malta
|
||||||
:avocado: tags=endian:little
|
:avocado: tags=endian:little
|
||||||
|
:avocado: tags=cpu:I7200
|
||||||
"""
|
"""
|
||||||
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
kernel_url = ('https://mipsdistros.mips.com/LinuxDistro/nanomips/'
|
||||||
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
|
||||||
|
@ -207,4 +207,4 @@ class ReverseDebugging_AArch64(ReverseDebugging):
|
|||||||
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
||||||
|
|
||||||
self.reverse_debugging(
|
self.reverse_debugging(
|
||||||
args=('-kernel', kernel_path, '-cpu', 'cortex-a53'))
|
args=('-kernel', kernel_path))
|
||||||
|
137
tests/acceptance/smmu.py
Normal file
137
tests/acceptance/smmu.py
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
# SMMUv3 Functional tests
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Author:
|
||||||
|
# Eric Auger <eric.auger@redhat.com>
|
||||||
|
#
|
||||||
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
||||||
|
# later. See the COPYING file in the top-level directory.
|
||||||
|
import os
|
||||||
|
|
||||||
|
from avocado import skipIf
|
||||||
|
from avocado_qemu import LinuxTest, BUILD_DIR
|
||||||
|
|
||||||
|
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
|
||||||
|
class SMMU(LinuxTest):
|
||||||
|
"""
|
||||||
|
:avocado: tags=accel:kvm
|
||||||
|
:avocado: tags=cpu:host
|
||||||
|
:avocado: tags=arch:aarch64
|
||||||
|
:avocado: tags=machine:virt
|
||||||
|
:avocado: tags=distro:fedora
|
||||||
|
:avocado: tags=smmu
|
||||||
|
"""
|
||||||
|
|
||||||
|
IOMMU_ADDON = ',iommu_platform=on,disable-modern=off,disable-legacy=on'
|
||||||
|
kernel_path = None
|
||||||
|
initrd_path = None
|
||||||
|
kernel_params = None
|
||||||
|
|
||||||
|
def set_up_boot(self):
|
||||||
|
path = self.download_boot()
|
||||||
|
self.vm.add_args('-device', 'virtio-blk-pci,bus=pcie.0,scsi=off,' +
|
||||||
|
'drive=drv0,id=virtio-disk0,bootindex=1,'
|
||||||
|
'werror=stop,rerror=stop' + self.IOMMU_ADDON)
|
||||||
|
self.vm.add_args('-drive',
|
||||||
|
'file=%s,if=none,cache=writethrough,id=drv0' % path)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(SMMU, self).setUp(None, 'virtio-net-pci' + self.IOMMU_ADDON)
|
||||||
|
|
||||||
|
def common_vm_setup(self, custom_kernel=False):
|
||||||
|
self.require_accelerator("kvm")
|
||||||
|
self.vm.add_args("-accel", "kvm")
|
||||||
|
self.vm.add_args("-cpu", "host")
|
||||||
|
self.vm.add_args("-machine", "iommu=smmuv3")
|
||||||
|
self.vm.add_args("-d", "guest_errors")
|
||||||
|
self.vm.add_args('-bios', os.path.join(BUILD_DIR, 'pc-bios',
|
||||||
|
'edk2-aarch64-code.fd'))
|
||||||
|
self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
|
||||||
|
self.vm.add_args('-object',
|
||||||
|
'rng-random,id=rng0,filename=/dev/urandom')
|
||||||
|
|
||||||
|
if custom_kernel is False:
|
||||||
|
return
|
||||||
|
|
||||||
|
kernel_url = self.distro.pxeboot_url + 'vmlinuz'
|
||||||
|
initrd_url = self.distro.pxeboot_url + 'initrd.img'
|
||||||
|
self.kernel_path = self.fetch_asset(kernel_url)
|
||||||
|
self.initrd_path = self.fetch_asset(initrd_url)
|
||||||
|
|
||||||
|
def run_and_check(self):
|
||||||
|
if self.kernel_path:
|
||||||
|
self.vm.add_args('-kernel', self.kernel_path,
|
||||||
|
'-append', self.kernel_params,
|
||||||
|
'-initrd', self.initrd_path)
|
||||||
|
self.launch_and_wait()
|
||||||
|
self.ssh_command('cat /proc/cmdline')
|
||||||
|
self.ssh_command('dnf -y install numactl-devel')
|
||||||
|
|
||||||
|
|
||||||
|
# 5.3 kernel without RIL #
|
||||||
|
|
||||||
|
def test_smmu_noril(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=smmu_noril
|
||||||
|
:avocado: tags=smmu_noril_tests
|
||||||
|
:avocado: tags=distro_version:31
|
||||||
|
"""
|
||||||
|
self.common_vm_setup()
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
def test_smmu_noril_passthrough(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=smmu_noril_passthrough
|
||||||
|
:avocado: tags=smmu_noril_tests
|
||||||
|
:avocado: tags=distro_version:31
|
||||||
|
"""
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' iommu.passthrough=on')
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
def test_smmu_noril_nostrict(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=smmu_noril_nostrict
|
||||||
|
:avocado: tags=smmu_noril_tests
|
||||||
|
:avocado: tags=distro_version:31
|
||||||
|
"""
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' iommu.strict=0')
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
# 5.8 kernel featuring range invalidation
|
||||||
|
# >= v5.7 kernel
|
||||||
|
|
||||||
|
def test_smmu_ril(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=smmu_ril
|
||||||
|
:avocado: tags=smmu_ril_tests
|
||||||
|
:avocado: tags=distro_version:33
|
||||||
|
"""
|
||||||
|
self.common_vm_setup()
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
def test_smmu_ril_passthrough(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=smmu_ril_passthrough
|
||||||
|
:avocado: tags=smmu_ril_tests
|
||||||
|
:avocado: tags=distro_version:33
|
||||||
|
"""
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' iommu.passthrough=on')
|
||||||
|
self.run_and_check()
|
||||||
|
|
||||||
|
def test_smmu_ril_nostrict(self):
|
||||||
|
"""
|
||||||
|
:avocado: tags=smmu_ril_nostrict
|
||||||
|
:avocado: tags=smmu_ril_tests
|
||||||
|
:avocado: tags=distro_version:33
|
||||||
|
"""
|
||||||
|
self.common_vm_setup(True)
|
||||||
|
self.kernel_params = (self.distro.default_kernel_params +
|
||||||
|
' iommu.strict=0')
|
||||||
|
self.run_and_check()
|
@ -25,7 +25,7 @@ class PluginKernelBase(LinuxKernelTest):
|
|||||||
KERNEL_COMMON_COMMAND_LINE = 'printk.time=1 panic=-1 '
|
KERNEL_COMMON_COMMAND_LINE = 'printk.time=1 panic=-1 '
|
||||||
|
|
||||||
def run_vm(self, kernel_path, kernel_command_line,
|
def run_vm(self, kernel_path, kernel_command_line,
|
||||||
plugin, plugin_log, console_pattern, args):
|
plugin, plugin_log, console_pattern, args=None):
|
||||||
|
|
||||||
vm = self.get_vm()
|
vm = self.get_vm()
|
||||||
vm.set_console()
|
vm.set_console()
|
||||||
@ -68,7 +68,7 @@ class PluginKernelNormal(PluginKernelBase):
|
|||||||
:avocado: tags=accel:tcg
|
:avocado: tags=accel:tcg
|
||||||
:avocado: tags=arch:aarch64
|
:avocado: tags=arch:aarch64
|
||||||
:avocado: tags=machine:virt
|
:avocado: tags=machine:virt
|
||||||
:avocado: tags=cpu:cortex-a57
|
:avocado: tags=cpu:cortex-a53
|
||||||
"""
|
"""
|
||||||
kernel_path = self._grab_aarch64_kernel()
|
kernel_path = self._grab_aarch64_kernel()
|
||||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
||||||
@ -80,8 +80,7 @@ class PluginKernelNormal(PluginKernelBase):
|
|||||||
|
|
||||||
self.run_vm(kernel_path, kernel_command_line,
|
self.run_vm(kernel_path, kernel_command_line,
|
||||||
"tests/plugin/libinsn.so", plugin_log.name,
|
"tests/plugin/libinsn.so", plugin_log.name,
|
||||||
console_pattern,
|
console_pattern)
|
||||||
args=('-cpu', 'cortex-a53'))
|
|
||||||
|
|
||||||
with plugin_log as lf, \
|
with plugin_log as lf, \
|
||||||
mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
|
mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
|
||||||
@ -95,7 +94,7 @@ class PluginKernelNormal(PluginKernelBase):
|
|||||||
:avocado: tags=accel:tcg
|
:avocado: tags=accel:tcg
|
||||||
:avocado: tags=arch:aarch64
|
:avocado: tags=arch:aarch64
|
||||||
:avocado: tags=machine:virt
|
:avocado: tags=machine:virt
|
||||||
:avocado: tags=cpu:cortex-a57
|
:avocado: tags=cpu:cortex-a53
|
||||||
"""
|
"""
|
||||||
kernel_path = self._grab_aarch64_kernel()
|
kernel_path = self._grab_aarch64_kernel()
|
||||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
||||||
@ -108,7 +107,7 @@ class PluginKernelNormal(PluginKernelBase):
|
|||||||
self.run_vm(kernel_path, kernel_command_line,
|
self.run_vm(kernel_path, kernel_command_line,
|
||||||
"tests/plugin/libinsn.so", plugin_log.name,
|
"tests/plugin/libinsn.so", plugin_log.name,
|
||||||
console_pattern,
|
console_pattern,
|
||||||
args=('-cpu', 'cortex-a53', '-icount', 'shift=1'))
|
args=('-icount', 'shift=1'))
|
||||||
|
|
||||||
with plugin_log as lf, \
|
with plugin_log as lf, \
|
||||||
mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
|
mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
|
||||||
@ -121,7 +120,7 @@ class PluginKernelNormal(PluginKernelBase):
|
|||||||
:avocado: tags=accel:tcg
|
:avocado: tags=accel:tcg
|
||||||
:avocado: tags=arch:aarch64
|
:avocado: tags=arch:aarch64
|
||||||
:avocado: tags=machine:virt
|
:avocado: tags=machine:virt
|
||||||
:avocado: tags=cpu:cortex-a57
|
:avocado: tags=cpu:cortex-a53
|
||||||
"""
|
"""
|
||||||
kernel_path = self._grab_aarch64_kernel()
|
kernel_path = self._grab_aarch64_kernel()
|
||||||
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
|
||||||
@ -134,7 +133,7 @@ class PluginKernelNormal(PluginKernelBase):
|
|||||||
self.run_vm(kernel_path, kernel_command_line,
|
self.run_vm(kernel_path, kernel_command_line,
|
||||||
"tests/plugin/libmem.so,arg=both", plugin_log.name,
|
"tests/plugin/libmem.so,arg=both", plugin_log.name,
|
||||||
console_pattern,
|
console_pattern,
|
||||||
args=('-cpu', 'cortex-a53', '-icount', 'shift=1'))
|
args=('-icount', 'shift=1'))
|
||||||
|
|
||||||
with plugin_log as lf, \
|
with plugin_log as lf, \
|
||||||
mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
|
mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
|
||||||
|
@ -60,6 +60,7 @@ class VirtioGPUx86(Test):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:x86_64
|
:avocado: tags=arch:x86_64
|
||||||
:avocado: tags=device:virtio-vga
|
:avocado: tags=device:virtio-vga
|
||||||
|
:avocado: tags=cpu:host
|
||||||
"""
|
"""
|
||||||
kernel_command_line = (
|
kernel_command_line = (
|
||||||
self.KERNEL_COMMON_COMMAND_LINE + "console=ttyS0 rdinit=/bin/bash"
|
self.KERNEL_COMMON_COMMAND_LINE + "console=ttyS0 rdinit=/bin/bash"
|
||||||
@ -72,7 +73,6 @@ class VirtioGPUx86(Test):
|
|||||||
initrd_path = self.fetch_asset(self.INITRD_URL)
|
initrd_path = self.fetch_asset(self.INITRD_URL)
|
||||||
|
|
||||||
self.vm.set_console()
|
self.vm.set_console()
|
||||||
self.vm.add_args("-cpu", "host")
|
|
||||||
self.vm.add_args("-m", "2G")
|
self.vm.add_args("-m", "2G")
|
||||||
self.vm.add_args("-machine", "pc,accel=kvm")
|
self.vm.add_args("-machine", "pc,accel=kvm")
|
||||||
self.vm.add_args("-device", "virtio-vga,virgl=on")
|
self.vm.add_args("-device", "virtio-vga,virgl=on")
|
||||||
@ -101,6 +101,7 @@ class VirtioGPUx86(Test):
|
|||||||
"""
|
"""
|
||||||
:avocado: tags=arch:x86_64
|
:avocado: tags=arch:x86_64
|
||||||
:avocado: tags=device:vhost-user-vga
|
:avocado: tags=device:vhost-user-vga
|
||||||
|
:avocado: tags=cpu:host
|
||||||
"""
|
"""
|
||||||
kernel_command_line = (
|
kernel_command_line = (
|
||||||
self.KERNEL_COMMON_COMMAND_LINE + "console=ttyS0 rdinit=/bin/bash"
|
self.KERNEL_COMMON_COMMAND_LINE + "console=ttyS0 rdinit=/bin/bash"
|
||||||
@ -140,7 +141,6 @@ class VirtioGPUx86(Test):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.vm.set_console()
|
self.vm.set_console()
|
||||||
self.vm.add_args("-cpu", "host")
|
|
||||||
self.vm.add_args("-m", "2G")
|
self.vm.add_args("-m", "2G")
|
||||||
self.vm.add_args("-object", "memory-backend-memfd,id=mem,size=2G")
|
self.vm.add_args("-object", "memory-backend-memfd,id=mem,size=2G")
|
||||||
self.vm.add_args("-machine", "pc,memory-backend=mem,accel=kvm")
|
self.vm.add_args("-machine", "pc,memory-backend=mem,accel=kvm")
|
||||||
|
@ -252,10 +252,13 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_4_1(self):
|
def test_4_1(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.1
|
:avocado: tags=machine:pc-i440fx-4.1
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
# machine-type only:
|
# machine-type only:
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=on,check=off,enforce=off')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server,x-force-features=on,check=off,'
|
||||||
|
'enforce=off')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.1 + Cascadelake-Server should not have arch-capabilities')
|
'pc-i440fx-4.1 + Cascadelake-Server should not have arch-capabilities')
|
||||||
@ -263,9 +266,12 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_4_0(self):
|
def test_4_0(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.0
|
:avocado: tags=machine:pc-i440fx-4.0
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=on,check=off,enforce=off')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server,x-force-features=on,check=off,'
|
||||||
|
'enforce=off')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.0 + Cascadelake-Server should not have arch-capabilities')
|
'pc-i440fx-4.0 + Cascadelake-Server should not have arch-capabilities')
|
||||||
@ -273,10 +279,13 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_set_4_0(self):
|
def test_set_4_0(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.0
|
:avocado: tags=machine:pc-i440fx-4.0
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
# command line must override machine-type if CPU model is not versioned:
|
# command line must override machine-type if CPU model is not versioned:
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=on,check=off,enforce=off,+arch-capabilities')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server,x-force-features=on,check=off,'
|
||||||
|
'enforce=off,+arch-capabilities')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertTrue(self.get_cpu_prop('arch-capabilities'),
|
self.assertTrue(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabilities should have arch-capabilities')
|
'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabilities should have arch-capabilities')
|
||||||
@ -284,9 +293,12 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_unset_4_1(self):
|
def test_unset_4_1(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.1
|
:avocado: tags=machine:pc-i440fx-4.1
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=on,check=off,enforce=off,-arch-capabilities')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server,x-force-features=on,check=off,'
|
||||||
|
'enforce=off,-arch-capabilities')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabilities should not have arch-capabilities')
|
'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabilities should not have arch-capabilities')
|
||||||
@ -294,10 +306,13 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_v1_4_0(self):
|
def test_v1_4_0(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.0
|
:avocado: tags=machine:pc-i440fx-4.0
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
# versioned CPU model overrides machine-type:
|
# versioned CPU model overrides machine-type:
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=on,check=off,enforce=off')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server-v1,x-force-features=on,check=off,'
|
||||||
|
'enforce=off')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.0 + Cascadelake-Server-v1 should not have arch-capabilities')
|
'pc-i440fx-4.0 + Cascadelake-Server-v1 should not have arch-capabilities')
|
||||||
@ -305,9 +320,12 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_v2_4_0(self):
|
def test_v2_4_0(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.0
|
:avocado: tags=machine:pc-i440fx-4.0
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=on,check=off,enforce=off')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server-v2,x-force-features=on,check=off,'
|
||||||
|
'enforce=off')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertTrue(self.get_cpu_prop('arch-capabilities'),
|
self.assertTrue(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.0 + Cascadelake-Server-v2 should have arch-capabilities')
|
'pc-i440fx-4.0 + Cascadelake-Server-v2 should have arch-capabilities')
|
||||||
@ -315,10 +333,13 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_v1_set_4_0(self):
|
def test_v1_set_4_0(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.0
|
:avocado: tags=machine:pc-i440fx-4.0
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
# command line must override machine-type and versioned CPU model:
|
# command line must override machine-type and versioned CPU model:
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=on,check=off,enforce=off,+arch-capabilities')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server-v1,x-force-features=on,check=off,'
|
||||||
|
'enforce=off,+arch-capabilities')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertTrue(self.get_cpu_prop('arch-capabilities'),
|
self.assertTrue(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capabilities should have arch-capabilities')
|
'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capabilities should have arch-capabilities')
|
||||||
@ -326,9 +347,12 @@ class CascadelakeArchCapabilities(avocado_qemu.Test):
|
|||||||
def test_v2_unset_4_1(self):
|
def test_v2_unset_4_1(self):
|
||||||
"""
|
"""
|
||||||
:avocado: tags=machine:pc-i440fx-4.1
|
:avocado: tags=machine:pc-i440fx-4.1
|
||||||
|
:avocado: tags=cpu:Cascadelake-Server
|
||||||
"""
|
"""
|
||||||
self.vm.add_args('-S')
|
self.vm.add_args('-S')
|
||||||
self.vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=on,check=off,enforce=off,-arch-capabilities')
|
self.set_vm_arg('-cpu',
|
||||||
|
'Cascadelake-Server-v2,x-force-features=on,check=off,'
|
||||||
|
'enforce=off,-arch-capabilities')
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
self.assertFalse(self.get_cpu_prop('arch-capabilities'),
|
||||||
'pc-i440fx-4.1 + Cascadelake-Server-v2,-arch-capabilities should not have arch-capabilities')
|
'pc-i440fx-4.1 + Cascadelake-Server-v2,-arch-capabilities should not have arch-capabilities')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user