Testing and documentation updates:

- bump avocado to 101.0
   - use snapshots for tuxrun baseline tests
   - add sbda-ref test to avocado
   - avoid spurious re-configure in gitlab
   - better description of blockdev options
   - drop FreeBSD 12 from Cirrus CI
   - fix up the ast2[56]00 tests to be more stable
   - improve coverage of ppc64 tests in tuxrun baselines
   - limit plugin tests to just the generic multiarch binaries
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmRKgI0ACgkQ+9DbCVqe
 KkQG9Qf/fvSaiNvkttmb0OFDf3+Qz1uQ33YzLZxETCwI1cSqpGZbssQUrTJZWgpu
 c7FHzdOnTem3Q3PsBY9UN5oqm5IraXEu+nZRO+QyCwHEZzdL9DBfJs46La4BkWG6
 9vXbNtXLUPd6qJy9ntcZzRShrYy0x0KeszDq7371LS/fng+zMtaIhm4ck0fVWKnj
 htrZEN6nn+CqEnvOc06ICmxiysUVLGRScWKgAHCS9ORGyOtZsj3vWafBoIC6hwzi
 oM3kebhFsVOdbGdL0ZiBdHZqUGAEq3gr+3CpX/48bQ0pYnuYMX8iHk1FhqEK7Adk
 H9ZLnpYUXVyt70rJUjImPyIHpdyq0A==
 =fCif
 -----END PGP SIGNATURE-----

Merge tag 'pull-testing-docs-270423-1' of https://gitlab.com/stsquad/qemu into staging

Testing and documentation updates:

  - bump avocado to 101.0
  - use snapshots for tuxrun baseline tests
  - add sbda-ref test to avocado
  - avoid spurious re-configure in gitlab
  - better description of blockdev options
  - drop FreeBSD 12 from Cirrus CI
  - fix up the ast2[56]00 tests to be more stable
  - improve coverage of ppc64 tests in tuxrun baselines
  - limit plugin tests to just the generic multiarch binaries

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmRKgI0ACgkQ+9DbCVqe
# KkQG9Qf/fvSaiNvkttmb0OFDf3+Qz1uQ33YzLZxETCwI1cSqpGZbssQUrTJZWgpu
# c7FHzdOnTem3Q3PsBY9UN5oqm5IraXEu+nZRO+QyCwHEZzdL9DBfJs46La4BkWG6
# 9vXbNtXLUPd6qJy9ntcZzRShrYy0x0KeszDq7371LS/fng+zMtaIhm4ck0fVWKnj
# htrZEN6nn+CqEnvOc06ICmxiysUVLGRScWKgAHCS9ORGyOtZsj3vWafBoIC6hwzi
# oM3kebhFsVOdbGdL0ZiBdHZqUGAEq3gr+3CpX/48bQ0pYnuYMX8iHk1FhqEK7Adk
# H9ZLnpYUXVyt70rJUjImPyIHpdyq0A==
# =fCif
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 27 Apr 2023 03:02:53 PM BST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-testing-docs-270423-1' of https://gitlab.com/stsquad/qemu:
  docs/style: call out the use of GUARD macros
  docs/devel: mention the spacing requirement for QOM
  docs/devel: make a statement about includes
  docs/system: remove excessive punctuation from guest-loader docs
  qemu-options.hx: Update descriptions of memory options for NUMA node
  tests/tcg: limit the scope of the plugin tests
  tests/avocado/tuxrun_baselines.py: improve code coverage for ppc64
  avocado_qemu/__init__.py: factor out the qemu-img finding
  MAINTAINERS: Cover tests/avocado/machine_aspeed.py
  tests/avocado/machine_aspeed: Fix the broken ast2[56]00_evb_sdk tests
  tests/avocado: Make ssh_command_output_contains() globally available
  .gitlab-ci.d/cirrus: Drop the CI job for compiling with FreeBSD 12
  qemu-options: finesse the recommendations around -blockdev
  scripts/device-crash-test: Add a parameter to run with TCG only
  gitlab-ci: Avoid to re-run "configure" in the device-crash-test jobs
  tests/avocado: Add set of boot tests on SBSA-ref
  tests/avocado: use the new snapshots for testing
  tests/requirements.txt: bump up avocado-framework version to 101.0

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2023-04-27 16:46:17 +01:00
commit cc5ee50fff
31 changed files with 594 additions and 145 deletions

View File

@ -102,8 +102,8 @@ crash-test-debian:
IMAGE: debian-amd64 IMAGE: debian-amd64
script: script:
- cd build - cd build
- make check-venv - make NINJA=":" check-venv
- tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-i386 - tests/venv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386
build-system-fedora: build-system-fedora:
extends: extends:
@ -145,7 +145,7 @@ crash-test-fedora:
IMAGE: fedora IMAGE: fedora
script: script:
- cd build - cd build
- make check-venv - make NINJA=":" check-venv
- tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
- tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32 - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32

View File

@ -44,19 +44,6 @@
variables: variables:
QEMU_JOB_CIRRUS: 1 QEMU_JOB_CIRRUS: 1
x64-freebsd-12-build:
extends: .cirrus_build_job
variables:
NAME: freebsd-12
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_IMAGE_NAME: freebsd-12-4
CIRRUS_VM_CPUS: 8
CIRRUS_VM_RAM: 8G
UPDATE_COMMAND: pkg update; pkg upgrade -y
INSTALL_COMMAND: pkg install -y
TEST_TARGETS: check
x64-freebsd-13-build: x64-freebsd-13-build:
extends: .cirrus_build_job extends: .cirrus_build_job
variables: variables:

View File

@ -1,16 +0,0 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool variables freebsd-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci
CCACHE='/usr/local/bin/ccache'
CPAN_PKGS=''
CROSS_PKGS=''
MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PACKAGING_COMMAND='pkg'
PIP3='/usr/local/bin/pip-3.8'
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 zstd'
PYPI_PKGS=''
PYTHON='/usr/local/bin/python3'

View File

@ -943,6 +943,7 @@ L: qemu-arm@nongnu.org
S: Maintained S: Maintained
F: hw/arm/sbsa-ref.c F: hw/arm/sbsa-ref.c
F: docs/system/arm/sbsa.rst F: docs/system/arm/sbsa.rst
F: tests/avocado/machine_aarch64_sbsaref.py
Sharp SL-5500 (Collie) PDA Sharp SL-5500 (Collie) PDA
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
@ -1112,7 +1113,7 @@ F: include/hw/misc/pca9552*.h
F: hw/net/ftgmac100.c F: hw/net/ftgmac100.c
F: include/hw/net/ftgmac100.h F: include/hw/net/ftgmac100.h
F: docs/system/arm/aspeed.rst F: docs/system/arm/aspeed.rst
F: tests/qtest/*aspeed* F: tests/*/*aspeed*
F: hw/arm/fby35.c F: hw/arm/fby35.c
NRF51 NRF51

View File

@ -1,3 +1,5 @@
.. _qom:
=========================== ===========================
The QEMU Object Model (QOM) The QEMU Object Model (QOM)
=========================== ===========================

View File

@ -300,6 +300,20 @@ putting those into qemu/typedefs.h instead of including the header.
Cyclic inclusion is forbidden. Cyclic inclusion is forbidden.
Generative Includes
-------------------
QEMU makes fairly extensive use of the macro pre-processor to
instantiate multiple similar functions. While such abuse of the macro
processor isn't discouraged it can make debugging and code navigation
harder. You should consider carefully if the same effect can be
achieved by making it easy for the compiler to constant fold or using
python scripting to generate grep friendly code.
If you do use template header files they should be named with the
``.c.inc`` or ``.h.inc`` suffix to make it clear they are being
included for expansion.
C types C types
======= =======
@ -614,6 +628,97 @@ are still some caveats to beware of
QEMU Specific Idioms QEMU Specific Idioms
******************** ********************
QEMU Object Model Declarations
==============================
The QEMU Object Model (QOM) provides a framework for handling objects
in the base C language. The first declaration of a storage or class
structure should always be the parent and leave a visual space between
that declaration and the new code. It is also useful to separate
backing for properties (options driven by the user) and internal state
to make navigation easier.
For a storage structure the first declaration should always be called
"parent_obj" and for a class structure the first member should always
be called "parent_class" as below:
.. code-block:: c
struct MyDeviceState {
DeviceState parent_obj;
/* Properties */
int prop_a;
char *prop_b;
/* Other stuff */
int internal_state;
};
struct MyDeviceClass {
DeviceClass parent_class;
void (*new_fn1)(void);
bool (*new_fn2)(CPUState *);
};
Note that there is no need to provide typedefs for QOM structures
since these are generated automatically by the QOM declaration macros.
See :ref:`qom` for more details.
QEMU GUARD macros
=================
QEMU provides a number of ``_GUARD`` macros intended to make the
handling of multiple exit paths easier. For example using
``QEMU_LOCK_GUARD`` to take a lock will ensure the lock is released on
exit from the function.
.. code-block:: c
static int my_critical_function(SomeState *s, void *data)
{
QEMU_LOCK_GUARD(&s->lock);
do_thing1(data);
if (check_state2(data)) {
return -1;
}
do_thing3(data);
return 0;
}
will ensure s->lock is released however the function is exited. The
equivalent code without _GUARD macro makes us to carefully put
qemu_mutex_unlock() on all exit points:
.. code-block:: c
static int my_critical_function(SomeState *s, void *data)
{
qemu_mutex_lock(&s->lock);
do_thing1(data);
if (check_state2(data)) {
qemu_mutex_unlock(&s->lock);
return -1;
}
do_thing3(data);
qemu_mutex_unlock(&s->lock);
return 0;
}
There are often ``WITH_`` forms of macros which more easily wrap
around a block inside a function.
.. code-block:: c
WITH_RCU_READ_LOCK_GUARD() {
QTAILQ_FOREACH_RCU(kid, &bus->children, sibling) {
err = do_the_thing(kid->child);
if (err < 0) {
return err;
}
}
}
Error handling and reporting Error handling and reporting
============================ ============================

View File

@ -14,7 +14,7 @@ The guest loader does two things:
- load blobs (kernels and initial ram disks) into memory - load blobs (kernels and initial ram disks) into memory
- sets platform FDT data so hypervisors can find and boot them - sets platform FDT data so hypervisors can find and boot them
This is what is typically done by a boot-loader like grub using it's This is what is typically done by a boot-loader like grub using its
multi-boot capability. A typical example would look like: multi-boot capability. A typical example would look like:
.. parsed-literal:: .. parsed-literal::
@ -25,9 +25,9 @@ multi-boot capability. A typical example would look like:
-device guest-loader,addr=0x47000000,initrd=rootfs.cpio -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
In the above example the Xen hypervisor is loaded by the -kernel In the above example the Xen hypervisor is loaded by the -kernel
parameter and passed it's boot arguments via -append. The Dom0 guest parameter and passed its boot arguments via -append. The Dom0 guest
is loaded into the areas of memory. Each blob will get is loaded into the areas of memory. Each blob will get
``/chosen/module@<addr>`` entry in the FDT to indicate it's location and ``/chosen/module@<addr>`` entry in the FDT to indicate its location and
size. Additional information can be passed with by using additional size. Additional information can be passed with by using additional
arguments. arguments.

View File

@ -405,15 +405,22 @@ SRST
-numa node,nodeid=0 -numa node,nodeid=1 \ -numa node,nodeid=0 -numa node,nodeid=1 \
-numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
Legacy '\ ``mem``\ ' assigns a given RAM amount to a node (not supported '\ ``memdev``\ ' option assigns RAM from a given memory backend
for 5.1 and newer machine types). '\ ``memdev``\ ' assigns RAM from device to a node. It is recommended to use '\ ``memdev``\ ' option
a given memory backend device to a node. If '\ ``mem``\ ' and over legacy '\ ``mem``\ ' option. This is because '\ ``memdev``\ '
'\ ``memdev``\ ' are omitted in all nodes, RAM is split equally between them. option provides better performance and more control over the
backend's RAM (e.g. '\ ``prealloc``\ ' parameter of
'\ ``-memory-backend-ram``\ ' allows memory preallocation).
For compatibility reasons, legacy '\ ``mem``\ ' option is
supported in 5.0 and older machine types. Note that '\ ``mem``\ '
and '\ ``memdev``\ ' are mutually exclusive. If one node uses
'\ ``memdev``\ ', the rest nodes have to use '\ ``memdev``\ '
option, and vice versa.
'\ ``mem``\ ' and '\ ``memdev``\ ' are mutually exclusive. Users must specify memory for all NUMA nodes by '\ ``memdev``\ '
Furthermore, if one node uses '\ ``memdev``\ ', all of them have to (or legacy '\ ``mem``\ ' if available). In QEMU 5.2, the support
use it. for '\ ``-numa node``\ ' without memory specified was removed.
'\ ``initiator``\ ' is an additional option that points to an '\ ``initiator``\ ' is an additional option that points to an
initiator NUMA node that has best performance (the lowest latency or initiator NUMA node that has best performance (the lowest latency or
@ -1143,10 +1150,22 @@ have gone through several iterations as the feature set and complexity
of the block layer have grown. Many online guides to QEMU often of the block layer have grown. Many online guides to QEMU often
reference older and deprecated options, which can lead to confusion. reference older and deprecated options, which can lead to confusion.
The recommended modern way to describe disks is to use a combination of The most explicit way to describe disks is to use a combination of
``-device`` to specify the hardware device and ``-blockdev`` to ``-device`` to specify the hardware device and ``-blockdev`` to
describe the backend. The device defines what the guest sees and the describe the backend. The device defines what the guest sees and the
backend describes how QEMU handles the data. backend describes how QEMU handles the data. It is the only guaranteed
stable interface for describing block devices and as such is
recommended for management tools and scripting.
The ``-drive`` option combines the device and backend into a single
command line option which is a more human friendly. There is however no
interface stability guarantee although some older board models still
need updating to work with the modern blockdev forms.
Older options like ``-hda`` are essentially macros which expand into
``-drive`` options for various drive interfaces. The original forms
bake in a lot of assumptions from the days when QEMU was emulating a
legacy PC, they are not recommended for modern configurations.
ERST ERST
@ -1639,6 +1658,14 @@ SRST
the raw disk image you use is not written back. You can however the raw disk image you use is not written back. You can however
force the write back by pressing C-a s (see the :ref:`disk images` force the write back by pressing C-a s (see the :ref:`disk images`
chapter in the System Emulation Users Guide). chapter in the System Emulation Users Guide).
.. warning::
snapshot is incompatible with ``-blockdev`` (instead use qemu-img
to manually create snapshot images to attach to your blockdev).
If you have mixed ``-blockdev`` and ``-drive`` declarations you
can use the 'snapshot' property on your drive declarations
instead of this global option.
ERST ERST
DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev, DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,

View File

@ -397,7 +397,7 @@ def binariesToTest(args, testcase):
def accelsToTest(args, testcase): def accelsToTest(args, testcase):
if getBinaryInfo(args, testcase['binary']).kvm_available: if getBinaryInfo(args, testcase['binary']).kvm_available and not args.tcg_only:
yield 'kvm' yield 'kvm'
yield 'tcg' yield 'tcg'
@ -510,6 +510,8 @@ def main():
help="Full mode: test cases that are expected to fail") help="Full mode: test cases that are expected to fail")
parser.add_argument('--strict', action='store_true', dest='strict', parser.add_argument('--strict', action='store_true', dest='strict',
help="Treat all warnings as fatal") help="Treat all warnings as fatal")
parser.add_argument('--tcg-only', action='store_true', dest='tcg_only',
help="Only test with TCG accelerator")
parser.add_argument('qemu', nargs='*', metavar='QEMU', parser.add_argument('qemu', nargs='*', metavar='QEMU',
help='QEMU binary to run') help='QEMU binary to run')
args = parser.parse_args() args = parser.parse_args()

View File

@ -138,14 +138,18 @@ get-vm-image-fedora-31-%: check-venv
# download all vm images, according to defined targets # download all vm images, according to defined targets
get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
JOBS_OPTION=$(lastword -j1 $(filter-out -j, $(filter -j%,$(MAKEFLAGS))))
check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
$(call quiet-command, \ $(call quiet-command, \
$(TESTS_PYTHON) -m avocado \ $(TESTS_PYTHON) -m avocado \
--show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
$(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \ $(if $(AVOCADO_TAGS),, \
--filter-by-tags-include-empty-key) \ --filter-by-tags-include-empty \
$(AVOCADO_CMDLINE_TAGS) \ --filter-by-tags-include-empty-key) \
$(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \ --max-parallel-tasks $(JOBS_OPTION:-j%=%) \
$(AVOCADO_CMDLINE_TAGS) \
$(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
"AVOCADO", "tests/avocado") "AVOCADO", "tests/avocado")
check-acceptance-deprecated-warning: check-acceptance-deprecated-warning:

View File

@ -330,6 +330,19 @@ class QemuSystemTest(QemuBaseTest):
vm.add_args(*args) vm.add_args(*args)
return vm return vm
def get_qemu_img(self):
self.log.debug('Looking for and selecting a qemu-img binary')
# If qemu-img has been built, use it, otherwise the system wide one
# will be used.
qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
if not os.path.exists(qemu_img):
qemu_img = find_command('qemu-img', False)
if qemu_img is False:
self.cancel('Could not find "qemu-img"')
return qemu_img
@property @property
def vm(self): def vm(self):
return self.get_vm(name='default') return self.get_vm(name='default')
@ -431,6 +444,14 @@ class LinuxSSHMixIn:
f'Guest command failed: {command}') f'Guest command failed: {command}')
return stdout_lines, stderr_lines return stdout_lines, stderr_lines
def ssh_command_output_contains(self, cmd, exp):
stdout, _ = self.ssh_command(cmd)
for line in stdout:
if exp in line:
break
else:
self.fail('"%s" output does not contain "%s"' % (cmd, exp))
class LinuxDistro: class LinuxDistro:
"""Represents a Linux distribution """Represents a Linux distribution
@ -594,17 +615,9 @@ class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
return (ssh_public_key, ssh_private_key) return (ssh_public_key, ssh_private_key)
def download_boot(self): def download_boot(self):
self.log.debug('Looking for and selecting a qemu-img binary to be ' # Set the qemu-img binary.
'used to create the bootable snapshot image') # If none is available, the test will cancel.
# If qemu-img has been built, use it, otherwise the system wide one vmimage.QEMU_IMG = super().get_qemu_img()
# will be used. If none is available, the test will cancel.
qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
if not os.path.exists(qemu_img):
qemu_img = find_command('qemu-img', False)
if qemu_img is False:
self.cancel('Could not find "qemu-img", which is required to '
'create the bootable image')
vmimage.QEMU_IMG = qemu_img
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

View File

@ -101,14 +101,6 @@ class LinuxSSH(QemuSystemTest, LinuxSSHMixIn):
self.ssh_disconnect_vm() self.ssh_disconnect_vm()
wait_for_console_pattern(self, 'Power down', 'Oops') wait_for_console_pattern(self, 'Power down', 'Oops')
def ssh_command_output_contains(self, cmd, exp):
stdout, _ = self.ssh_command(cmd)
for line in stdout:
if exp in line:
break
else:
self.fail('"%s" output does not contain "%s"' % (cmd, exp))
def run_common_commands(self, wordsize): def run_common_commands(self, wordsize):
self.ssh_command_output_contains( self.ssh_command_output_contains(
'cat /proc/cpuinfo', 'cat /proc/cpuinfo',

View File

@ -0,0 +1,158 @@
# Functional test that boots a Linux kernel and checks the console
#
# SPDX-FileCopyrightText: 2023 Linaro Ltd.
# SPDX-FileContributor: Philippe Mathieu-Daudé <philmd@linaro.org>
# SPDX-FileContributor: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
import os
from avocado import skip
from avocado import skipUnless
from avocado.utils import archive
from avocado_qemu import QemuSystemTest
from avocado_qemu import wait_for_console_pattern
from avocado_qemu import interrupt_interactive_console_until_pattern
class Aarch64SbsarefMachine(QemuSystemTest):
"""
:avocado: tags=arch:aarch64
:avocado: tags=machine:sbsa-ref
"""
timeout = 180
def fetch_firmware(self):
"""
Flash volumes generated using:
- Fedora GNU Toolchain version 12.2.1 20220819 (Red Hat Cross 12.2.1-2)
- Trusted Firmware-A
https://github.com/ARM-software/arm-trusted-firmware/tree/5fdb2e54
- Tianocore EDK II
https://github.com/tianocore/edk2/tree/494127613b
https://github.com/tianocore/edk2-non-osi/tree/41876073
https://github.com/tianocore/edk2-platforms/tree/8efa4f42
"""
# Secure BootRom (TF-A code)
fs0_xz_url = (
"https://fileserver.linaro.org/s/ATnSmq6k8SoXgbH/"
"download/SBSA_FLASH0.fd.xz"
)
fs0_xz_hash = "a210a09692bcbe0a3743ffd0df44e80e0c7ad8ab"
tar_xz_path = self.fetch_asset(fs0_xz_url, asset_hash=fs0_xz_hash)
archive.extract(tar_xz_path, self.workdir)
fs0_path = os.path.join(self.workdir, "SBSA_FLASH0.fd")
# Non-secure rom (UEFI and EFI variables)
fs1_xz_url = (
"https://fileserver.linaro.org/s/t8foNnMPz74DZZy/"
"download/SBSA_FLASH1.fd.xz"
)
fs1_xz_hash = "13a9a262953787c7fc5a9155dfaa26e703631e02"
tar_xz_path = self.fetch_asset(fs1_xz_url, asset_hash=fs1_xz_hash)
archive.extract(tar_xz_path, self.workdir)
fs1_path = os.path.join(self.workdir, "SBSA_FLASH1.fd")
for path in [fs0_path, fs1_path]:
with open(path, "ab+") as fd:
fd.truncate(256 << 20) # Expand volumes to 256MiB
self.vm.set_console()
self.vm.add_args(
"-drive",
f"if=pflash,file={fs0_path},format=raw",
"-drive",
f"if=pflash,file={fs1_path},format=raw",
"-smp",
"1",
"-machine",
"sbsa-ref",
)
def test_sbsaref_edk2_firmware(self):
"""
:avocado: tags=cpu:cortex-a57
"""
self.fetch_firmware()
self.vm.launch()
# TF-A boot sequence:
#
# https://github.com/ARM-software/arm-trusted-firmware/blob/v2.8.0/\
# docs/design/trusted-board-boot.rst#trusted-board-boot-sequence
# https://trustedfirmware-a.readthedocs.io/en/v2.8/\
# design/firmware-design.html#cold-boot
# AP Trusted ROM
wait_for_console_pattern(self, "Booting Trusted Firmware")
wait_for_console_pattern(self, "BL1: v2.8(release):v2.8")
wait_for_console_pattern(self, "BL1: Booting BL2")
# Trusted Boot Firmware
wait_for_console_pattern(self, "BL2: v2.8(release)")
wait_for_console_pattern(self, "Booting BL31")
# EL3 Runtime Software
wait_for_console_pattern(self, "BL31: v2.8(release)")
# Non-trusted Firmware
wait_for_console_pattern(self, "UEFI firmware (version 1.0")
interrupt_interactive_console_until_pattern(self, "QEMU SBSA-REF Machine")
# This tests the whole boot chain from EFI to Userspace
# We only boot a whole OS for the current top level CPU and GIC
# Other test profiles should use more minimal boots
def boot_alpine_linux(self, cpu):
self.fetch_firmware()
iso_url = (
"https://dl-cdn.alpinelinux.org/"
"alpine/v3.17/releases/aarch64/alpine-standard-3.17.2-aarch64.iso"
)
iso_hash = "5a36304ecf039292082d92b48152a9ec21009d3a62f459de623e19c4bd9dc027"
iso_path = self.fetch_asset(iso_url, algorithm="sha256", asset_hash=iso_hash)
self.vm.set_console()
self.vm.add_args(
"-cpu",
cpu,
"-drive",
f"file={iso_path},format=raw",
"-device",
"virtio-rng-pci,rng=rng0",
"-object",
"rng-random,id=rng0,filename=/dev/urandom",
)
self.vm.launch()
wait_for_console_pattern(self, "Welcome to Alpine Linux 3.17")
@skipUnless(os.getenv("AVOCADO_TIMEOUT_EXPECTED"), "Test might timeout")
def test_sbsaref_alpine_linux_cortex_a57(self):
"""
:avocado: tags=cpu:cortex-a57
"""
self.boot_alpine_linux("cortex-a57")
@skipUnless(os.getenv("AVOCADO_TIMEOUT_EXPECTED"), "Test might timeout")
def test_sbsaref_alpine_linux_neoverse_n1(self):
"""
:avocado: tags=cpu:max
"""
self.boot_alpine_linux("neoverse-n1")
@skip("requires TF-A update to handle FEAT_FGT")
def test_sbsaref_alpine_linux_max(self):
"""
:avocado: tags=cpu:max
"""
self.boot_alpine_linux("max,pauth-impdef=on")

View File

@ -10,6 +10,7 @@ import os
import tempfile import tempfile
import subprocess import subprocess
from avocado_qemu import LinuxSSHMixIn
from avocado_qemu import QemuSystemTest from avocado_qemu import QemuSystemTest
from avocado_qemu import wait_for_console_pattern from avocado_qemu import wait_for_console_pattern
from avocado_qemu import exec_command from avocado_qemu import exec_command
@ -268,7 +269,7 @@ class AST2x00Machine(QemuSystemTest):
self.do_test_arm_aspeed_buildroot_poweroff() self.do_test_arm_aspeed_buildroot_poweroff()
class AST2x00MachineSDK(QemuSystemTest): class AST2x00MachineSDK(QemuSystemTest, LinuxSSHMixIn):
EXTRA_BOOTARGS = ( EXTRA_BOOTARGS = (
'quiet ' 'quiet '
@ -295,7 +296,7 @@ class AST2x00MachineSDK(QemuSystemTest):
self.require_netdev('user') self.require_netdev('user')
self.vm.set_console() self.vm.set_console()
self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw', self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
'-net', 'nic', '-net', 'user') '-net', 'nic', '-net', 'user,hostfwd=:127.0.0.1:0-:22')
self.vm.launch() self.vm.launch()
self.wait_for_console_pattern('U-Boot 2019.04') self.wait_for_console_pattern('U-Boot 2019.04')
@ -323,7 +324,7 @@ class AST2x00MachineSDK(QemuSystemTest):
self.do_test_arm_aspeed_sdk_start( self.do_test_arm_aspeed_sdk_start(
self.workdir + '/ast2500-default/image-bmc') self.workdir + '/ast2500-default/image-bmc')
self.wait_for_console_pattern('ast2500-default login:') self.wait_for_console_pattern('nodistro.0 ast2500-default ttyS4')
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab') @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
def test_arm_ast2600_evb_sdk(self): def test_arm_ast2600_evb_sdk(self):
@ -345,22 +346,25 @@ class AST2x00MachineSDK(QemuSystemTest):
'ds1338,bus=aspeed.i2c.bus.5,address=0x32'); 'ds1338,bus=aspeed.i2c.bus.5,address=0x32');
self.do_test_arm_aspeed_sdk_start( self.do_test_arm_aspeed_sdk_start(
self.workdir + '/ast2600-default/image-bmc') self.workdir + '/ast2600-default/image-bmc')
self.wait_for_console_pattern('ast2600-default login:') self.wait_for_console_pattern('nodistro.0 ast2600-default ttyS4')
exec_command_and_wait_for_pattern(self, 'root', 'Password:')
exec_command_and_wait_for_pattern(self, '0penBmc', 'root@ast2600-default:~#')
exec_command_and_wait_for_pattern(self, self.ssh_connect('root', '0penBmc', False)
'echo lm75 0x4d > /sys/class/i2c-dev/i2c-5/device/new_device', self.ssh_command('dmesg -c > /dev/null')
self.ssh_command_output_contains(
'echo lm75 0x4d > /sys/class/i2c-dev/i2c-5/device/new_device ; '
'dmesg -c',
'i2c i2c-5: new_device: Instantiated device lm75 at 0x4d'); 'i2c i2c-5: new_device: Instantiated device lm75 at 0x4d');
exec_command_and_wait_for_pattern(self, self.ssh_command_output_contains(
'cat /sys/class/hwmon/hwmon19/temp1_input', '0') 'cat /sys/class/hwmon/hwmon19/temp1_input', '0')
self.vm.command('qom-set', path='/machine/peripheral/tmp-test', self.vm.command('qom-set', path='/machine/peripheral/tmp-test',
property='temperature', value=18000); property='temperature', value=18000);
exec_command_and_wait_for_pattern(self, self.ssh_command_output_contains(
'cat /sys/class/hwmon/hwmon19/temp1_input', '18000') 'cat /sys/class/hwmon/hwmon19/temp1_input', '18000')
exec_command_and_wait_for_pattern(self, self.ssh_command_output_contains(
'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-5/device/new_device', 'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-5/device/new_device ; '
'dmesg -c',
'i2c i2c-5: new_device: Instantiated device ds1307 at 0x32'); 'i2c i2c-5: new_device: Instantiated device ds1307 at 0x32');
year = time.strftime("%Y") year = time.strftime("%Y")
exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year); self.ssh_command_output_contains('/sbin/hwclock -f /dev/rtc1', year);

View File

@ -11,6 +11,7 @@
import os import os
import time import time
import tempfile
from avocado import skip, skipIf from avocado import skip, skipIf
from avocado_qemu import QemuSystemTest from avocado_qemu import QemuSystemTest
@ -72,25 +73,40 @@ class TuxRunBaselineTest(QemuSystemTest):
# Occasionally we need extra devices to hook things up # Occasionally we need extra devices to hook things up
self.extradev = self.get_tag('extradev') self.extradev = self.get_tag('extradev')
self.qemu_img = super().get_qemu_img()
def wait_for_console_pattern(self, success_message, vm=None): def wait_for_console_pattern(self, success_message, vm=None):
wait_for_console_pattern(self, success_message, wait_for_console_pattern(self, success_message,
failure_message='Kernel panic - not syncing', failure_message='Kernel panic - not syncing',
vm=vm) vm=vm)
def fetch_tuxrun_assets(self, dt=None): def fetch_tuxrun_assets(self, csums=None, dt=None):
""" """
Fetch the TuxBoot assets. They are stored in a standard way so we Fetch the TuxBoot assets. They are stored in a standard way so we
use the per-test tags to fetch details. use the per-test tags to fetch details.
""" """
base_url = f"https://storage.tuxboot.com/{self.tuxboot}/" base_url = f"https://storage.tuxboot.com/20230331/{self.tuxboot}/"
kernel_image = self.fetch_asset(base_url + self.image)
disk_image_zst = self.fetch_asset(base_url + "rootfs.ext4.zst") # empty hash if we weren't passed one
csums = {} if csums is None else csums
ksum = csums.get(self.image, None)
isum = csums.get("rootfs.ext4.zst", None)
kernel_image = self.fetch_asset(base_url + self.image,
asset_hash = ksum,
algorithm = "sha256")
disk_image_zst = self.fetch_asset(base_url + "rootfs.ext4.zst",
asset_hash = isum,
algorithm = "sha256")
cmd = f"{self.zstd} -d {disk_image_zst} -o {self.workdir}/rootfs.ext4" cmd = f"{self.zstd} -d {disk_image_zst} -o {self.workdir}/rootfs.ext4"
process.run(cmd) process.run(cmd)
if dt: if dt:
dtb = self.fetch_asset(base_url + dt) dsum = csums.get(dt, None)
dtb = self.fetch_asset(base_url + dt,
asset_hash = dsum,
algorithm = "sha256")
else: else:
dtb = None dtb = None
@ -149,7 +165,9 @@ class TuxRunBaselineTest(QemuSystemTest):
else: else:
self.vm.wait() self.vm.wait()
def common_tuxrun(self, dt=None, def common_tuxrun(self,
csums=None,
dt=None,
drive="virtio-blk-device", drive="virtio-blk-device",
haltmsg="reboot: System halted", haltmsg="reboot: System halted",
console_index=0): console_index=0):
@ -158,12 +176,69 @@ class TuxRunBaselineTest(QemuSystemTest):
special with the command line we can process most things using special with the command line we can process most things using
the tag metadata. the tag metadata.
""" """
(kernel, disk, dtb) = self.fetch_tuxrun_assets(dt) (kernel, disk, dtb) = self.fetch_tuxrun_assets(csums, dt)
self.prepare_run(kernel, disk, drive, dtb, console_index) self.prepare_run(kernel, disk, drive, dtb, console_index)
self.vm.launch() self.vm.launch()
self.run_tuxtest_tests(haltmsg) self.run_tuxtest_tests(haltmsg)
def ppc64_common_tuxrun(self, sums, prefix):
# add device args to command line.
self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
'-device', 'virtio-net,netdev=vnet')
self.vm.add_args('-netdev', '{"type":"user","id":"hostnet0"}',
'-device', '{"driver":"virtio-net-pci","netdev":'
'"hostnet0","id":"net0","mac":"52:54:00:4c:e3:86",'
'"bus":"pci.0","addr":"0x9"}')
self.vm.add_args('-device', '{"driver":"qemu-xhci","p2":15,"p3":15,'
'"id":"usb","bus":"pci.0","addr":"0x2"}')
self.vm.add_args('-device', '{"driver":"virtio-scsi-pci","id":"scsi0"'
',"bus":"pci.0","addr":"0x3"}')
self.vm.add_args('-device', '{"driver":"virtio-serial-pci","id":'
'"virtio-serial0","bus":"pci.0","addr":"0x4"}')
self.vm.add_args('-device', '{"driver":"scsi-cd","bus":"scsi0.0"'
',"channel":0,"scsi-id":0,"lun":0,"device_id":'
'"drive-scsi0-0-0-0","id":"scsi0-0-0-0"}')
self.vm.add_args('-device', '{"driver":"virtio-balloon-pci",'
'"id":"balloon0","bus":"pci.0","addr":"0x6"}')
self.vm.add_args('-audiodev', '{"id":"audio1","driver":"none"}')
self.vm.add_args('-device', '{"driver":"usb-tablet","id":"input0"'
',"bus":"usb.0","port":"1"}')
self.vm.add_args('-device', '{"driver":"usb-kbd","id":"input1"'
',"bus":"usb.0","port":"2"}')
self.vm.add_args('-device', '{"driver":"VGA","id":"video0",'
'"vgamem_mb":16,"bus":"pci.0","addr":"0x7"}')
self.vm.add_args('-object', '{"qom-type":"rng-random","id":"objrng0"'
',"filename":"/dev/urandom"}',
'-device', '{"driver":"virtio-rng-pci","rng":"objrng0"'
',"id":"rng0","bus":"pci.0","addr":"0x8"}')
self.vm.add_args('-object', '{"qom-type":"cryptodev-backend-builtin",'
'"id":"objcrypto0","queues":1}',
'-device', '{"driver":"virtio-crypto-pci",'
'"cryptodev":"objcrypto0","id":"crypto0","bus"'
':"pci.0","addr":"0xa"}')
self.vm.add_args('-device', '{"driver":"spapr-pci-host-bridge"'
',"index":1,"id":"pci.1"}')
self.vm.add_args('-device', '{"driver":"spapr-vscsi","id":"scsi1"'
',"reg":12288}')
self.vm.add_args('-m', '2G,slots=32,maxmem=4G',
'-object', 'memory-backend-ram,id=ram1,size=1G',
'-device', 'pc-dimm,id=dimm1,memdev=ram1')
# Create a temporary qcow2 and launch the test-case
with tempfile.NamedTemporaryFile(prefix=prefix,
suffix='.qcow2') as qcow2:
process.run(self.qemu_img + ' create -f qcow2 ' +
qcow2.name + ' 1G')
self.vm.add_args('-drive', 'file=' + qcow2.name +
',format=qcow2,if=none,id='
'drive-virtio-disk1',
'-device', 'virtio-blk-pci,scsi=off,bus=pci.0,'
'addr=0xb,drive=drive-virtio-disk1,id=virtio-disk1'
',bootindex=2')
self.common_tuxrun(csums=sums, drive="scsi-hd")
# #
# The tests themselves. The configuration is derived from how # The tests themselves. The configuration is derived from how
# tuxrun invokes qemu (with minor tweaks like using -blockdev # tuxrun invokes qemu (with minor tweaks like using -blockdev
@ -182,7 +257,11 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=console:ttyAMA0 :avocado: tags=console:ttyAMA0
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun() sums = {"Image" :
"ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7",
"rootfs.ext4.zst" :
"bbd5ed4b9c7d3f4ca19ba71a323a843c6b585e880115df3b7765769dbd9dd061"}
self.common_tuxrun(csums=sums)
def test_arm64be(self): def test_arm64be(self):
""" """
@ -194,7 +273,11 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=console:ttyAMA0 :avocado: tags=console:ttyAMA0
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun() sums = { "Image" :
"e0df4425eb2cd9ea9a283e808037f805641c65d8fcecc8f6407d8f4f339561b4",
"rootfs.ext4.zst" :
"e6ffd8813c8a335bc15728f2835f90539c84be7f8f5f691a8b01451b47fb4bd7"}
self.common_tuxrun(csums=sums)
def test_armv5(self): def test_armv5(self):
""" """
@ -206,7 +289,15 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=console:ttyAMA0 :avocado: tags=console:ttyAMA0
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="virtio-blk-pci", sums = { "rootfs.ext4.zst" :
"17177afa74e7294da0642861f08c88ca3c836764299a54bf6d1ce276cb9712a5",
"versatile-pb.dtb" :
"0bc0c0b0858cefd3c32b385c0d66d97142ded29472a496f4f490e42fc7615b25",
"zImage" :
"c95af2f27647c12265d75e9df44c22ff5228c59855f54aaa70f41ec2842e3a4d" }
self.common_tuxrun(csums=sums,
drive="virtio-blk-pci",
dt="versatile-pb.dtb") dt="versatile-pb.dtb")
def test_armv7(self): def test_armv7(self):
@ -219,7 +310,12 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=console:ttyAMA0 :avocado: tags=console:ttyAMA0
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun() sums = { "rootfs.ext4.zst" :
"ab1fbbeaddda1ffdd45c9405a28cd5370c20f23a7cbc809cc90dc9f243a8eb5a",
"zImage" :
"4c7a22e9f15875bec06bd2a29d822496571eb297d4f22694099ffcdb19077572" }
self.common_tuxrun(csums=sums)
def test_armv7be(self): def test_armv7be(self):
""" """
@ -232,7 +328,12 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=console:ttyAMA0 :avocado: tags=console:ttyAMA0
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun() sums = {"rootfs.ext4.zst" :
"42ed46dd2d59986206c5b1f6cf35eab58fe3fd20c96b41aaa16b32f3f90a9835",
"zImage" :
"7facc62082b57af12015b08f7fdbaf2f123ba07a478367853ae12b219afc9f2f" }
self.common_tuxrun(csums=sums)
def test_i386(self): def test_i386(self):
""" """
@ -243,7 +344,12 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=image:bzImage :avocado: tags=image:bzImage
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="virtio-blk-pci") sums = {"bzImage" :
"a3e5b32a354729e65910f5a1ffcda7c14a6c12a55e8213fb86e277f1b76ed956",
"rootfs.ext4.zst" :
"f15e66b2bf673a210ec2a4b2e744a80530b36289e04f5388aab812b97f69754a" }
self.common_tuxrun(csums=sums, drive="virtio-blk-pci")
def test_mips32(self): def test_mips32(self):
""" """
@ -256,7 +362,12 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=root:sda :avocado: tags=root:sda
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") sums = { "rootfs.ext4.zst" :
"fc3da0b4c2f38d74c6d705123bb0f633c76ed953128f9d0859378c328a6d11a0",
"vmlinux" :
"bfd2172f8b17fb32970ca0c8c58f59c5a4ca38aa5855d920be3a69b5d16e52f0" }
self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
def test_mips32el(self): def test_mips32el(self):
""" """
@ -268,7 +379,12 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=root:sda :avocado: tags=root:sda
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") sums = { "rootfs.ext4.zst" :
"e799768e289fd69209c21f4dacffa11baea7543d5db101e8ce27e3bc2c41d90e",
"vmlinux" :
"8573867c68a8443db8de6d08bb33fb291c189ca2ca671471d3973a3e712096a3" }
self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
def test_mips64(self): def test_mips64(self):
""" """
@ -280,7 +396,12 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=root:sda :avocado: tags=root:sda
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") sums = { "rootfs.ext4.zst" :
"69d91eeb04df3d8d172922c6993bb37d4deeb6496def75d8580f6f9de3e431da",
"vmlinux" :
"09010e51e4b8bcbbd2494786ffb48eca78f228e96e5c5438344b0eac4029dc61" }
self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
def test_mips64el(self): def test_mips64el(self):
""" """
@ -291,7 +412,12 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=root:sda :avocado: tags=root:sda
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") sums = { "rootfs.ext4.zst" :
"fba585368f5915b1498ed081863474b2d7ec4e97cdd46d21bdcb2f9698f83de4",
"vmlinux" :
"d4e08965e2155c4cccce7c5f34d18fe34c636cda2f2c9844387d614950155266" }
self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
def test_ppc32(self): def test_ppc32(self):
""" """
@ -302,13 +428,18 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=image:uImage :avocado: tags=image:uImage
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="virtio-blk-pci") sums = { "rootfs.ext4.zst" :
"8885b9d999cc24d679542a02e9b6aaf48f718f2050ece6b8347074b6ee41dd09",
"uImage" :
"1a68f74b860fda022fb12e03c5efece8c2b8b590d96cca37a8481a3ae0b3f81f" }
self.common_tuxrun(csums=sums, drive="virtio-blk-pci")
def test_ppc64(self): def test_ppc64(self):
""" """
:avocado: tags=arch:ppc64 :avocado: tags=arch:ppc64
:avocado: tags=machine:pseries :avocado: tags=machine:pseries
:avocado: tags=cpu:POWER8 :avocado: tags=cpu:POWER10
:avocado: tags=endian:big :avocado: tags=endian:big
:avocado: tags=console:hvc0 :avocado: tags=console:hvc0
:avocado: tags=tuxboot:ppc64 :avocado: tags=tuxboot:ppc64
@ -316,20 +447,28 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=extradev:driver=spapr-vscsi :avocado: tags=extradev:driver=spapr-vscsi
:avocado: tags=root:sda :avocado: tags=root:sda
""" """
self.common_tuxrun(drive="scsi-hd") sums = { "rootfs.ext4.zst" :
"1d953e81a4379e537fc8e41e05a0a59d9b453eef97aa03d47866c6c45b00bdff",
"vmlinux" :
"f22a9b9e924174a4c199f4c7e5d91a2339fcfe51c6eafd0907dc3e09b64ab728" }
self.ppc64_common_tuxrun(sums, prefix='tuxrun_ppc64_')
def test_ppc64le(self): def test_ppc64le(self):
""" """
:avocado: tags=arch:ppc64 :avocado: tags=arch:ppc64
:avocado: tags=machine:pseries :avocado: tags=machine:pseries
:avocado: tags=cpu:POWER8 :avocado: tags=cpu:POWER10
:avocado: tags=console:hvc0 :avocado: tags=console:hvc0
:avocado: tags=tuxboot:ppc64le :avocado: tags=tuxboot:ppc64le
:avocado: tags=image:vmlinux :avocado: tags=image:vmlinux
:avocado: tags=extradev:driver=spapr-vscsi :avocado: tags=extradev:driver=spapr-vscsi
:avocado: tags=root:sda :avocado: tags=root:sda
""" """
self.common_tuxrun(drive="scsi-hd") sums = { "rootfs.ext4.zst" :
"b442678c93fb8abe1f7d3bfa20556488de6b475c22c8fed363f42cf81a0a3906",
"vmlinux" :
"979eb61b445a010fb13e2b927126991f8ceef9c590fa2be0996c00e293e80cf2" }
self.ppc64_common_tuxrun(sums, prefix='tuxrun_ppc64le_')
def test_riscv32(self): def test_riscv32(self):
""" """
@ -337,7 +476,14 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=machine:virt :avocado: tags=machine:virt
:avocado: tags=tuxboot:riscv32 :avocado: tags=tuxboot:riscv32
""" """
self.common_tuxrun() sums = { "Image" :
"89599407d7334de629a40e7ad6503c73670359eb5f5ae9d686353a3d6deccbd5",
"fw_jump.elf" :
"f2ef28a0b77826f79d085d3e4aa686f1159b315eff9099a37046b18936676985",
"rootfs.ext4.zst" :
"7168d296d0283238ea73cd5a775b3dd608e55e04c7b92b76ecce31bb13108cba" }
self.common_tuxrun(csums=sums)
def test_riscv64(self): def test_riscv64(self):
""" """
@ -345,7 +491,14 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=machine:virt :avocado: tags=machine:virt
:avocado: tags=tuxboot:riscv64 :avocado: tags=tuxboot:riscv64
""" """
self.common_tuxrun() sums = { "Image" :
"cd634badc65e52fb63465ec99e309c0de0369f0841b7d9486f9729e119bac25e",
"fw_jump.elf" :
"6e3373abcab4305fe151b564a4c71110d833c21f2c0a1753b7935459e36aedcf",
"rootfs.ext4.zst" :
"b18e3a3bdf27be03da0b285e84cb71bf09eca071c3a087b42884b6982ed679eb" }
self.common_tuxrun(csums=sums)
def test_s390(self): def test_s390(self):
""" """
@ -355,7 +508,13 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=image:bzImage :avocado: tags=image:bzImage
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="virtio-blk-ccw", sums = { "bzImage" :
"0414e98dd1c3dafff8496c9cd9c28a5f8d04553bb5ba37e906a812b48d442ef0",
"rootfs.ext4.zst" :
"88c37c32276677f873a25ab9ec6247895b8e3e6f8259134de2a616080b8ab3fc" }
self.common_tuxrun(csums=sums,
drive="virtio-blk-ccw",
haltmsg="Requesting system halt") haltmsg="Requesting system halt")
# Note: some segfaults caused by unaligned userspace access # Note: some segfaults caused by unaligned userspace access
@ -370,9 +529,14 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=root:sda :avocado: tags=root:sda
:avocado: tags=console:ttySC1 :avocado: tags=console:ttySC1
""" """
sums = { "rootfs.ext4.zst" :
"3592a7a3d5a641e8b9821449e77bc43c9904a56c30d45da0694349cfd86743fd",
"zImage" :
"29d9b2aba604a0f53a5dc3b5d0f2b8e35d497de1129f8ee5139eb6fdf0db692f" }
# The test is currently too unstable to do much in userspace # The test is currently too unstable to do much in userspace
# so we skip common_tuxrun and do a minimal boot and shutdown. # so we skip common_tuxrun and do a minimal boot and shutdown.
(kernel, disk, dtb) = self.fetch_tuxrun_assets() (kernel, disk, dtb) = self.fetch_tuxrun_assets(csums=sums)
# the console comes on the second serial port # the console comes on the second serial port
self.prepare_run(kernel, disk, self.prepare_run(kernel, disk,
@ -395,7 +559,13 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=root:sda :avocado: tags=root:sda
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0")
sums = { "rootfs.ext4.zst" :
"ad2f1dc436ab51583543d25d2c210cab478645d47078d30d129a66ab0e281d76",
"vmlinux" :
"e34313e4325ff21deaa3d38a502aa09a373ef62b9bd4d7f8f29388b688225c55" }
self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")
def test_x86_64(self): def test_x86_64(self):
""" """
@ -407,4 +577,10 @@ class TuxRunBaselineTest(QemuSystemTest):
:avocado: tags=root:sda :avocado: tags=root:sda
:avocado: tags=shutdown:nowait :avocado: tags=shutdown:nowait
""" """
self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") sums = { "bzImage" :
"2bc7480a669ee9b6b82500a236aba0c54233debe98cb968268fa230f52f03461",
"rootfs.ext4.zst" :
"b72ac729769b8f51c6dffb221113c9a063c774dbe1d66af30eb593c4e9999b4b" }
self.common_tuxrun(csums=sums,
drive="driver=ide-hd,bus=ide.0,unit=0")

View File

@ -182,7 +182,6 @@ try:
# #
# Cirrus packages lists for GitLab # Cirrus packages lists for GitLab
# #
generate_cirrus("freebsd-12")
generate_cirrus("freebsd-13") generate_cirrus("freebsd-13")
generate_cirrus("macos-12") generate_cirrus("macos-12")

View File

@ -2,5 +2,5 @@
# in the tests/venv Python virtual environment. For more info, # in the tests/venv Python virtual environment. For more info,
# refer to: https://pip.pypa.io/en/stable/user_guide/#id1 # refer to: https://pip.pypa.io/en/stable/user_guide/#id1
# Note that qemu.git/python/ is always implicitly installed. # Note that qemu.git/python/ is always implicitly installed.
avocado-framework==88.1 avocado-framework==101.0
pycdlib==1.11.0 pycdlib==1.11.0

View File

@ -152,13 +152,17 @@ PLUGINS=$(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c)))
# We need to ensure expand the run-plugin-TEST-with-PLUGIN # We need to ensure expand the run-plugin-TEST-with-PLUGIN
# pre-requistes manually here as we can't use stems to handle it. We # pre-requistes manually here as we can't use stems to handle it. We
# also add some special helpers the run-plugin- rules can use bellow. # only expand MULTIARCH_TESTS which are common on most of our targets
# to avoid an exponential explosion as new tests are added. We also
# add some special helpers the run-plugin- rules can use bellow.
ifneq ($(MULTIARCH_TESTS),)
$(foreach p,$(PLUGINS), \ $(foreach p,$(PLUGINS), \
$(foreach t,$(TESTS),\ $(foreach t,$(MULTIARCH_TESTS),\
$(eval run-plugin-$(t)-with-$(p): $t $p) \ $(eval run-plugin-$(t)-with-$(p): $t $p) \
$(eval RUN_TESTS+=run-plugin-$(t)-with-$(p)))) $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
endif endif # MULTIARCH_TESTS
endif # CONFIG_PLUGIN
strip-plugin = $(wordlist 1, 1, $(subst -with-, ,$1)) strip-plugin = $(wordlist 1, 1, $(subst -with-, ,$1))
extract-plugin = $(wordlist 2, 2, $(subst -with-, ,$1)) extract-plugin = $(wordlist 2, 2, $(subst -with-, ,$1))

View File

@ -81,6 +81,4 @@ pauth-3:
$(call skip-test, "BUILD of $@", "missing compiler support") $(call skip-test, "BUILD of $@", "missing compiler support")
run-pauth-3: run-pauth-3:
$(call skip-test, "RUN of pauth-3", "not built") $(call skip-test, "RUN of pauth-3", "not built")
run-plugin-pauth-3-with-%:
$(call skip-test, "RUN of pauth-3 ($*)", "not built")
endif endif

View File

@ -32,7 +32,6 @@ ifneq ($(CROSS_CC_HAS_ARMV8_3),)
AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5 AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5
pauth-%: CFLAGS += -march=armv8.3-a pauth-%: CFLAGS += -march=armv8.3-a
run-pauth-%: QEMU_OPTS += -cpu max run-pauth-%: QEMU_OPTS += -cpu max
run-plugin-pauth-%: QEMU_OPTS += -cpu max
endif endif
# BTI Tests # BTI Tests

View File

@ -23,4 +23,6 @@ LDFLAGS+=-nostdlib -N -static
test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 -mfloat-abi=soft test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 -mfloat-abi=soft
run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel
run-plugin-test-armv6m-undef-%: QEMU_OPTS+=-semihosting -M microbit -kernel
# We don't currently support the multiarch system tests
undefine MULTIARCH_TESTS

View File

@ -46,11 +46,6 @@ semihosting-arm: semihosting.c
run-semihosting-arm: semihosting-arm run-semihosting-arm: semihosting-arm
$(call run-test,$<,$(QEMU) $< 2> $<.err) $(call run-test,$<,$(QEMU) $< 2> $<.err)
run-plugin-semihosting-arm-with-%:
$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
$(call strip-plugin,$<) 2> $<.err)
ARM_TESTS += semiconsole-arm ARM_TESTS += semiconsole-arm
semiconsole: CFLAGS += -mthumb semiconsole: CFLAGS += -mthumb
@ -62,9 +57,6 @@ semiconsole-arm: semihosting.c
run-semiconsole-arm: semiconsole-arm run-semiconsole-arm: semiconsole-arm
$(call skip-test, $<, "MANUAL ONLY") $(call skip-test, $<, "MANUAL ONLY")
run-plugin-semiconsole-arm-with-%:
$(call skip-test, $<, "MANUAL ONLY")
endif endif
ARM_TESTS += commpage ARM_TESTS += commpage

View File

@ -57,3 +57,6 @@ SIMG:=cris-axis-linux-gnu-run
# e.g.: make -f ../../tests/tcg/Makefile run-check_orm-on-sim # e.g.: make -f ../../tests/tcg/Makefile run-check_orm-on-sim
run-%-on-sim: run-%-on-sim:
$(call run-test, $<, $(SIMG) $<) $(call run-test, $<, $(SIMG) $<)
# We don't currently support the multiarch tests
undefine MULTIARCH_TESTS

View File

@ -10,8 +10,6 @@ EXTRA_RUNS+=run-test-mmap-4096 # run-test-mmap-16384 run-test-mmap-65536
# it requires the full vdso with dwarf2 unwind info. # it requires the full vdso with dwarf2 unwind info.
run-signals: signals run-signals: signals
$(call skip-test, $<, "BROKEN awaiting vdso support") $(call skip-test, $<, "BROKEN awaiting vdso support")
run-plugin-signals-with-%:
$(call skip-test, $<, "BROKEN awaiting vdso support")
VPATH += $(SRC_PATH)/tests/tcg/hppa VPATH += $(SRC_PATH)/tests/tcg/hppa
TESTS += stby TESTS += stby

View File

@ -18,19 +18,15 @@ X86_64_TESTS:=$(filter test-i386-adcox test-i386-bmi2 $(SKIP_I386_TESTS), $(ALL_
test-i386-sse-exceptions: CFLAGS += -msse4.1 -mfpmath=sse test-i386-sse-exceptions: CFLAGS += -msse4.1 -mfpmath=sse
run-test-i386-sse-exceptions: QEMU_OPTS += -cpu max run-test-i386-sse-exceptions: QEMU_OPTS += -cpu max
run-plugin-test-i386-sse-exceptions-%: QEMU_OPTS += -cpu max
test-i386-pcmpistri: CFLAGS += -msse4.2 test-i386-pcmpistri: CFLAGS += -msse4.2
run-test-i386-pcmpistri: QEMU_OPTS += -cpu max run-test-i386-pcmpistri: QEMU_OPTS += -cpu max
run-plugin-test-i386-pcmpistri-%: QEMU_OPTS += -cpu max
test-i386-bmi2: CFLAGS=-O2 test-i386-bmi2: CFLAGS=-O2
run-test-i386-bmi2: QEMU_OPTS += -cpu max run-test-i386-bmi2: QEMU_OPTS += -cpu max
run-plugin-test-i386-bmi2-%: QEMU_OPTS += -cpu max
test-i386-adcox: CFLAGS=-O2 test-i386-adcox: CFLAGS=-O2
run-test-i386-adcox: QEMU_OPTS += -cpu max run-test-i386-adcox: QEMU_OPTS += -cpu max
run-plugin-test-i386-adcox-%: QEMU_OPTS += -cpu max
# #
# hello-i386 is a barebones app # hello-i386 is a barebones app
@ -52,8 +48,6 @@ test-i386:
$(call skip-test, "BUILD of $@", "missing -no-pie compiler support") $(call skip-test, "BUILD of $@", "missing -no-pie compiler support")
run-test-i386: run-test-i386:
$(call skip-test, "RUN of test-i386", "not built") $(call skip-test, "RUN of test-i386", "not built")
run-plugin-test-i386-with-%:
$(call skip-test, "RUN of test-i386 ($*)", "not built")
endif endif
ifeq ($(SPEED), slow) ifeq ($(SPEED), slow)
@ -87,7 +81,6 @@ sha512-sse: sha512.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
run-sha512-sse: QEMU_OPTS+=-cpu max run-sha512-sse: QEMU_OPTS+=-cpu max
run-plugin-sha512-sse-with-%: QEMU_OPTS+=-cpu max
TESTS+=sha512-sse TESTS+=sha512-sse
@ -103,15 +96,12 @@ test-avx.h: test-avx.py x86.csv
test-3dnow: CFLAGS += -masm=intel -O -I. test-3dnow: CFLAGS += -masm=intel -O -I.
run-test-3dnow: QEMU_OPTS += -cpu max run-test-3dnow: QEMU_OPTS += -cpu max
run-plugin-test-3dnow: QEMU_OPTS += -cpu max
test-3dnow: test-3dnow.h test-3dnow: test-3dnow.h
test-mmx: CFLAGS += -masm=intel -O -I. test-mmx: CFLAGS += -masm=intel -O -I.
run-test-mmx: QEMU_OPTS += -cpu max run-test-mmx: QEMU_OPTS += -cpu max
run-plugin-test-mmx: QEMU_OPTS += -cpu max
test-mmx: test-mmx.h test-mmx: test-mmx.h
test-avx: CFLAGS += -mavx -masm=intel -O -I. test-avx: CFLAGS += -mavx -masm=intel -O -I.
run-test-avx: QEMU_OPTS += -cpu max run-test-avx: QEMU_OPTS += -cpu max
run-plugin-test-avx: QEMU_OPTS += -cpu max
test-avx: test-avx.h test-avx: test-avx.h

View File

@ -24,14 +24,12 @@ PPC64_TESTS += byte_reverse sha512-vector
endif endif
byte_reverse: CFLAGS += -mcpu=power10 byte_reverse: CFLAGS += -mcpu=power10
run-byte_reverse: QEMU_OPTS+=-cpu POWER10 run-byte_reverse: QEMU_OPTS+=-cpu POWER10
run-plugin-byte_reverse-with-%: QEMU_OPTS+=-cpu POWER10
sha512-vector: CFLAGS +=-mcpu=power10 -O3 sha512-vector: CFLAGS +=-mcpu=power10 -O3
sha512-vector: sha512.c sha512-vector: sha512.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
run-sha512-vector: QEMU_OPTS+=-cpu POWER10 run-sha512-vector: QEMU_OPTS+=-cpu POWER10
run-plugin-sha512-vector-with-%: QEMU_OPTS+=-cpu POWER10
PPC64_TESTS += signal_save_restore_xer PPC64_TESTS += signal_save_restore_xer
PPC64_TESTS += xxspltw PPC64_TESTS += xxspltw

View File

@ -19,3 +19,6 @@ QEMU_OPTS += -M virt -display none -semihosting -device loader,file=
EXTRA_RUNS += run-issue1060 EXTRA_RUNS += run-issue1060
run-issue1060: issue1060 run-issue1060: issue1060
$(call run-test, $<, $(QEMU) $(QEMU_OPTS)$<) $(call run-test, $<, $(QEMU) $(QEMU_OPTS)$<)
# We don't currently support the multiarch system tests
undefine MULTIARCH_TESTS

View File

@ -9,4 +9,3 @@ TESTS += noexec
TESTS += test-noc TESTS += test-noc
test-noc: LDFLAGS = -nostdlib -static test-noc: LDFLAGS = -nostdlib -static
run-test-noc: QEMU_OPTS += -cpu rv64,c=false run-test-noc: QEMU_OPTS += -cpu rv64,c=false
run-plugin-test-noc-%: QEMU_OPTS += -cpu rv64,c=false

View File

@ -23,3 +23,6 @@ include $(S390X_SRC)/pgm-specification.mak
$(PGM_SPECIFICATION_TESTS): pgm-specification-softmmu.o $(PGM_SPECIFICATION_TESTS): pgm-specification-softmmu.o
$(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-softmmu.o $(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-softmmu.o
TESTS += $(PGM_SPECIFICATION_TESTS) TESTS += $(PGM_SPECIFICATION_TESTS)
# We don't currently support the multiarch system tests
undefine MULTIARCH_TESTS

View File

@ -29,3 +29,6 @@ QEMU_OPTS += -M tricore_testboard -cpu tc27x -nographic -kernel
%.tst: %.o %.tst: %.o
$(LD) $(LDFLAGS) $< -o $@ $(LD) $(LDFLAGS) $< -o $@
# We don't currently support the multiarch system tests
undefine MULTIARCH_TESTS

View File

@ -41,3 +41,6 @@ $(XTENSA_USABLE_TESTS): linker.ld macros.inc $(CRT) Makefile.softmmu-target
$(CC) $(XTENSA_INC) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT) $(CC) $(XTENSA_INC) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT)
endif endif
# We don't currently support the multiarch system tests
undefine MULTIARCH_TESTS