From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"John Snow" <jsnow@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>
Subject: Re: [PATCH v4 04/18] tests/qapi/doc-good.json: Clean up markup
Date: Thu, 06 Aug 2020 16:46:11 +0200 [thread overview]
Message-ID: <87364z6de4.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA-nk3+W-on=tsW_8OY==MriMyeJFQ=_tFjHkaoj5mUA_A@mail.gmail.com> (Peter Maydell's message of "Wed, 5 Aug 2020 14:41:25 +0100")
Peter Maydell <peter.maydell@linaro.org> writes:
> On Wed, 5 Aug 2020 at 14:03, Markus Armbruster <armbru@redhat.com> wrote:
>>
>> The subject is a bit misleading. The markup doesn't need cleanup. It
>> purposefully tests corner cases of the doc comment parser. For some of
>> them, the conversion to rST will change the meaning. This commit tweaks
>> the test so it passes before and after the conversion. Makes it a worse
>> test for the doc comment parser, which doesn't matter, because the code
>> in question is about to be deleted.
>>
>> Peter Maydell <peter.maydell@linaro.org> writes:
>>
>> > doc-good.json tests some oddities of markup that we don't want to
>> > accept. Make them match the more restrictive rST syntax:
>> >
>> > * in a single list the bullet types must all match
>> > * lists must have leading and following blank lines
>> > * indentation is important
>>
>> Actually, indentation has always been important, but the conversion to
>> rST changes where and how it matters.
>
> Mmm. More specifically, indentation was previously unimportant
> within a multiline block of text, and is now important there.
>
>> > * the '|' example syntax is going to go away entirely, so stop
>> > testing it
>>
>> Before the series, we (try to) cover all doc markup here.
>>
>> The series replaces the doc markup language by rST + a little extra.
>> The test must still cover the little extra then, and covering a bit of
>> rST to ensure basic sanity won't hurt.
>>
>> Correct?
>>
>> I'm asking because a "yes" explains why we can drop coverage without
>> replacement: it's appropriate when the markup in question is replaced by
>> rST.
>
> I guess so. We still want some test coverage of the stuff the
> doc-comment parser is doing that's actually looking for
> arguments and so on; we don't really need to check that
> rst is rst.
>
> It's been a while since I wrote this patch, but basically IIRC
> it's "make the minimal changes necessary so that the test does
> not start failing for the parser changes that will follow".
That's okay, but the commit message could be clearer. Perhaps:
tests/qapi/doc-good.json: Prepare for qapi-doc Sphinx extension
doc-good.json tests doc comment parser corner cases. We're about to
largely replace it by a Sphinx extension, which will have different
corner cases. Tweak the test so it passes both with the old parser
and the Sphinx extension, by making it match the more restrictive
rST syntax:
* in a single list the bullet types must all match
* lists must have leading and following blank lines
* indentation is important
* the '|' example syntax is going to go away entirely, so stop
testing it
This will avoid the tests spuriously breaking when we tighten up the
parser code in the following commits.
>> > This will avoid the tests spuriously breaking when we tighten up the
>> > parser code in the following commits.
>
>> > @@ -62,7 +62,7 @@
>> > ##
>> > # @Base:
>> > # @base1:
>>
>> Here, indentation is relevant even before the series: @base: is only
>> recognized as an argument section when it's not indented.
>>
>> > -# the first member
>> > +# the first member
>>
>> Why do you need to unindent this line?
>
> Because in the tightened syntax, you can either have:
>
> @foo: line 1
> line 2
>
> (the definition part of the argument is multiple lines of
> rST, which all must be lined up to start at the same column)
>
> or
>
> @foo:
> line1
> line2
>
> (the definition is multiple lines of rST, which all start
> in column 1)
>
> But
> @foo:
> line1
>
> is neither of the above, and will be invalid.
>
> The old parser simply stripped all the leading whitespace
> from this kind of multiline lump-of-doc-text. That doesn't
> work for rST because we want to be able to have doc-text
> where leading whitespace matters. So we need to know how
> many characters of whitespace to delete from each line. The
> two options above basically correspond to the two major
> pre-existing kinds of doc-comment.
>
> Compare commit 26ec4e53f2bf0a381, which fixed up the
> doc comments in qapi/ proper to follow this "one of
> these two indent models, but not anything else" pattern.
Ah, now I remember.
Remind me, how is messed up doc comment indentation reported in the
brave new Sphinx world?
>> > ##
>> > { 'struct': 'Base', 'data': { 'base1': 'Enum' } }
>> >
>> > @@ -101,7 +101,7 @@
>> > ##
>> > # @Alternate:
>> > # @i: an integer
>> > -# @b is undocumented
>> > +# @b is undocumented
>>
>> Why do you need to indent this line?
>
> Again, because it needs to follow one of the two
> indent patterns described above. Either no text
> following the "@i:" and all lines start in column 1,
> or all lines have to start in the same column as
> the text following the "@i:". In this case I went for
> option 2.
>
> The test input is a bit odd because it's talking
> about @b in the description-text for @i, but there
> you go. You could alternatively add a newline
> after the @i: line to put the text "@b is undocumented"
> into the doc-text for the whole @Alternate struct
> rather than into the doc-text for the @i member.
The test's purpose is to be mean to the doc parser, not pleasant to the
reader's eye ;)
The doc before the patch tests the (less than ideal) handling of a
mistake that is easy to make, namely forgetting the ':' after the member
name.
Your change is okay.
>> > { 'alternate': 'Alternate',
>> > 'data': { 'i': 'int', 'b': 'bool' } }
>> > @@ -115,7 +115,7 @@
>> > # @arg1: the first argument
>> > #
>> > # @arg2: the second
>> > -# argument
>> > +# argument
>>
>> Why do you need to indent this line?
>
> As above, beacuse it's not in either of the
> two standard "this is what indent for a multi-line
> bit of doc text for an argument can be" patterns.
Thanks!
Preferably with an improved commit message
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2020-08-06 14:47 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 15:43 [PATCH v4 00/18] Convert QAPI doc comments to generate rST instead of texinfo Peter Maydell
2020-03-09 15:43 ` [PATCH v4 01/18] qapi/migration.json: Fix indentation Peter Maydell
2020-03-11 6:06 ` Richard Henderson
2020-03-11 15:12 ` Markus Armbruster
2020-03-09 15:43 ` [PATCH v4 02/18] qapi/qapi-schema.json: Put headers in their own doc-comment blocks Peter Maydell
2020-03-11 6:06 ` Richard Henderson
2020-03-20 9:54 ` Markus Armbruster
2020-03-09 15:43 ` [PATCH v4 03/18] qapi/machine.json: Escape a literal '*' in doc comment Peter Maydell
2020-03-11 6:06 ` Richard Henderson
2020-03-09 15:43 ` [PATCH v4 04/18] tests/qapi/doc-good.json: Clean up markup Peter Maydell
2020-03-11 6:07 ` Richard Henderson
2020-08-05 13:03 ` Markus Armbruster
2020-08-05 13:41 ` Peter Maydell
2020-08-06 14:46 ` Markus Armbruster [this message]
2020-08-06 15:33 ` Peter Maydell
2020-03-09 15:43 ` [PATCH v4 05/18] scripts/qapi: Move doc-comment whitespace stripping to doc.py Peter Maydell
2020-03-11 6:07 ` Richard Henderson
2020-08-06 15:06 ` Markus Armbruster
2020-03-09 15:43 ` [PATCH v4 06/18] scripts/qapi/parser.py: improve doc comment indent handling Peter Maydell
2020-03-11 6:08 ` Richard Henderson
2020-03-09 15:43 ` [PATCH v4 07/18] docs/sphinx: Add new qapi-doc Sphinx extension Peter Maydell
2020-03-09 15:43 ` [PATCH v4 08/18] docs/interop: Convert qemu-ga-ref to rST Peter Maydell
2020-03-11 6:10 ` Richard Henderson
2020-03-09 15:43 ` [PATCH v4 09/18] docs/interop: Convert qemu-qmp-ref " Peter Maydell
2020-03-11 6:11 ` Richard Henderson
2020-03-09 15:43 ` [PATCH v4 10/18] qapi: Use rST markup for literal blocks Peter Maydell
2020-03-11 6:22 ` Richard Henderson
2020-03-09 15:43 ` [PATCH v4 11/18] qga/qapi-schema.json: Add some headings Peter Maydell
2020-03-11 6:22 ` Richard Henderson
2020-03-09 15:43 ` [PATCH v4 12/18] scripts/qapi: Remove texinfo generation support Peter Maydell
2020-03-11 6:23 ` Richard Henderson
2020-03-09 15:44 ` [PATCH v4 13/18] docs/devel/qapi-code-gen.txt: Update to new rST backend conventions Peter Maydell
2020-03-11 6:25 ` Richard Henderson
2020-03-09 15:44 ` [PATCH v4 14/18] Makefile: Remove redundant Texinfo related rules Peter Maydell
2020-03-11 6:27 ` Richard Henderson
2020-03-09 15:44 ` [PATCH v4 15/18] scripts/texi2pod: Delete unused script Peter Maydell
2020-03-11 6:29 ` Richard Henderson
2020-03-09 15:44 ` [PATCH v4 16/18] Remove Texinfo related files from .gitignore and git.orderfile Peter Maydell
2020-03-11 6:30 ` Richard Henderson
2020-03-09 15:44 ` [PATCH v4 17/18] configure: Drop texinfo requirement Peter Maydell
2020-03-11 6:31 ` Richard Henderson
2020-03-09 15:44 ` [PATCH v4 18/18] Remove texinfo dependency from docker and CI configs Peter Maydell
2020-03-11 6:32 ` Richard Henderson
2020-08-05 13:01 ` [PATCH v4 00/18] Convert QAPI doc comments to generate rST instead of texinfo Markus Armbruster
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=87364z6de4.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=jsnow@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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.