mirror of
https://github.com/qemu/qemu.git
synced 2025-08-07 14:43:53 +00:00
tests/qapi-schema: Demonstrate command and event doc comment bugs
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> Message-Id: <20191024110237.30963-3-armbru@redhat.com>
This commit is contained in:
parent
f035b47e3f
commit
717cfcfae6
@ -341,8 +341,10 @@ qapi-schema += base-cycle-indirect.json
|
|||||||
qapi-schema += command-int.json
|
qapi-schema += command-int.json
|
||||||
qapi-schema += comments.json
|
qapi-schema += comments.json
|
||||||
qapi-schema += doc-bad-alternate-member.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-command-arg.json
|
||||||
qapi-schema += doc-bad-enum-member.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-feature.json
|
||||||
qapi-schema += doc-bad-section.json
|
qapi-schema += doc-bad-section.json
|
||||||
qapi-schema += doc-bad-symbol.json
|
qapi-schema += doc-bad-symbol.json
|
||||||
|
0
tests/qapi-schema/doc-bad-boxed-command-arg.err
Normal file
0
tests/qapi-schema/doc-bad-boxed-command-arg.err
Normal file
15
tests/qapi-schema/doc-bad-boxed-command-arg.json
Normal file
15
tests/qapi-schema/doc-bad-boxed-command-arg.json
Normal file
@ -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' }
|
26
tests/qapi-schema/doc-bad-boxed-command-arg.out
Normal file
26
tests/qapi-schema/doc-bad-boxed-command-arg.out
Normal file
@ -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
|
0
tests/qapi-schema/doc-bad-event-arg.err
Normal file
0
tests/qapi-schema/doc-bad-event-arg.err
Normal file
8
tests/qapi-schema/doc-bad-event-arg.json
Normal file
8
tests/qapi-schema/doc-bad-event-arg.json
Normal file
@ -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' }
|
19
tests/qapi-schema/doc-bad-event-arg.out
Normal file
19
tests/qapi-schema/doc-bad-event-arg.out
Normal file
@ -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
|
@ -149,3 +149,10 @@
|
|||||||
{ 'command': 'cmd-boxed', 'boxed': true,
|
{ 'command': 'cmd-boxed', 'boxed': true,
|
||||||
'data': 'Object',
|
'data': 'Object',
|
||||||
'features': [ 'cmd-feat1', 'cmd-feat2' ] }
|
'features': [ 'cmd-feat1', 'cmd-feat2' ] }
|
||||||
|
|
||||||
|
##
|
||||||
|
# @EVT-BOXED:
|
||||||
|
# BUG: generated doc misses arguments
|
||||||
|
##
|
||||||
|
{ 'event': 'EVT-BOXED', 'boxed': true,
|
||||||
|
'data': 'Object' }
|
||||||
|
@ -54,6 +54,8 @@ command cmd-boxed Object -> None
|
|||||||
gen=True success_response=True boxed=True oob=False preconfig=False
|
gen=True success_response=True boxed=True oob=False preconfig=False
|
||||||
feature cmd-feat1
|
feature cmd-feat1
|
||||||
feature cmd-feat2
|
feature cmd-feat2
|
||||||
|
event EVT-BOXED Object
|
||||||
|
boxed=True
|
||||||
doc freeform
|
doc freeform
|
||||||
body=
|
body=
|
||||||
= Section
|
= Section
|
||||||
@ -170,3 +172,6 @@ If you're bored enough to read this, go see a video of boxed cats
|
|||||||
-> in
|
-> in
|
||||||
|
|
||||||
<- out
|
<- out
|
||||||
|
doc symbol=EVT-BOXED
|
||||||
|
body=
|
||||||
|
BUG: generated doc misses arguments
|
||||||
|
@ -258,3 +258,11 @@ another feature
|
|||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@deftypefn Event {} EVT-BOXED
|
||||||
|
|
||||||
|
BUG: generated doc misses arguments
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user