libqos/qgraph: format qgraph comments for sphinx documentation
Quoted 2 lines · Emanuele Giuseppe Esposito
qtest
+ qgraph
It may make sense to add instead a "toctree" directive in qtest.rst. I haven't checked what the result looks like, though.
Quoted 1 line
+ * DOC: Qtest Driver Framework
Is this needed since you have the heading already in qgraph.rst?
(Also, the whole section could move to qgraph.rst. This is what was done with qom.rst for example).
Quoted 6 lines
+ * More specifically:
+ *
+ * .. code::
+ *
+ * x86_64/pc -->contains-->other_node<--consumes--my_driver
+ * |
You can end a paragraph with "::", and the following block will automatically become monospaced.
Also "-->contains-->" has an extra ">" sign.
Quoted 1 line
+ * ``"-netdev something -device my_node,addr=04.0 -device other"``
Maybe the quotes can be removed since you have monospaced text.
The main issue with the text overall is that it was written before having experience with developing QGraph drivers and interfaces. It's already a good thing to have it in the manual, so the smallest possible change (as you did in this patch) is already an improvement.
However, it would also be nice to replace the examples with something more "real world", based on the code in tests/qtest.
Thanks!
Paolo
PATCH 1/1 libqos/qgraph: format qgraph comments for sphinx documentation
Change documentation style and fix minor typos in tests/qtest/libqos/qgraph.h to automatically generate sphinx documentation in docs/devel/qgraph.rst
There is no functional change intended.
--- MAINTAINERS | 1 + docs/devel/index.rst | 1 + docs/devel/qgraph.rst | 5 + tests/qtest/libqos/qgraph.h | 434 ++++++++++++++++++++---------------- 4 files changed, 253 insertions(+), 188 deletions(-) create mode 100644 docs/devel/qgraph.rst
MAINTAINERS +1 -0
@@ -2592,6 +2592,7 @@ S: Maintained F: softmmu/qtest.c F: accel/qtest/ F: tests/qtest/ +F: docs/devel/qgraph.rst X: tests/qtest/bios-tables-test* Device Fuzzing
docs/devel/index.rst +1 -0
@@ -24,6 +24,7 @@ Contents: atomics stable-process qtest + qgraph decodetree secure-coding-practices tcg
docs/devel/qgraph.rst new file +5 -0
@@ -0,0 +1,5 @@ +======================================== +Qtest Driver Framework +======================================== + +.. kernel-doc:: tests/qtest/libqos/qgraph.h
tests/qtest/libqos/qgraph.h +246 -188
613 lines not on this page · raw message
Signature · 1 line
2.29.2
Quoted 5 lines · Paolo Bonzini
Quoted 2 lines · Emanuele Giuseppe Esposito
qtest
+ qgraphIt may make sense to add instead a "toctree" directive in qtest.rst. I haven't checked what the result looks like, though.
Current result is
- QTest Device Emulation Testing Framework
- Qtest Driver Framework
but I agree, maybe with an internal toctree in qtest.rst it will be clearer. I'll try.
Quoted 4 lines
Quoted 2 lines
+ * DOC: Qtest Driver Framework
Is this needed since you have the heading already in
qgraph.rst?
No, sorry I was experimenting and looking at qtest.rst I forgot to remove it
Quoted 2 lines
(Also, the whole section could move to qgraph.rst. This is what was done with
qom.rstfor example).
Ok makes sense.
Quoted 12 lines
Quoted 7 lines
+ * More specifically:
+ *
+ * .. code::
+ *
+ * x86_64/pc -->contains-->other_node<--consumes--my_driver
+ * |You can end a paragraph with "::", and the following block will automatically become monospaced.
Also "-->contains-->" has an extra ">" sign.
Quoted 7 lines
Quoted 1 line
+ * ``"-netdev something -device my_node,addr=04.0 -device other"``
Maybe the quotes can be removed since you have monospaced text.
The main issue with the text overall is that it was written before having experience with developing QGraph drivers and interfaces. It's already a good thing to have it in the manual, so the smallest possible change (as you did in this patch) is already an improvement.
However, it would also be nice to replace the examples with something more "real world", based on the code in tests/qtest.
I will try to use better examples and post v2, thank you for the feedback.
Emanuele
Quoted 5 lines
Thanks!
Paolo
Quoted 7 lines · Emanuele Giuseppe Esposito
Quoted 4 lines · Paolo Bonzini
Quoted 2 lines · Emanuele Giuseppe Esposito
qtest
+ qgraph
Quoted 8 lines
Quoted 1 line
It may make sense to add instead a "toctree" directive in
qtest.rst. I haven't checked what the result looks like, though.Current result is
- QTest Device Emulation Testing Framework
- Qtest Driver Frameworkbut I agree, maybe with an internal toctree in
qtest.rstit will be clearer. I'll try.
After trying, I think that simply adding a toctree in qtest.rst is not the prettiest solution. The end result will be something like
Qtest driver framework (title)
- qgraph (link to qgraph.rst)
QTest is a device emulation testing framework... [qtest.rst content]
The qgraph link will be also visible in docs/index and docs/devel/index
What about this:
docs/devel/qgraph.rst +2 -1
@@ -1,5 +1,261 @@ +.. _qgraph: + ======================================== Qtest Driver Framework ======================================== -------
Add anchor in graph.rst
.. kernel-doc:: tests/qtest/libqos/qgraph.h
docs/devel/qtest.rst +6 -0
@@ -2,6 +2,12 @@ QTest Device Emulation Testing Framework ======================================== +.. toctree:: + :hidden: + + qgraph + + 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
@@ -24,6 +30,9 @@ 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.
+Libqos also offers the qgraph API to increase each test coverage and +automate QEMU command line arguments and devices setup.
+Refer to :ref:qgraph for Qgraph explanation and API.
Steps to add a new QTest case are:
-------
Add hidden toctree because the new file must be linked by at least one, and reference qgraph in the text using the anchor.
docs/devel/index.rst +1 -1
@@ -12,6 +12,7 @@ Contents: .. toctree:: :maxdepth: 2 + :includehidden: build-system kconfig
@@ -24,7 +25,6 @@ Contents: atomics stable-process qtest - qgraph decodetree secure-coding-practices tcg
-------
Allow showing the hidden toctree in the docs/devel index, so that the link is visible
End result:
- no visible change in docs/index
- qgraph link visible in docs/devel/index
- qgraph linked as text link in qtree
Thank you,
Emanuele
Quoted 23 lines · Emanuele Giuseppe Esposito
docs/devel/index.rst +1
-2@@ -12,6 +12,7 @@ Contents: .. toctree:: :maxdepth: 2 + :includehidden: build-system kconfig@@ -24,7 +25,6 @@ Contents: atomics stable-process qtest - qgraph decodetree secure-coding-practices tcg -------
Quoted 6 lines
Allow showing the hidden toctree in the docs/devel index, so that the link is visible
End result:
- no visible change in docs/index
- qgraph link visible in docs/devel/index
- qgraph linked as text link in qtree
Makes sense. Did you also try increasing the maxdepth?
Paolo
Quoted 24 lines · Paolo Bonzini
Quoted 23 lines · Emanuele Giuseppe Esposito
docs/devel/index.rst +0
-0@@ -12,6 +12,7 @@ Contents:.. toctree::
:maxdepth: 2
+ :includehidden:build-system
kconfigdocs/devel/index.rst +0
-0@@ -24,7 +25,6 @@ Contents:atomics
stable-process
qtest
- qgraph
decodetree
secure-coding-practices
tcg-------
Quoted 8 lines
Quoted 6 lines
Allow showing the hidden toctree in the docs/devel index, so that the link is visible
End result:
- no visible change in docs/index
- qgraph link visible in docs/devel/index
- qgraph linked as text link in qtreeMakes sense. Did you also try increasing the maxdepth?
Yes, it does not change much on the qgraph side. By default, with this depth a simple toctree with qgraph would be already visible in both indexes.
As I see it, qgraph is a "subsection" of qtest, not a separate entry in docs/index, that is why I am hiding it.
I will go ahead and submit the patch for the sphinx documentation.
As you suggested, better qraph examples and explanations will follow in a separate serie.
Thank you,
Emanuele