summaryrefslogtreecommitdiffstats
path: root/docs/devel/testing.rst
diff options
context:
space:
mode:
authorPeter Maydell2020-10-12 23:48:45 +0200
committerPeter Maydell2020-10-12 23:48:45 +0200
commit724c1c8bb350d84c097ab2005aad15e125d06b6c (patch)
treeb55ff4dc3e8012e2624d2aa2d1211684bd425656 /docs/devel/testing.rst
parentMerge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20201012a'... (diff)
parentmeson: identify more sections of meson.build (diff)
downloadqemu-724c1c8bb350d84c097ab2005aad15e125d06b6c.tar.gz
qemu-724c1c8bb350d84c097ab2005aad15e125d06b6c.tar.xz
qemu-724c1c8bb350d84c097ab2005aad15e125d06b6c.zip
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
* qtest documentation improvements (Eduardo, myself) * libqtest event buffering (Maxim) * use RCU for list of children of a bus (Maxim) * move more files to softmmu/ (myself) * meson.build cleanups, qemu-storage-daemon fix (Philippe) # gpg: Signature made Mon 12 Oct 2020 16:55:19 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (38 commits) meson: identify more sections of meson.build scsi/scsi_bus: fix races in REPORT LUNS virtio-scsi: use scsi_device_get scsi/scsi_bus: Add scsi_device_get scsi/scsi-bus: scsi_device_find: don't return unrealized devices device-core: use atomic_set on .realized property scsi: switch to bus->check_address device-core: use RCU for list of children of a bus device_core: use drain_call_rcu in in qmp_device_add scsi/scsi_bus: switch search direction in scsi_device_find qdev: add "check if address free" callback for buses qemu-iotests, qtest: rewrite test 067 as a qtest qtest: check that drives are really appearing and disappearing qtest: switch users back to qtest_qmp_receive device-plug-test: use qtest_qmp to send the device_del command qtest: remove qtest_qmp_receive_success qtest: Reintroduce qtest_qmp_receive with QMP event buffering qtest: rename qtest_qmp_receive to qtest_qmp_receive_dict meson.build: Re-enable KVM support for MIPS build-sys: fix git version from -version ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'docs/devel/testing.rst')
-rw-r--r--docs/devel/testing.rst64
1 files changed, 11 insertions, 53 deletions
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 8875a40a2b..0c3e79d31c 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -41,15 +41,16 @@ add a new unit test:
test. The test code should be organized with the glib testing framework.
Copying and modifying an existing test is usually a good idea.
-3. Add the test to ``tests/Makefile.include``. First, name the unit test
- program and add it to ``$(check-unit-y)``; then add a rule to build the
- executable. For example:
+3. Add the test to ``tests/meson.build``. The unit tests are listed in a
+ dictionary called ``tests``. The values are any additional sources and
+ dependencies to be linked with the test. For a simple test whose source
+ is in ``tests/foo-test.c``, it is enough to add an entry like::
-.. code::
-
- check-unit-y += tests/foo-test$(EXESUF)
- tests/foo-test$(EXESUF): tests/foo-test.o $(test-util-obj-y)
- ...
+ {
+ ...
+ 'foo-test': [],
+ ...
+ }
Since unit tests don't require environment variables, the simplest way to debug
a unit test failure is often directly invoking it or even running it under
@@ -70,8 +71,8 @@ QTest
QTest is a device emulation testing framework. It can be very useful to test
device models; it could also control certain aspects of QEMU (such as virtual
-clock stepping), with a special purpose "qtest" protocol. Refer to the
-documentation in ``qtest.c`` for more details of the protocol.
+clock stepping), with a special purpose "qtest" protocol. Refer to
+:doc:`qtest` for more details.
QTest cases can be executed with
@@ -79,49 +80,6 @@ QTest cases can be executed with
make check-qtest
-The QTest library is implemented by ``tests/qtest/libqtest.c`` and the API is
-defined in ``tests/qtest/libqtest.h``.
-
-Consider adding a new QTest case when you are introducing a new virtual
-hardware, or extending one if you are adding functionalities to an existing
-virtual device.
-
-On top of libqtest, a higher level library, ``libqos``, was created to
-encapsulate common tasks of device drivers, such as memory management and
-communicating with system buses or devices. Many virtual device tests use
-libqos instead of directly calling into libqtest.
-
-Steps to add a new QTest case are:
-
-1. Create a new source file for the test. (More than one file can be added as
- necessary.) For example, ``tests/qtest/foo-test.c``.
-
-2. Write the test code with the glib and libqtest/libqos API. See also existing
- tests and the library headers for reference.
-
-3. Register the new test in ``tests/qtest/Makefile.include``. Add the test
- executable name to an appropriate ``check-qtest-*-y`` variable. For example:
-
- ``check-qtest-generic-y = tests/qtest/foo-test$(EXESUF)``
-
-4. Add object dependencies of the executable in the Makefile, including the
- test source file(s) and other interesting objects. For example:
-
- ``tests/qtest/foo-test$(EXESUF): tests/qtest/foo-test.o $(libqos-obj-y)``
-
-Debugging a QTest failure is slightly harder than the unit test because the
-tests look up QEMU program names in the environment variables, such as
-``QTEST_QEMU_BINARY`` and ``QTEST_QEMU_IMG``, and also because it is not easy
-to attach gdb to the QEMU process spawned from the test. But manual invoking
-and using gdb on the test is still simple to do: find out the actual command
-from the output of
-
-.. code::
-
- make check-qtest V=1
-
-which you can run manually.
-
QAPI schema tests
-----------------