Lines Matching +full:build +full:- +full:system +full:- +full:debian
7 everything from unit testing and exercising specific sub-systems all
9 tests you can run ``make check-help`` from either the source or build
12 Most (but not all) tests are also integrated into the meson build
13 system so can be run directly from the build tree, for example:
17 [./pyvenv/bin/]meson test --suite qemu:softfloat
25 -------------------------
36 Different sub-types of "make check" tests will be explained below.
38 Before running tests, it is best to build QEMU programs first. Some tests
45 Unit tests, which can be invoked with ``make check-unit``, are simple C tests
53 1. Create a new source file. For example, ``tests/unit/foo-test.c``.
60 3. Add the test to ``tests/unit/meson.build``. The unit tests are listed in a
63 is in ``tests/unit/foo-test.c``, it is enough to add an entry like::
67 'foo-test': [],
80 make check-unit V=1
97 make check-qtest
127 the build in the meson.build file.
136 The input/output data is managed under the ``tests/qapi-schema`` directory.
139 * ``${casename}.json`` - the file contains the JSON input for feeding the
141 * ``${casename}.out`` - the file contains the expected stdout from the parser
142 * ``${casename}.err`` - the file contains the expected stderr from the parser
143 * ``${casename}.exit`` - the expected error code
150 ``$EDITOR tests/qapi-schema/foo.{json,out,err,exit}``.
154 ``qapi-schema += foo.json``
156 check-block
159 ``make check-block`` runs a subset of the block layer iotests (the tests that
164 ------------
166 QEMU iotests, under the directory ``tests/qemu-iotests``, is the testing
173 ``tests/qemu-iotests`` directory under the build directory, and run ``./check``
183 ./check -qcow2
185 ./check -nbd
192 ./check -qcow2 001 030 153
194 Cache mode can be selected with the "-c" option, which may help reveal bugs
197 More options are supported by the ``./check`` script, run ``./check -h`` for
246 more convenient to use the pseudo block driver, ``null-co://``, as the test
247 image, which doesn't require image creation or cleaning up. Avoid system-wide
260 * ``-gdb`` wraps every QEMU invocation in a ``gdbserver``, which waits for a
266 ``gdb -iex "target remote $addr"``, where ``$addr`` is the address
268 If the ``-gdb`` option is not used, ``$GDB_OPTIONS`` is ignored,
271 * ``-valgrind`` attaches a valgrind instance to QEMU. If it detects
274 The final command line will be ``valgrind --log-file=$TEST_DIR/
275 <valgrind_pid>.valgrind --error-exitcode=99 $QEMU ...``
277 * ``-d`` (debug) just increases the logging verbosity, showing
280 * ``-p`` (print) redirects QEMU’s stdout and stderr to the test output,
282 ``$TEST_DIR/qemu-machine-<random_string>``.
298 Another way of defining groups is creating the tests/qemu-iotests/group.local
307 # ci - tests to run on build
308 # down - our downstream tests, not for upstream
316 our-ugly-workaround-test down ci
320 - quick: Tests in this group should finish within a few seconds.
322 - auto: Tests in this group are used during "make check" and should be
324 (also non-x86), with every QEMU configuration (i.e. must not fail if
325 an optional feature is not compiled in - but reporting a "skip" is ok),
330 - disabled: Tests in this group are disabled and ignored by check.
332 .. _container-ref:
335 ---------------------
341 build and test QEMU in predefined and widely accessible Linux
346 names and scripts are prefixed with "docker" the system will
350 for testing TCG. See :ref:`checktcg-ref` for more details.
355 Install "docker" with the system package manager and start the Docker service
363 $ # or `apt-get install docker` for Ubuntu, etc.
367 The last command should print an empty table, to verify the system is ready.
376 $ sudo usermod $USER -a -G docker
386 Install "podman" with the system package manager.
393 The last command should print an empty table, to verify the system is ready.
398 From source tree, type ``make docker-help`` to see the help. Testing
405 make docker-test-build@debian
407 This will create a container instance using the ``debian`` image (the image
408 is downloaded and initialized automatically), in which the ``test-build`` job
415 ``registry.gitlab.com/qemu-project/qemu`` which will automatically be
416 used to pull in pre-built layers. This avoids unnecessary strain on
418 container build steps over and over again. This can be overridden
419 locally by using the ``NOCACHE`` build option:
423 make docker-image-debian-arm64-cross NOCACHE=1
428 Along with many other images, the ``debian`` image is defined in a Dockerfile
429 in ``tests/docker/dockerfiles/``, called ``debian.docker``. ``make docker-help``
433 executed before building the image under the build context directory. This is
435 for example, to make qemu-user powered cross build containers work.
443 using the ``lcitool`` program provided by the ``libvirt-ci`` project:
445 https://gitlab.com/libvirt/libvirt-ci
447 ``libvirt-ci`` contains an ``lcitool`` program as well as a list of
449 party projects. ``lcitool`` applies the mappings to a list of build
450 pre-requisites in ``tests/lcitool/projects/qemu.yml``, determines the
452 to generate build environments (dockerfiles and Cirrus CI variable files)
456 Adding new build pre-requisites
459 When preparing a patch series that adds a new build
460 pre-requisite to QEMU, the prerequisites should to be added to
462 available in the CI build environments.
464 In the simple case where the pre-requisite is already known to ``libvirt-ci``
467 * Edit ``tests/lcitool/projects/qemu.yml`` and add the pre-requisite
469 * Run ``make lcitool-refresh`` to re-generate all relevant build environment
472 It may be that ``libvirt-ci`` does not know about the new pre-requisite.
474 first to contribute the mapping to the ``libvirt-ci`` project:
476 * Fork the ``libvirt-ci`` project on gitlab
478 * Add an entry for the new build prerequisite to
480 many OS distros as practical. Run ``python -m pytest --regenerate-output``
484 files, and submit a merge request to the ``libvirt-ci`` project.
485 Please note in the description that this is a new build pre-requisite
490 all OS distributions supported by ``libvirt-ci``.
493 the ``tests/lcitool/libvirt-ci`` submodule to point to a commit that
495 run ``make lcitool-refresh``.
499 obvious breakages when adding the new pre-requisite. Please see
503 For enterprise distros that default to old, end-of-life versions of the
506 Modifying this file should not be necessary unless the new pre-requisite
513 In some cases ``libvirt-ci`` will not know about the OS distro that is
517 * Send a mail to qemu-devel, copying people listed in the
518 MAINTAINERS file for ``Build and test automation``.
523 * File an issue at https://gitlab.com/libvirt/libvirt-ci/-/issues
524 pointing to the qemu-devel mail thread in the archives.
527 to avoid duplication, as well as to get feedback from libvirt-ci
532 * Fork the ``libvirt-ci`` project on gitlab
536 uses a package format not currently known. The ``libvirt-ci``
541 as practical. Run ``python -m pytest --regenerate-output`` and
545 files, and submit a merge request to the ``libvirt-ci`` project.
546 Please note in the description that this is a new build pre-requisite
551 all OS distributions supported by ``libvirt-ci``.
554 the ``libvirt-ci`` submodule to point to a commit that contains
561 Different tests are added to cover various configurations to build and test
563 ``test-*``. They are typically shell scripts and are built on top of a shell
565 source and build it.
567 The full list of tests is printed in the ``make docker-help`` help.
576 ``make docker-test-mingw@fedora-win64-cross J=8``.
580 build QEMU and run tests from there, or press Ctrl-D to let the Docker
582 4. If you press Ctrl-D, the same building and testing procedure will begin, and
595 similar to the ``-j $N`` option in top level ``make``. (The ``-j`` option in
601 ----------------
614 The test-tsan test will build using TSan and then run make check.
618 make docker-test-tsan@ubuntu2204
620 TSan warnings under docker are placed in files located at build/tsan/.
628 It is possible to build and test with TSan, with a few additional steps.
637 To build a tsan version of glib:
641 $ git clone --depth=1 --branch=2.81.0 https://github.com/GNOME/glib.git
643 $ CFLAGS="-O2 -g -fsanitize=thread" meson build
644 $ ninja -C build
646 To configure the build for TSan:
650 ../configure --enable-tsan \
651 --disable-werror --extra-cflags="-O0"
658 …rt LD_LIBRARY_PATH=$glib_dir/build/gio:$glib_dir/build/glib:$glib_dir/build/gmodule:$glib_dir/buil…
660 $ ldd build/qemu-x86_64 | grep glib
661 $ qemu-system-x86_64 ...
676 log_path=<build path>/tsan/tsan_warning
692 tests/tsan/suppressions.tsan - Has TSan warnings we wish to suppress at runtime.
698 tests/tsan/ignore.tsan - Has TSan warnings we wish to disable
702 "--extra-cflags=-fsanitize-blacklist=<src path>/tests/tsan/ignore.tsan"
717 https://github.com/llvm/llvm-project/tree/master/compiler-rt/test/tsan/
723 https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
725 docker-binfmt-image-debian-% targets
726 ------------------------------------
728 It is possible to combine Debian's bootstrap scripts with a configured
729 ``binfmt_misc`` to bootstrap a number of Debian's distros including
737 You can use the script ``qemu-binfmt-conf.sh`` to configure a QEMU
743 executable on setup and avoids the need to find and re-open in the
744 chroot environment. This is triggered with the ``--persistent`` flag.
749 For example to setup the HPPA ports builds of Debian::
751 make docker-binfmt-image-debian-sid-hppa \
753 DEB_URL=http://ftp.ports.debian.org/debian-ports/ \
754 DEB_KEYRING=/usr/share/keyrings/debian-ports-archive-keyring.gpg \
755 EXECUTABLE=(pwd)/qemu-hppa V=1
758 ``debian-bootstrap.pre`` which is called to do the initial debootstrap
760 is run as part of the build. The final image will be tagged as
761 ``qemu/debian-sid-hppa``.
764 ----------
767 necessary packages to build QEMU. The basic usage is documented in ``Makefile``
768 help which is displayed with ``make vm-help``.
773 Run ``make vm-help`` to list available make targets. Invoke a specific make
774 command to run build test in an image. For example, ``make vm-build-freebsd``
775 will build the source tree in the FreeBSD image. The command can be executed
776 from either the source tree or the build dir; if the former, ``./configure`` is
780 Note: images created by the scripts accept a well-known RSA key pair for SSH
788 By default, ``qemu-system-x86_64`` is searched in $PATH to run the guest. If
790 provide the QEMU binary in env var: ``QEMU=/path/to/qemu-2.10+``.
792 Likewise the path to ``qemu-img`` can be set in QEMU_IMG environment variable.
797 The ``-j$X`` option in the make command line is not propagated into the VM,
818 $ ./netbsd --build-image --image /var/tmp/netbsd.img
822 # --debug is added)
823 $ ./netbsd --debug --image /var/tmp/netbsd.img uname -a
825 # To build QEMU in guest
826 $ ./netbsd --debug --image /var/tmp/netbsd.img --build-qemu $QEMU_SRC
829 $ ./netbsd --interactive --image /var/tmp/netbsd.img sh
844 * Once the image is downloaded, users, SSH server and QEMU build deps should
847 - Root password set to ``BaseVM.ROOT_PASS``
848 - User ``BaseVM.GUEST_USER`` is created, and password set to
850 - SSH service is enabled and started on boot,
853 - DHCP client service is enabled and started on boot, so that it can
854 automatically configure the virtio-net-pci NIC and communicate with QEMU
856 - Necessary packages are installed to untar the source tarball and build
860 untars a raw virtio-blk block device, which is the tarball data blob of the
861 QEMU source tree, then configure/build it. Running "make check" is also
865 --------------------
872 tests/image-fuzzer/runner.py -c '[["qemu-img", "info", "$test_img"]]' /tmp/test qcow2
874 Alternatively, some command different from ``qemu-img info`` can be tested, by
875 changing the ``-c`` option.
878 -----------------------------
885 make check-functional
887 See :ref:`checkfunctional-ref` for more details.
890 ---------------------------------------------
900 make check-avocado
902 See :ref:`checkavocado-ref` for more details.
905 .. _checktcg-ref:
907 Testing with "make check-tcg"
908 -----------------------------
910 The check-tcg tests are intended for simple smoke tests of both
911 linux-user and softmmu TCG functionality. However to build test
916 apt install gcc-aarch64-linux-gnu
923 $(configure) --cross-cc-aarch64=aarch64-cc
925 There is also a ``--cross-cc-cflags-ARCH`` flag in case additional
926 compiler flags are needed to build for a given target.
928 If you have the ability to run containers as the user the build system
929 will automatically use them where no system compiler is available. For
931 use the same container to build tests. However there are a number of
932 additional containers defined that have a minimal cross-build
938 See :ref:`container-ref` for more details.
943 You can build the tests for one architecture::
945 make build-tcg-tests-$TARGET
949 make run-tcg-tests-$TARGET
957 Tests can also be run directly from the test build directory. If you
958 run ``make help`` from the test build directory you will get a list of
962 make run-plugin-test-mmap-with-libinline.so
965 gdbstub tests also re-use the test binaries but while exercising gdb.
971 either totally bare with minimal gcc lib support (for system-mode tests)
972 or just glibc (for linux-user tests). This is because getting a cross
976 ---------------
978 There are a number of out-of-tree test suites that are used for more
989 https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
997 to run to exercise QEMU's linux-user code::
999 https://linux-test-project.github.io/
1002 ----------------
1006 ``--enable-gcov`` option and build. Then run the tests as usual.
1009 clean-gcda`` target can be used to delete any existing coverage
1013 coverage-html`` which will create
1014 ``meson-logs/coveragereport/index.html``.