All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Victor Toso <victortoso@redhat.com>
Cc: qemu-devel@nongnu.org,  Eric Blake <eblake@redhat.com>,
	 John Snow <jsnow@redhat.com>,
	 Michael Roth <michael.roth@amd.com>
Subject: Re: [PATCH v1 16/16] RFC: add a generator for qapi's examples
Date: Wed, 31 Aug 2022 14:01:54 +0200	[thread overview]
Message-ID: <87ilm8aafh.fsf@pond.sub.org> (raw)
In-Reply-To: <20220830161545.84198-17-victortoso@redhat.com> (Victor Toso's message of "Tue, 30 Aug 2022 18:15:45 +0200")

Victor Toso <victortoso@redhat.com> writes:

> The goal of this generator is to validate QAPI examples and transform
> them into a format that can be used for 3rd party applications to
> validate their QAPI/QMP introspection.
>
> For each Example section, we parse server and client messages into a
> python dictionary. This step alone has found several ill formatted
> JSON messages in the examples.
>
> The generator outputs another JSON file with all the examples in the
> QAPI module that they came from. This can be used to validate the
> introspection between QAPI/QMP to language bindings.
>
> When used with the POC qapi-go branch, we have found bad QMP messages
> with wrong member names, mandatory members that were missing and
> optional members that were being set with null (not needed).
>
> A simple example of the output format is:
>
>  { "examples": [
>    {
>      "id": "ksuxwzfayw",
>      "client": [
>      {
>        "sequence-order": 1
>        "message-type": "command",
>        "message":
>        { "arguments":
>          { "device": "scratch", "size": 1073741824 },
>          "execute": "block_resize"
>        },
>     } ],
>     "server": [
>     {
>       "sequence-order": 2
>       "message-type": "return",
>       "message": { "return": {} },
>     } ]
>     }
>   ] }
>
> If this idea seems reasonable, we can add python-qemu-qmp to validate
> each message at generation time already.
>
> Signed-off-by: Victor Toso <victortoso@redhat.com>

If I understand you correctly, there are two benefits:

1. Mechanical syntax check for examples

   Love it.

2. Can extract examples for use as test cases

   Sounds good to me.  Possible redundancy with existing tests.
   Probably nothing to worry about.

   Can you explain in a bit more detail how the extracted data is (to
   be) used?



  reply	other threads:[~2022-08-31 12:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 16:15 [PATCH v1 00/16] qapi examples fixes and rfc for another generator Victor Toso
2022-08-30 16:15 ` [PATCH v1 01/16] qapi: fix example of query-ballon command Victor Toso
2022-08-30 16:15 ` [PATCH v1 02/16] qapi: fix example of query-vnc command Victor Toso
2022-08-30 16:15 ` [PATCH v1 03/16] qapi: fix example of query-spice command Victor Toso
2022-08-31 11:50   ` Markus Armbruster
2022-08-31 12:55     ` Victor Toso
2022-08-31 13:22       ` Markus Armbruster
2022-09-01 14:08         ` Gerd Hoffmann
2022-08-30 16:15 ` [PATCH v1 04/16] qapi: fix example of query-rocker-of-dpa-flows command Victor Toso
2022-08-31 11:51   ` Markus Armbruster
2022-08-30 16:15 ` [PATCH v1 05/16] qapi: fix example of query-dump-guest-memory-capability command Victor Toso
2022-08-30 16:15 ` [PATCH v1 06/16] qapi: fix example of query-blockstats command Victor Toso
2022-08-30 16:15 ` [PATCH v1 07/16] qapi: fix example of BLOCK_JOB_READY event Victor Toso
2022-08-30 16:15 ` [PATCH v1 08/16] qapi: fix example of NIC_RX_FILTER_CHANGED event Victor Toso
2022-08-31 11:37   ` Markus Armbruster
2022-08-30 16:15 ` [PATCH v1 09/16] qapi: fix example of DEVICE_UNPLUG_GUEST_ERROR event Victor Toso
2022-08-30 16:15 ` [PATCH v1 10/16] qapi: fix example of MEM_UNPLUG_ERROR event Victor Toso
2022-08-30 16:15 ` [PATCH v1 11/16] qapi: fix examples of blockdev-add with qcow2 Victor Toso
2022-08-30 16:15 ` [PATCH v1 12/16] qapi: fix example of blockdev-add command Victor Toso
2022-08-31 11:40   ` Markus Armbruster
2022-08-31 12:45     ` Victor Toso
2022-08-31 13:16       ` Markus Armbruster
2022-08-31 13:47         ` Victor Toso
2022-08-31 14:53           ` Markus Armbruster
2022-09-01  7:56             ` Victor Toso
2022-09-01 11:13               ` Markus Armbruster
2022-09-02  8:02                 ` Victor Toso
2022-08-30 16:15 ` [PATCH v1 13/16] qapi: fix example of query-hotpluggable-cpus command Victor Toso
2022-08-30 16:15 ` [PATCH v1 14/16] qapi: fix example of query-migrate command Victor Toso
2022-08-31 11:52   ` Markus Armbruster
2022-08-30 16:15 ` [PATCH v1 15/16] qapi: fix examples of events missing timestamp Victor Toso
2022-08-30 16:15 ` [PATCH v1 16/16] RFC: add a generator for qapi's examples Victor Toso
2022-08-31 12:01   ` Markus Armbruster [this message]
2022-08-31 13:32     ` Victor Toso
2022-08-31 14:57       ` Markus Armbruster
2022-09-01  8:37         ` Victor Toso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilm8aafh.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=qemu-devel@nongnu.org \
    --cc=victortoso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.