All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com
Subject: [PATCH 02/19] tests/qapi-schema: Demonstrate command and event doc comment bugs
Date: Thu, 24 Oct 2019 13:02:20 +0200	[thread overview]
Message-ID: <20191024110237.30963-3-armbru@redhat.com> (raw)
In-Reply-To: <20191024110237.30963-1-armbru@redhat.com>

Add negative tests doc-bad-boxed-command-arg and doc-bad-event-arg to
cover boxed and no arguments.  They demonstrate insufficient doc
comment checking.

Update positive test doc-good to cover boxed event arguments.  It
demonstrates the generated doc comment misses arguments.

These bugs will be fixed later in this series.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 tests/qapi-schema/doc-good.texi               |  8 ++++++
 tests/Makefile.include                        |  2 ++
 .../qapi-schema/doc-bad-boxed-command-arg.err |  0
 .../doc-bad-boxed-command-arg.json            | 15 +++++++++++
 .../qapi-schema/doc-bad-boxed-command-arg.out | 26 +++++++++++++++++++
 tests/qapi-schema/doc-bad-event-arg.err       |  0
 tests/qapi-schema/doc-bad-event-arg.json      |  8 ++++++
 tests/qapi-schema/doc-bad-event-arg.out       | 19 ++++++++++++++
 tests/qapi-schema/doc-good.json               |  7 +++++
 tests/qapi-schema/doc-good.out                |  5 ++++
 10 files changed, 90 insertions(+)
 create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.err
 create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.json
 create mode 100644 tests/qapi-schema/doc-bad-boxed-command-arg.out
 create mode 100644 tests/qapi-schema/doc-bad-event-arg.err
 create mode 100644 tests/qapi-schema/doc-bad-event-arg.json
 create mode 100644 tests/qapi-schema/doc-bad-event-arg.out

diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi
index 2ce8b883c9..d6ecdac94f 100644
--- a/tests/qapi-schema/doc-good.texi
+++ b/tests/qapi-schema/doc-good.texi
@@ -258,3 +258,11 @@ another feature
 
 @end deftypefn
 
+
+
+@deftypefn Event {} EVT-BOXED
+
+BUG: generated doc misses arguments
+
+@end deftypefn
+
diff --git a/tests/Makefile.include b/tests/Makefile.include
index b9deb131fb..ea35cd54cc 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -341,8 +341,10 @@ 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
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..e69de29bb2
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..2c265d2ca3
--- /dev/null
+++ b/tests/qapi-schema/doc-bad-boxed-command-arg.json
@@ -0,0 +1,15 @@
+# Boxed arguments are not to be documented with the command
+# BUG: not rejected
+
+##
+# @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..4ccd788253
--- /dev/null
+++ b/tests/qapi-schema/doc-bad-boxed-command-arg.out
@@ -0,0 +1,26 @@
+module None
+object q_empty
+enum QType
+    prefix QTYPE
+    member none
+    member qnull
+    member qnum
+    member qstring
+    member qdict
+    member qlist
+    member qbool
+module doc-bad-boxed-command-arg.json
+object Args
+    member a: int optional=False
+command cmd-boxed Args -> None
+    gen=True success_response=True boxed=True oob=False preconfig=False
+doc symbol=Args
+    body=
+
+    arg=a
+an argument
+doc symbol=cmd-boxed
+    body=
+
+    arg=a
+bogus
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..e69de29bb2
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..80d4e1240b
--- /dev/null
+++ b/tests/qapi-schema/doc-bad-event-arg.json
@@ -0,0 +1,8 @@
+# Arguments listed in the doc comment must exist in the actual schema
+# BUG: nonexistent @a is not rejected
+
+##
+# @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..ad0367cd45
--- /dev/null
+++ b/tests/qapi-schema/doc-bad-event-arg.out
@@ -0,0 +1,19 @@
+module None
+object q_empty
+enum QType
+    prefix QTYPE
+    member none
+    member qnull
+    member qnum
+    member qstring
+    member qdict
+    member qlist
+    member qbool
+module doc-bad-event-arg.json
+event FOO None
+    boxed=False
+doc symbol=FOO
+    body=
+
+    arg=a
+a
diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 7dc21e58a3..1ae6c3a9da 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -149,3 +149,10 @@
 { 'command': 'cmd-boxed', 'boxed': true,
   'data': 'Object',
   'features': [ 'cmd-feat1', 'cmd-feat2' ] }
+
+##
+# @EVT-BOXED:
+# BUG: generated doc misses arguments
+##
+{ '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..a8fc39d288 100644
--- a/tests/qapi-schema/doc-good.out
+++ b/tests/qapi-schema/doc-good.out
@@ -54,6 +54,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
@@ -170,3 +172,6 @@ If you're bored enough to read this, go see a video of boxed cats
 -> in
 
 <- out
+doc symbol=EVT-BOXED
+    body=
+BUG: generated doc misses arguments
-- 
2.21.0



  parent reply	other threads:[~2019-10-24 11:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 11:02 [PATCH 00/19] qapi: Doc generation fixes Markus Armbruster
2019-10-24 11:02 ` [PATCH 01/19] tests/qapi-schema: Demonstrate feature and enum doc comment bugs Markus Armbruster
2019-10-24 11:02 ` Markus Armbruster [this message]
2019-10-24 11:02 ` [PATCH 03/19] tests/qapi-schema: Cover alternate documentation comments Markus Armbruster
2019-10-24 11:02 ` [PATCH 04/19] tests/qapi-schema: Fix feature documentation testing Markus Armbruster
2019-10-24 11:02 ` [PATCH 05/19] qemu-doc: Belatedly document QMP command deprecation Markus Armbruster
2019-10-24 11:02 ` [PATCH 06/19] qapi: Implement boxed event argument documentation Markus Armbruster
2019-10-24 11:02 ` [PATCH 07/19] qapi: De-duplicate entity documentation generation code Markus Armbruster
2019-10-24 11:02 ` [PATCH 08/19] qapi: Split .connect_doc(), .check_doc() off .check() Markus Armbruster
2019-10-24 11:02 ` [PATCH 09/19] qapi: Fix enum doc comment checking Markus Armbruster
2019-10-24 11:02 ` [PATCH 10/19] qapi: Clean up doc comment checking for implicit union base Markus Armbruster
2019-10-24 11:02 ` [PATCH 11/19] qapi: Fix doc comment checking for commands and events Markus Armbruster
2019-10-24 11:02 ` [PATCH 12/19] qapi: Simplify ._make_implicit_object_type() Markus Armbruster
2019-10-24 11:02 ` [PATCH 13/19] qapi: Eliminate .check_doc() overrides Markus Armbruster
2019-10-24 11:02 ` [PATCH 14/19] qapi: Fold normalize_if() into check_if() Markus Armbruster
2019-10-24 11:02 ` [PATCH 15/19] qapi: Fold normalize_features() into check_features() Markus Armbruster
2019-10-24 11:02 ` [PATCH 16/19] qapi: Fold normalize_enum() into check_enum() Markus Armbruster
2019-10-24 11:02 ` [PATCH 17/19] qapi: Lift features into QAPISchemaEntity Markus Armbruster
2019-10-24 11:02 ` [PATCH 18/19] qapi: Polish reporting of bogus member documentation Markus Armbruster
2019-10-24 11:02 ` [PATCH 19/19] qapi: Check feature documentation against the schema 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=20191024110237.30963-3-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.