All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Victor Toso <victortoso@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	John Snow <jsnow@redhat.com>
Subject: Re: [PATCH v1 0/7] Validate and test qapi examples
Date: Fri, 8 Sep 2023 09:14:41 +0100	[thread overview]
Message-ID: <ZPrX8cRntyrvZ05h@redhat.com> (raw)
In-Reply-To: <440707e4-c855-99ce-0ca3-03250a0bd3d2@linaro.org>

On Fri, Sep 08, 2023 at 09:51:35AM +0200, Philippe Mathieu-Daudé wrote:
> On 7/9/23 20:17, Victor Toso wrote:
> > Hi,
> 
> > >    File "/home/berrange/src/virt/qemu/scripts/qapi/dumpexamples.py", line 118, in parse_examples_of
> > >      assert((obj.doc is not None))
> > >              ^^^^^^^^^^^^^^^^^^^
> > > AssertionError
> > > ninja: build stopped: subcommand failed.
> > > 
> > > not sure if that's related to the examples that still need fixing or not ?
> > 
> > This is related to the script being fed with data without
> > documentation. In general, asserting should be the right approach
> > because we don't want API without docs but this failure comes
> > from the tests, that is, adding the following diff:
> > 
> > diff --git a/scripts/qapi/dumpexamples.py b/scripts/qapi/dumpexamples.py
> > index c14ed11774..a961c0575d 100644
> > --- a/scripts/qapi/dumpexamples.py
> > +++ b/scripts/qapi/dumpexamples.py
> > @@ -115,6 +115,10 @@ def parse_examples_of(self:
> > QAPISchemaGenExamplesVisitor,
> > 
> >       assert(name in self.schema._entity_dict)
> >       obj = self.schema._entity_dict[name]
> > +    if obj.doc is None:
> > +        print(f"{name} does not have documentation")
> > +        return
> > +
> >       assert((obj.doc is not None))
> >       module_name = obj._module.name
> > 
> > gives:
> > 
> >      user-def-cmd0 does not have documentation
> >      user-def-cmd does not have documentation
> [...]
> 
> > So, not sure if we should:
> >   1. Avoid asserting when running with tests
> 
> This seems the most sensible option, adding an argument to
> the 'command' invoked by meson's test_qapi_files() target in
> tests/meson.build.
> 
> >   2. Avoid running this generator with tests
> >   3. Add some minimal docs to the tests
> > 
> > Both (1) and (2) are quite simple. Not sure if there is real
> > benefit in (3). If we should tweak qemu tests with this, should
> > be related to using the JSON output itself, to keep examples
> > correct.
> 
> IMO (3) is a waste of time.

Agreed, I think we shouuld just skip the docs check as this is not
loading a real QAPI schema, just a dummy test one.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2023-09-08  8:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 19:48 [PATCH v1 0/7] Validate and test qapi examples Victor Toso
2023-09-05 19:48 ` [PATCH v1 1/7] qapi: scripts: add a generator for qapi's examples Victor Toso
2023-09-06  9:15   ` Daniel P. Berrangé
2023-09-07 18:34     ` Victor Toso
2023-09-08  8:12       ` Daniel P. Berrangé
2023-09-05 19:48 ` [PATCH v1 2/7] qapi: fix example of get-win32-socket command Victor Toso
2023-09-06  9:04   ` Daniel P. Berrangé
2023-09-05 19:48 ` [PATCH v1 3/7] qapi: fix example of dumpdtb command Victor Toso
2023-09-06  9:04   ` Daniel P. Berrangé
2023-09-05 19:48 ` [PATCH v1 4/7] qapi: fix example of cancel-vcpu-dirty-limit command Victor Toso
2023-09-06  9:03   ` Daniel P. Berrangé
2023-09-05 19:48 ` [PATCH v1 5/7] qapi: fix example of set-vcpu-dirty-limit command Victor Toso
2023-09-06  9:03   ` Daniel P. Berrangé
2023-09-05 19:48 ` [PATCH v1 6/7] qapi: fix example of calc-dirty-rate command Victor Toso
2023-09-06  9:02   ` Daniel P. Berrangé
2023-09-05 19:48 ` [PATCH v1 7/7] qapi: fix example of NETDEV_STREAM_CONNECTED event Victor Toso
2023-09-06  9:02   ` Daniel P. Berrangé
2023-09-06  9:17 ` [PATCH v1 0/7] Validate and test qapi examples Daniel P. Berrangé
2023-09-07 18:17   ` Victor Toso
2023-09-08  7:51     ` Philippe Mathieu-Daudé
2023-09-08  8:14       ` Daniel P. Berrangé [this message]
2023-09-14 16:26       ` 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=ZPrX8cRntyrvZ05h@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=philmd@linaro.org \
    --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.