Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-updat…
Browse files Browse the repository at this point in the history
…es-240221-1' into staging

Testing tweaks (build, docs, bumps)

  - expose cross compiler info in meson pretty print
  - bump Fedora to 33
  - "graceful" handling of missing virgl config
  - updates to the container documentation
  - move CODING_STYLE.rst into developer manual

# gpg: Signature made Wed 24 Feb 2021 11:08:03 GMT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-updates-240221-1:
  docs: move CODING_STYLE into the developer documentation
  docs/devel: add forward reference to check-tcg
  docs/devel: update the container based tests
  docs/devel: expand on use of containers to build tests
  tests/acceptance: allow a "graceful" failing for virtio-gpu test
  docker: Bump Fedora images to release 33
  meson.build: expose TCG cross compiler information in summary

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Feb 25, 2021
2 parents 51db2d7 + 93a1100 commit cbcf098
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 40 deletions.
4 changes: 3 additions & 1 deletion README.rst
Expand Up @@ -66,7 +66,9 @@ When submitting patches, one common approach is to use 'git
format-patch' and/or 'git send-email' to format & send the mail to the
qemu-devel@nongnu.org mailing list. All patches submitted must contain
a 'Signed-off-by' line from the author. Patches should follow the
guidelines set out in the CODING_STYLE.rst file.
guidelines set out in the `style section
<https://www.qemu.org/docs/master/devel/style.html>` of
the Developers Guide.

Additional information on submitting patches can be found online via
the QEMU website
Expand Down
1 change: 1 addition & 0 deletions docs/devel/index.rst
Expand Up @@ -14,6 +14,7 @@ Contents:
:maxdepth: 2

build-system
style
kconfig
testing
fuzzing
Expand Down
6 changes: 3 additions & 3 deletions CODING_STYLE.rst → docs/devel/style.rst
Expand Up @@ -641,22 +641,22 @@ trace-events style

In trace-events files, use a '0x' prefix to specify hex numbers, as in:

.. code-block::
.. code-block:: c
some_trace(unsigned x, uint64_t y) "x 0x%x y 0x" PRIx64
An exception is made for groups of numbers that are hexadecimal by
convention and separated by the symbols '.', '/', ':', or ' ' (such as
PCI bus id):

.. code-block::
.. code-block:: c
another_trace(int cssid, int ssid, int dev_num) "bus id: %x.%x.%04x"
However, you can use '0x' for such groups if you want. Anyway, be sure that
it is obvious that numbers are in hex, ex.:

.. code-block::
.. code-block:: c
data_dump(uint8_t c1, uint8_t c2, uint8_t c3) "bytes (in hex): %02x %02x %02x"
Expand Down
85 changes: 64 additions & 21 deletions docs/devel/testing.rst
Expand Up @@ -272,21 +272,28 @@ Note that the following group names have a special meaning:

- disabled: Tests in this group are disabled and ignored by check.

.. _docker-ref:
.. _container-ref:

Docker based tests
==================
Container based tests
=====================

Introduction
------------

The Docker testing framework in QEMU utilizes public Docker images to build and
test QEMU in predefined and widely accessible Linux environments. This makes
it possible to expand the test coverage across distros, toolchain flavors and
library versions.
The container testing framework in QEMU utilizes public images to
build and test QEMU in predefined and widely accessible Linux
environments. This makes it possible to expand the test coverage
across distros, toolchain flavors and library versions. The support
was originally written for Docker although we also support Podman as
an alternative container runtime. Although the many of the target
names and scripts are prefixed with "docker" the system will
automatically run on whichever is configured.

Prerequisites
-------------
The container images are also used to augment the generation of tests
for testing TCG. See :ref:`checktcg-ref` for more details.

Docker Prerequisites
--------------------

Install "docker" with the system package manager and start the Docker service
on your development machine, then make sure you have the privilege to run
Expand Down Expand Up @@ -316,26 +323,53 @@ Note that any one of above configurations makes it possible for the user to
exploit the whole host with Docker bind mounting or other privileged
operations. So only do it on development machines.

Podman Prerequisites
--------------------

Install "podman" with the system package manager.

.. code::
$ sudo dnf install podman
$ podman ps
The last command should print an empty table, to verify the system is ready.

Quickstart
----------

From source tree, type ``make docker`` to see the help. Testing can be started
without configuring or building QEMU (``configure`` and ``make`` are done in
the container, with parameters defined by the make target):
From source tree, type ``make docker-help`` to see the help. Testing
can be started without configuring or building QEMU (``configure`` and
``make`` are done in the container, with parameters defined by the
make target):

.. code::
make docker-test-build@min-glib
make docker-test-build@centos8
This will create a container instance using the ``min-glib`` image (the image
This will create a container instance using the ``centos8`` image (the image
is downloaded and initialized automatically), in which the ``test-build`` job
is executed.

Registry
--------

The QEMU project has a container registry hosted by GitLab at
``registry.gitlab.com/qemu-project/qemu`` which will automatically be
used to pull in pre-built layers. This avoids unnecessary strain on
the distro archives created by multiple developers running the same
container build steps over and over again. This can be overridden
locally by using the ``NOCACHE`` build option:

.. code::
make docker-image-debian10 NOCACHE=1
Images
------

Along with many other images, the ``min-glib`` image is defined in a Dockerfile
in ``tests/docker/dockerfiles/``, called ``min-glib.docker``. ``make docker``
Along with many other images, the ``centos8`` image is defined in a Dockerfile
in ``tests/docker/dockerfiles/``, called ``centos8.docker``. ``make docker-help``
command will list all the available images.

To add a new image, simply create a new ``.docker`` file under the
Expand All @@ -355,7 +389,7 @@ QEMU. Docker tests are the executables under ``tests/docker`` named
library, ``tests/docker/common.rc``, which provides helpers to find the QEMU
source and build it.

The full list of tests is printed in the ``make docker`` help.
The full list of tests is printed in the ``make docker-help`` help.

Debugging a Docker test failure
-------------------------------
Expand Down Expand Up @@ -980,6 +1014,8 @@ And remove any package you want with::
If you've used ``make check-acceptance``, the Python virtual environment where
Avocado is installed will be cleaned up as part of ``make check-clean``.

.. _checktcg-ref:

Testing with "make check-tcg"
=============================

Expand All @@ -1001,10 +1037,17 @@ for the architecture in question, for example::
There is also a ``--cross-cc-flags-ARCH`` flag in case additional
compiler flags are needed to build for a given target.

If you have the ability to run containers as the user you can also
take advantage of the build systems "Docker" support. It will then use
containers to build any test case for an enabled guest where there is
no system compiler available. See :ref:`docker-ref` for details.
If you have the ability to run containers as the user the build system
will automatically use them where no system compiler is available. For
architectures where we also support building QEMU we will generally
use the same container to build tests. However there are a number of
additional containers defined that have a minimal cross-build
environment that is only suitable for building test cases. Sometimes
we may use a bleeding edge distribution for compiler features needed
for test cases that aren't yet in the LTS distros we support for QEMU
itself.

See :ref:`container-ref` for more details.

Running subset of tests
-----------------------
Expand Down
18 changes: 18 additions & 0 deletions meson.build
Expand Up @@ -2509,6 +2509,24 @@ endif
summary_info += {'strip binaries': get_option('strip')}
summary_info += {'sparse': sparse.found() ? sparse.full_path() : false}
summary_info += {'mingw32 support': targetos == 'windows'}

# snarf the cross-compilation information for tests
foreach target: target_dirs
tcg_mak = meson.current_build_dir() / 'tests/tcg' / 'config-' + target + '.mak'
if fs.exists(tcg_mak)
config_cross_tcg = keyval.load(tcg_mak)
target = config_cross_tcg['TARGET_NAME']
compiler = ''
if 'DOCKER_CROSS_CC_GUEST' in config_cross_tcg
summary_info += {target + ' tests': config_cross_tcg['DOCKER_CROSS_CC_GUEST'] +
' via ' + config_cross_tcg['DOCKER_IMAGE']}
elif 'CROSS_CC_GUEST' in config_cross_tcg
summary_info += {target + ' tests'
: config_cross_tcg['CROSS_CC_GUEST'] }
endif
endif
endforeach

summary(summary_info, bool_yn: true, section: 'Compilation')

# Targets and accelerators
Expand Down
2 changes: 1 addition & 1 deletion scripts/fix-multiline-comments.sh
@@ -1,6 +1,6 @@
#! /bin/sh
#
# Fix multiline comments to match CODING_STYLE
# Fix multiline comments to match docs/devel/style.rst
#
# Copyright (C) 2018 Red Hat, Inc.
#
Expand Down
7 changes: 6 additions & 1 deletion tests/acceptance/virtio-gpu.py
Expand Up @@ -85,7 +85,12 @@ def test_virtio_vga_virgl(self):
"-append",
kernel_command_line,
)
self.vm.launch()
try:
self.vm.launch()
except:
# TODO: probably fails because we are missing the VirGL features
self.cancel("VirGL not enabled?")

self.wait_for_console_pattern("as init process")
exec_command_and_wait_for_pattern(
self, "/usr/sbin/modprobe virtio_gpu", ""
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/dockerfiles/fedora-cris-cross.docker
Expand Up @@ -2,7 +2,7 @@
# Cross compiler for cris system tests
#

FROM fedora:30
FROM fedora:33
ENV PACKAGES gcc-cris-linux-gnu
RUN dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt
2 changes: 1 addition & 1 deletion tests/docker/dockerfiles/fedora-i386-cross.docker
@@ -1,4 +1,4 @@
FROM fedora:31
FROM fedora:33
ENV PACKAGES \
bzip2 \
diffutils \
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/dockerfiles/fedora-win32-cross.docker
@@ -1,4 +1,4 @@
FROM fedora:32
FROM fedora:33

# Please keep this list sorted alphabetically
ENV PACKAGES \
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/dockerfiles/fedora-win64-cross.docker
@@ -1,4 +1,4 @@
FROM fedora:32
FROM fedora:33

# Please keep this list sorted alphabetically
ENV PACKAGES \
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/dockerfiles/fedora.docker
@@ -1,4 +1,4 @@
FROM fedora:32
FROM fedora:33

# Please keep this list sorted alphabetically
ENV PACKAGES \
Expand Down
8 changes: 0 additions & 8 deletions tests/tcg/configure.sh
Expand Up @@ -263,11 +263,3 @@ for target in $target_list; do
echo "DOCKER_CROSS_CC_GUEST=$container_cross_cc" >> $config_target_mak
fi
done

# report container support state
echo "cross containers $container"

if test -n "$enabled_cross_compilers"; then
echo
echo "NOTE: guest cross-compilers enabled:$enabled_cross_compilers"
fi

0 comments on commit cbcf098

Please sign in to comment.