diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-10-29 20:06:08 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-10-29 20:06:08 +0000 |
commit | 16884391c750d0c5e863f55ad7aaaa146fc5181e (patch) | |
tree | 7909241a593eea7f9cafaea658e9b101a7682626 /tests | |
parent | 1cfe28cdcabd10e31b0e05db8a2cfd9993f315e2 (diff) | |
parent | e151941d1b691402f7914750e025209b7839a1c0 (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-10-29' into staging
QAPI patches for 2019-10-29
# gpg: Signature made Tue 29 Oct 2019 06:40:56 GMT
# gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg: issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-qapi-2019-10-29:
qapi: Check feature documentation against the schema
qapi: Polish reporting of bogus member documentation
qapi: Lift features into QAPISchemaEntity
qapi: Fold normalize_enum() into check_enum()
qapi: Fold normalize_features() into check_features()
qapi: Fold normalize_if() into check_if()
qapi: Eliminate .check_doc() overrides
qapi: Simplify ._make_implicit_object_type()
qapi: Fix doc comment checking for commands and events
qapi: Clean up doc comment checking for implicit union base
qapi: Fix enum doc comment checking
qapi: Split .connect_doc(), .check_doc() off .check()
qapi: De-duplicate entity documentation generation code
qapi: Implement boxed event argument documentation
qemu-doc: Belatedly document QMP command deprecation
tests/qapi-schema: Fix feature documentation testing
tests/qapi-schema: Cover alternate documentation comments
tests/qapi-schema: Demonstrate command and event doc comment bugs
tests/qapi-schema: Demonstrate feature and enum doc comment bugs
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
23 files changed, 131 insertions, 3 deletions
diff --git a/tests/Makefile.include b/tests/Makefile.include index 7f487f65e7..34ec03391c 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -341,7 +341,11 @@ qapi-schema += base-cycle-indirect.json qapi-schema += command-int.json qapi-schema += comments.json qapi-schema += doc-bad-alternate-member.json +qapi-schema += doc-bad-boxed-command-arg.json qapi-schema += doc-bad-command-arg.json +qapi-schema += doc-bad-enum-member.json +qapi-schema += doc-bad-event-arg.json +qapi-schema += doc-bad-feature.json qapi-schema += doc-bad-section.json qapi-schema += doc-bad-symbol.json qapi-schema += doc-bad-union-member.json @@ -365,6 +369,7 @@ qapi-schema += doc-missing-expr.json qapi-schema += doc-missing-space.json qapi-schema += doc-missing.json qapi-schema += doc-no-symbol.json +qapi-schema += doc-undoc-feature.json qapi-schema += double-type.json qapi-schema += duplicate-key.json qapi-schema += empty.json diff --git a/tests/qapi-schema/doc-bad-alternate-member.err b/tests/qapi-schema/doc-bad-alternate-member.err index a1c282f935..d7286bb57c 100644 --- a/tests/qapi-schema/doc-bad-alternate-member.err +++ b/tests/qapi-schema/doc-bad-alternate-member.err @@ -1 +1 @@ -doc-bad-alternate-member.json:3: the following documented members are not in the declaration: aa, bb +doc-bad-alternate-member.json:3: documented members 'aa', 'bb' do not exist diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.err b/tests/qapi-schema/doc-bad-boxed-command-arg.err new file mode 100644 index 0000000000..7137af3ec9 --- /dev/null +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.err @@ -0,0 +1 @@ +doc-bad-boxed-command-arg.json:9: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.json b/tests/qapi-schema/doc-bad-boxed-command-arg.json new file mode 100644 index 0000000000..bd143241ec --- /dev/null +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.json @@ -0,0 +1,14 @@ +# Boxed arguments are not to be documented with the command + +## +# @Args: +# @a: an argument +## +{ 'struct': 'Args', 'data': { 'a': 'int' } } + +## +# @cmd-boxed: +# @a: bogus +## +{ 'command': 'cmd-boxed', 'boxed': true, + 'data': 'Args' } diff --git a/tests/qapi-schema/doc-bad-boxed-command-arg.out b/tests/qapi-schema/doc-bad-boxed-command-arg.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/doc-bad-boxed-command-arg.out diff --git a/tests/qapi-schema/doc-bad-command-arg.err b/tests/qapi-schema/doc-bad-command-arg.err index 153ea0330a..18ed076cef 100644 --- a/tests/qapi-schema/doc-bad-command-arg.err +++ b/tests/qapi-schema/doc-bad-command-arg.err @@ -1 +1 @@ -doc-bad-command-arg.json:3: the following documented members are not in the declaration: b +doc-bad-command-arg.json:3: documented member 'b' does not exist diff --git a/tests/qapi-schema/doc-bad-enum-member.err b/tests/qapi-schema/doc-bad-enum-member.err new file mode 100644 index 0000000000..7efeb47363 --- /dev/null +++ b/tests/qapi-schema/doc-bad-enum-member.err @@ -0,0 +1 @@ +doc-bad-enum-member.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-enum-member.json b/tests/qapi-schema/doc-bad-enum-member.json new file mode 100644 index 0000000000..9cab35c6e8 --- /dev/null +++ b/tests/qapi-schema/doc-bad-enum-member.json @@ -0,0 +1,8 @@ +# Members listed in the doc comment must exist in the actual schema + +## +# @Foo: +# @a: a +# @b: b +## +{ 'enum': 'Foo', 'data': [ 'b' ] } diff --git a/tests/qapi-schema/doc-bad-enum-member.out b/tests/qapi-schema/doc-bad-enum-member.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/doc-bad-enum-member.out diff --git a/tests/qapi-schema/doc-bad-event-arg.err b/tests/qapi-schema/doc-bad-event-arg.err new file mode 100644 index 0000000000..d13cacf21f --- /dev/null +++ b/tests/qapi-schema/doc-bad-event-arg.err @@ -0,0 +1 @@ +doc-bad-event-arg.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-event-arg.json b/tests/qapi-schema/doc-bad-event-arg.json new file mode 100644 index 0000000000..23c83cc81f --- /dev/null +++ b/tests/qapi-schema/doc-bad-event-arg.json @@ -0,0 +1,7 @@ +# Arguments listed in the doc comment must exist in the actual schema + +## +# @FOO: +# @a: a +## +{ 'event': 'FOO' } diff --git a/tests/qapi-schema/doc-bad-event-arg.out b/tests/qapi-schema/doc-bad-event-arg.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/doc-bad-event-arg.out diff --git a/tests/qapi-schema/doc-bad-feature.err b/tests/qapi-schema/doc-bad-feature.err new file mode 100644 index 0000000000..e4c62adfa3 --- /dev/null +++ b/tests/qapi-schema/doc-bad-feature.err @@ -0,0 +1 @@ +doc-bad-feature.json:3: documented member 'a' does not exist diff --git a/tests/qapi-schema/doc-bad-feature.json b/tests/qapi-schema/doc-bad-feature.json new file mode 100644 index 0000000000..3d49b8e607 --- /dev/null +++ b/tests/qapi-schema/doc-bad-feature.json @@ -0,0 +1,9 @@ +# Features listed in the doc comment must exist in the actual schema + +## +# @foo: +# +# Features: +# @a: a +## +{ 'command': 'foo' } diff --git a/tests/qapi-schema/doc-bad-feature.out b/tests/qapi-schema/doc-bad-feature.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/doc-bad-feature.out diff --git a/tests/qapi-schema/doc-bad-union-member.err b/tests/qapi-schema/doc-bad-union-member.err index 8b9d36eab1..6dd2726a65 100644 --- a/tests/qapi-schema/doc-bad-union-member.err +++ b/tests/qapi-schema/doc-bad-union-member.err @@ -1 +1 @@ -doc-bad-union-member.json:3: the following documented members are not in the declaration: a, b +doc-bad-union-member.json:3: documented members 'a', 'b' do not exist diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json index 7dc21e58a3..d992e713d9 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -99,6 +99,14 @@ 'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } } ## +# @Alternate: +# @i: an integer +# @b is undocumented +## +{ 'alternate': 'Alternate', + 'data': { 'i': 'int', 'b': 'bool' } } + +## # == Another subsection ## @@ -149,3 +157,9 @@ { 'command': 'cmd-boxed', 'boxed': true, 'data': 'Object', 'features': [ 'cmd-feat1', 'cmd-feat2' ] } + +## +# @EVT-BOXED: +## +{ 'event': 'EVT-BOXED', 'boxed': true, + 'data': 'Object' } diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index f78fdef6a9..4c9406a464 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -42,6 +42,10 @@ object SugaredUnion case one: q_obj_Variant1-wrapper case two: q_obj_Variant2-wrapper if ['IFTWO'] +alternate Alternate + tag type + case i: int + case b: bool object q_obj_cmd-arg member arg1: int optional=False member arg2: str optional=True @@ -54,6 +58,8 @@ command cmd-boxed Object -> None gen=True success_response=True boxed=True oob=False preconfig=False feature cmd-feat1 feature cmd-feat2 +event EVT-BOXED Object + boxed=True doc freeform body= = Section @@ -120,6 +126,8 @@ A paragraph Another paragraph (but no @var: line) arg=var1 + feature=variant1-feat +a feature doc symbol=Variant2 body= @@ -131,6 +139,14 @@ doc symbol=SugaredUnion arg=type +doc symbol=Alternate + body= + + arg=i +an integer +@b is undocumented + arg=b + doc freeform body= == Another subsection @@ -144,6 +160,10 @@ the second argument arg=arg3 + feature=cmd-feat1 +a feature + feature=cmd-feat2 +another feature section=Note @arg3 is undocumented section=Returns @@ -166,7 +186,14 @@ Duis aute irure dolor doc symbol=cmd-boxed body= If you're bored enough to read this, go see a video of boxed cats + feature=cmd-feat1 +a feature + feature=cmd-feat2 +another feature section=Example -> in <- out +doc symbol=EVT-BOXED + body= + diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi index 2ce8b883c9..d4b15dabf0 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -170,6 +170,23 @@ One of @t{"one"}, @t{"two"} @end deftp + +@deftp {Alternate} Alternate + + + +@b{Members:} +@table @asis +@item @code{i: int} +an integer +@code{b} is undocumented +@item @code{b: boolean} +Not documented +@end table + +@end deftp + + @subsection Another subsection @@ -258,3 +275,13 @@ another feature @end deftypefn + + +@deftypefn Event {} EVT-BOXED + + + +@b{Arguments:} the members of @code{Object} + +@end deftypefn + diff --git a/tests/qapi-schema/doc-undoc-feature.err b/tests/qapi-schema/doc-undoc-feature.err new file mode 100644 index 0000000000..62fc82d2b9 --- /dev/null +++ b/tests/qapi-schema/doc-undoc-feature.err @@ -0,0 +1,2 @@ +doc-undoc-feature.json: In command 'foo': +doc-undoc-feature.json:9: feature 'undoc' lacks documentation diff --git a/tests/qapi-schema/doc-undoc-feature.json b/tests/qapi-schema/doc-undoc-feature.json new file mode 100644 index 0000000000..c52f88e2cd --- /dev/null +++ b/tests/qapi-schema/doc-undoc-feature.json @@ -0,0 +1,9 @@ +# Doc comment must cover all features + +## +# @foo: +# +# Features: +# @doc: documented feature +## +{ 'command': 'foo', 'features': ['undoc', 'doc'] } diff --git a/tests/qapi-schema/doc-undoc-feature.out b/tests/qapi-schema/doc-undoc-feature.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/doc-undoc-feature.out diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index 2bd9fd8742..bad14edb47 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -117,6 +117,8 @@ def test_frontend(fname): print(' body=\n%s' % doc.body.text) for arg, section in doc.args.items(): print(' arg=%s\n%s' % (arg, section.text)) + for feat, section in doc.features.items(): + print(' feature=%s\n%s' % (feat, section.text)) for section in doc.sections: print(' section=%s\n%s' % (section.name, section.text)) |