docs/devel/qtest: Include protocol spec in document

Include the QTest Protocol doc string in docs/devel/qtest.rst,
after converting it to use Sphinx syntax.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201005205228.697463-3-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-10-05 16:52:27 -04:00 committed by Paolo Bonzini
parent a738a50e62
commit f59c6de7f0
2 changed files with 73 additions and 10 deletions

View file

@ -4,8 +4,8 @@ QTest Device Emulation Testing Framework
QTest is a device emulation testing framework. It can be very useful to test 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 device models; it could also control certain aspects of QEMU (such as virtual
clock stepping), with a special purpose "qtest" protocol. Refer to the clock stepping), with a special purpose "qtest" protocol. Refer to
documentation in ``qtest.c`` for more details of the protocol. :ref:`qtest-protocol` for more details of the protocol.
QTest cases can be executed with QTest cases can be executed with
@ -56,3 +56,11 @@ from the output of
which you can run manually. which you can run manually.
.. _qtest-protocol:
QTest Protocol
--------------
.. kernel-doc:: softmmu/qtest.c
:doc: QTest Protocol

View file

@ -49,92 +49,139 @@ static void *qtest_server_send_opaque;
#define FMT_timeval "%ld.%06ld" #define FMT_timeval "%ld.%06ld"
/** /**
* QTest Protocol * DOC: QTest Protocol
* *
* Line based protocol, request/response based. Server can send async messages * Line based protocol, request/response based. Server can send async messages
* so clients should always handle many async messages before the response * so clients should always handle many async messages before the response
* comes in. * comes in.
* *
* Valid requests * Valid requests
* ^^^^^^^^^^^^^^
* *
* Clock management: * Clock management:
* """""""""""""""""
* *
* The qtest client is completely in charge of the QEMU_CLOCK_VIRTUAL. qtest commands * The qtest client is completely in charge of the QEMU_CLOCK_VIRTUAL. qtest commands
* let you adjust the value of the clock (monotonically). All the commands * let you adjust the value of the clock (monotonically). All the commands
* return the current value of the clock in nanoseconds. * return the current value of the clock in nanoseconds.
* *
* .. code-block:: none
*
* > clock_step * > clock_step
* < OK VALUE * < OK VALUE
* *
* Advance the clock to the next deadline. Useful when waiting for * Advance the clock to the next deadline. Useful when waiting for
* asynchronous events. * asynchronous events.
*
* .. code-block:: none
* *
* > clock_step NS * > clock_step NS
* < OK VALUE * < OK VALUE
* *
* Advance the clock by NS nanoseconds. * Advance the clock by NS nanoseconds.
*
* .. code-block:: none
* *
* > clock_set NS * > clock_set NS
* < OK VALUE * < OK VALUE
* *
* Advance the clock to NS nanoseconds (do nothing if it's already past). * Advance the clock to NS nanoseconds (do nothing if it's already past).
* *
* PIO and memory access: * PIO and memory access:
* """"""""""""""""""""""
*
* .. code-block:: none
* *
* > outb ADDR VALUE * > outb ADDR VALUE
* < OK * < OK
* *
* .. code-block:: none
*
* > outw ADDR VALUE * > outw ADDR VALUE
* < OK * < OK
* *
* .. code-block:: none
*
* > outl ADDR VALUE * > outl ADDR VALUE
* < OK * < OK
* *
* .. code-block:: none
*
* > inb ADDR * > inb ADDR
* < OK VALUE * < OK VALUE
* *
* .. code-block:: none
*
* > inw ADDR * > inw ADDR
* < OK VALUE * < OK VALUE
* *
* .. code-block:: none
*
* > inl ADDR * > inl ADDR
* < OK VALUE * < OK VALUE
* *
* .. code-block:: none
*
* > writeb ADDR VALUE * > writeb ADDR VALUE
* < OK * < OK
* *
* .. code-block:: none
*
* > writew ADDR VALUE * > writew ADDR VALUE
* < OK * < OK
* *
* .. code-block:: none
*
* > writel ADDR VALUE * > writel ADDR VALUE
* < OK * < OK
* *
* .. code-block:: none
*
* > writeq ADDR VALUE * > writeq ADDR VALUE
* < OK * < OK
* *
* .. code-block:: none
*
* > readb ADDR * > readb ADDR
* < OK VALUE * < OK VALUE
* *
* .. code-block:: none
*
* > readw ADDR * > readw ADDR
* < OK VALUE * < OK VALUE
* *
* .. code-block:: none
*
* > readl ADDR * > readl ADDR
* < OK VALUE * < OK VALUE
* *
* .. code-block:: none
*
* > readq ADDR * > readq ADDR
* < OK VALUE * < OK VALUE
* *
* .. code-block:: none
*
* > read ADDR SIZE * > read ADDR SIZE
* < OK DATA * < OK DATA
* *
* .. code-block:: none
*
* > write ADDR SIZE DATA * > write ADDR SIZE DATA
* < OK * < OK
* *
* .. code-block:: none
*
* > b64read ADDR SIZE * > b64read ADDR SIZE
* < OK B64_DATA * < OK B64_DATA
* *
* .. code-block:: none
*
* > b64write ADDR SIZE B64_DATA * > b64write ADDR SIZE B64_DATA
* < OK * < OK
* *
* .. code-block:: none
*
* > memset ADDR SIZE VALUE * > memset ADDR SIZE VALUE
* < OK * < OK
* *
@ -149,16 +196,21 @@ static void *qtest_server_send_opaque;
* If the sizes do not match, the data will be truncated. * If the sizes do not match, the data will be truncated.
* *
* IRQ management: * IRQ management:
* """""""""""""""
*
* .. code-block:: none
* *
* > irq_intercept_in QOM-PATH * > irq_intercept_in QOM-PATH
* < OK * < OK
* *
* .. code-block:: none
*
* > irq_intercept_out QOM-PATH * > irq_intercept_out QOM-PATH
* < OK * < OK
* *
* Attach to the gpio-in (resp. gpio-out) pins exported by the device at * Attach to the gpio-in (resp. gpio-out) pins exported by the device at
* QOM-PATH. When the pin is triggered, one of the following async messages * QOM-PATH. When the pin is triggered, one of the following async messages
* will be printed to the qtest stream: * will be printed to the qtest stream::
* *
* IRQ raise NUM * IRQ raise NUM
* IRQ lower NUM * IRQ lower NUM
@ -168,12 +220,15 @@ static void *qtest_server_send_opaque;
* NUM=0 even though it is remapped to GSI 2). * NUM=0 even though it is remapped to GSI 2).
* *
* Setting interrupt level: * Setting interrupt level:
* """"""""""""""""""""""""
*
* .. code-block:: none
* *
* > set_irq_in QOM-PATH NAME NUM LEVEL * > set_irq_in QOM-PATH NAME NUM LEVEL
* < OK * < OK
* *
* where NAME is the name of the irq/gpio list, NUM is an IRQ number and * where NAME is the name of the irq/gpio list, NUM is an IRQ number and
* LEVEL is an signed integer IRQ level. * LEVEL is an signed integer IRQ level.
* *
* Forcibly set the given interrupt pin to the given level. * Forcibly set the given interrupt pin to the given level.
* *