qemu-e2k/tests
Marc-André Lureau 3313b6124b qapi: add qapi2texi script
As the name suggests, the qapi2texi script converts JSON QAPI
description into a texi file suitable for different target
formats (info/man/txt/pdf/html...).

It parses the following kind of blocks:

Free-form:

  ##
  # = Section
  # == Subsection
  #
  # Some text foo with *emphasis*
  # 1. with a list
  # 2. like that
  #
  # And some code:
  # | $ echo foo
  # | -> do this
  # | <- get that
  #
  ##

Symbol description:

  ##
  # @symbol:
  #
  # Symbol body ditto ergo sum. Foo bar
  # baz ding.
  #
  # @param1: the frob to frobnicate
  # @param2: #optional how hard to frobnicate
  #
  # Returns: the frobnicated frob.
  #          If frob isn't frobnicatable, GenericError.
  #
  # Since: version
  # Notes: notes, comments can have
  #        - itemized list
  #        - like this
  #
  # Example:
  #
  # -> { "execute": "quit" }
  # <- { "return": {} }
  #
  ##

That's roughly following the following EBNF grammar:

api_comment = "##\n" comment "##\n"
comment = freeform_comment | symbol_comment
freeform_comment = { "# " text "\n" | "#\n" }
symbol_comment = "# @" name ":\n" { member | tag_section | freeform_comment }
member = "# @" name ':' [ text ] "\n" freeform_comment
tag_section = "# " ( "Returns:", "Since:", "Note:", "Notes:", "Example:", "Examples:" ) [ text ]  "\n" freeform_comment
text = free text with markup

Note that the grammar is ambiguous: a line "# @foo:\n" can be parsed
both as freeform_comment and as symbol_comment.  The actual parser
recognizes symbol_comment.

See docs/qapi-code-gen.txt for more details.

Deficiencies and limitations:
- the generated QMP documentation includes internal types
- union type support is lacking
- type information is lacking in generated documentation
- doc comment error message positions are imprecise, they point
  to the beginning of the comment.
- a few minor issues, all marked TODO/FIXME in the code

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170113144135.5150-16-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[test-qapi.py tweaked to avoid trailing empty lines in .out]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-01-16 10:10:35 +01:00
..
acpi-test-data acpi-test: update expected files 2017-01-10 07:06:42 +02:00
data
docker
guest-debug
image-fuzzer
libqos libqos/ahci: Add get_sense and test_ready 2016-11-14 11:15:55 -05:00
migration
multiboot
qapi-schema qapi: add qapi2texi script 2017-01-16 10:10:35 +01:00
qemu-iotests blkverify: Implement bdrv_co_preadv/pwritev/flush 2017-01-09 13:30:52 +01:00
rocker
tcg Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
vmstate-static-checker-data
.gitignore tests: New test-bitcnt 2017-01-10 08:49:59 -08:00
ac97-test.c
ahci-test.c ahci-test: add QMP tray test for ATAPI 2016-11-14 11:15:55 -05:00
atomic_add-bench.c
bios-tables-test.c tests: pc: add memory hotplug acpi tables tests 2017-01-10 07:02:53 +02:00
boot-order-test.c
boot-sector.c
boot-sector.h
boot-serial-test.c boot-serial-test: Add a test for the powernv machine 2016-11-15 11:45:01 +11:00
check-block.sh
check-qdict.c
check-qfloat.c
check-qint.c
check-qjson.c tests: Avoid qobject_from_jsonf("%"PRId64) 2016-12-05 17:09:34 +01:00
check-qlist.c
check-qnull.c
check-qom-interface.c
check-qom-proplist.c
check-qstring.c
crypto-tls-x509-helpers.c
crypto-tls-x509-helpers.h clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
device-introspect-test.c
display-vga-test.c
drive_del-test.c
ds1338-test.c
e1000-test.c
e1000e-test.c libqos: Change PCI accessors to take opaque BAR handle 2016-10-28 09:38:27 +11:00
eepro100-test.c
endianness-test.c
es1370-test.c
fdc-test.c
fw_cfg-test.c
hd-geo-test.c
i440fx-test.c
i82801b11-test.c
ide-test.c tests: Remove unneeded "-vnc none" option 2016-10-31 15:09:59 -02:00
intel-hda-test.c
io-channel-helpers.c
io-channel-helpers.h
ioh3420-test.c
ipmi-bt-test.c virtio, pc: fixes and features 2016-11-03 14:41:53 +00:00
ipmi-kcs-test.c tests: Remove unneeded "-vnc none" option 2016-10-31 15:09:59 -02:00
ipoctal232-test.c
ivshmem-test.c libqos: Change PCI accessors to take opaque BAR handle 2016-10-28 09:38:27 +11:00
libqtest.c libqtest: handle zero length memwrite/memread 2017-01-12 10:45:59 +00:00
libqtest.h libqtest: add qmp_eventwait_ref 2016-11-14 11:15:54 -05:00
m25p80-test.c
m48t59-test.c
Makefile.include qapi: add qapi2texi script 2017-01-16 10:10:35 +01:00
ne2000-test.c
nvme-test.c
pc-cpu-test.c
pcnet-test.c
pkix_asn1_tab.c
pnv-xscom-test.c tests: add XSCOM tests for the PowerNV machine 2016-11-15 11:38:18 +11:00
postcopy-test.c tests/postcopy: Use KVM on ppc64 only if it is KVM-HV 2016-11-23 12:00:48 +11:00
prom-env-test.c tests: Add pseries machine to the prom-env-test, too 2016-10-28 11:17:31 +11:00
ptimer-test-stubs.c
ptimer-test.c
ptimer-test.h
pvpanic-test.c
pxe-test.c
q35-test.c
qemu-iotests-quick.sh
qht-bench.c
qom-test.c
rcutorture.c
rtas-test.c tests: don't check if qtest_spapr_boot() returns NULL 2016-10-28 09:36:58 +11:00
rtc-test.c
rtl8139-test.c libqos: Change PCI accessors to take opaque BAR handle 2016-10-28 09:38:27 +11:00
spapr-phb-test.c
tco-test.c libqos: Change PCI accessors to take opaque BAR handle 2016-10-28 09:38:27 +11:00
test-aio.c aio: add AioPollFn and io_poll() interface 2017-01-03 16:38:48 +00:00
test-arm-mptimer.c
test-base64.c
test-bitcnt.c tests: New test-bitcnt 2017-01-10 08:49:59 -08:00
test-bitops.c
test-blockjob-txn.c blockjob: add block_job_start 2016-11-14 22:47:34 -05:00
test-blockjob.c blockjobs: split interface into public/private, Part 1 2016-11-01 08:04:56 -04:00
test-bufferiszero.c
test-char.c
test-clone-visitor.c
test-coroutine.c
test-crypto-afsplit.c
test-crypto-block.c
test-crypto-cipher.c crypto: add 3des-ede support when using libgcrypt/nettle 2016-12-21 14:26:26 +00:00
test-crypto-hash.c
test-crypto-hmac.c crypto: add HMAC algorithms testcases 2016-12-22 09:24:59 +00:00
test-crypto-ivgen.c
test-crypto-pbkdf.c
test-crypto-secret.c
test-crypto-tlscredsx509.c
test-crypto-tlssession.c
test-crypto-xts.c
test-cutils.c
test-filter-mirror.c
test-filter-redirector.c
test-hbitmap.c
test-int128.c
test-io-channel-buffer.c
test-io-channel-command.c
test-io-channel-file.c
test-io-channel-socket.c
test-io-channel-tls.c
test-io-task.c
test-iov.c
test-logging.c
test-mul64.c
test-netfilter.c
test-opts-visitor.c
test-qdev-global-props.c
test-qdist.c
test-qemu-opts.c
test-qga.c test-qga: Avoid qobject_from_jsonv("%"PRId64) 2016-12-05 17:09:34 +01:00
test-qht-par.c
test-qht.c
test-qmp-commands.c
test-qmp-event.c
test-qobject-input-strict.c
test-qobject-input-visitor.c tests: Avoid qobject_from_jsonf("%"PRId64) 2016-12-05 17:09:34 +01:00
test-qobject-output-visitor.c
test-rcu-list.c
test-replication.c test-replication: fix leaks 2016-11-15 15:41:00 +00:00
test-string-input-visitor.c
test-string-output-visitor.c
test-thread-pool.c
test-throttle.c
test-timed-average.c
test-uuid.c test-uuid: fix leak 2016-11-11 20:53:23 +08:00
test-visitor-serialization.c
test-vmstate.c tests/test-vmstate.c: add array of pointer to struct 2016-11-14 14:50:56 +01:00
test-write-threshold.c
test-x86-cpuid-compat.c target-i386: Print warning when mixing [+-]foo and foo=(on|off) 2016-10-31 16:20:59 -02:00
test-x86-cpuid.c
test-xbzrle.c
tmp105-test.c
tpci200-test.c
usb-hcd-ehci-test.c libqos: Change PCI accessors to take opaque BAR handle 2016-10-28 09:38:27 +11:00
usb-hcd-ohci-test.c
usb-hcd-uhci-test.c
usb-hcd-xhci-test.c
vhost-user-bridge.c tests/vhost-user-bridge: use contrib/libvhost-user 2016-12-16 01:14:38 +02:00
vhost-user-test.c trivial patches for 2016-10-28 2016-10-31 11:58:30 +00:00
virtio-9p-test.c tests: virtio-9p: ".." cannot be used to walk out of the shared directory 2017-01-03 17:28:44 +01:00
virtio-balloon-test.c
virtio-blk-test.c libqos: Give qvirtio_config_read*() consistent semantics 2016-10-28 09:38:27 +11:00
virtio-console-test.c
virtio-net-test.c tests: enable virtio tests on SPAPR 2016-10-28 09:36:58 +11:00
virtio-rng-test.c tests: enable virtio tests on SPAPR 2016-10-28 09:36:58 +11:00
virtio-scsi-test.c libqos: Give qvirtio_config_read*() consistent semantics 2016-10-28 09:38:27 +11:00
virtio-serial-test.c
vmxnet3-test.c
wdt_ib700-test.c