tests: qapi-schema tests for allow-preconfig

use new allow-preconfig parameter in tests and make sure that
the QAPISchema can parse allow-preconfig correctly

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1526058959-41425-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Igor Mammedov 2018-05-11 19:15:59 +02:00 committed by Eduardo Habkost
parent d6fe3d02e9
commit 7b13f2c27a
12 changed files with 26 additions and 21 deletions

View File

@ -525,6 +525,7 @@ qapi-schema += missing-type.json
qapi-schema += nested-struct-data.json
qapi-schema += non-objects.json
qapi-schema += oob-test.json
qapi-schema += allow-preconfig-test.json
qapi-schema += pragma-doc-required-crap.json
qapi-schema += pragma-extra-junk.json
qapi-schema += pragma-name-case-whitelist-crap.json

View File

@ -0,0 +1 @@
tests/qapi-schema/allow-preconfig-test.json:2: 'allow-preconfig' of command 'allow-preconfig-test' should only use true value

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,2 @@
# Check against allow-preconfig illegal value
{ 'command': 'allow-preconfig-test', 'allow-preconfig': 'some-string' }

View File

@ -28,9 +28,9 @@ object q_obj_cmd-arg
member arg2: str optional=True
member arg3: bool optional=False
command cmd q_obj_cmd-arg -> Object
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
command cmd-boxed Object -> None
gen=True success_response=True boxed=True oob=False
gen=True success_response=True boxed=True oob=False preconfig=False
doc freeform
body=
= Section

View File

@ -5,4 +5,4 @@ module ident-with-escape.json
object q_obj_fooA-arg
member bar1: str optional=False
command fooA q_obj_fooA-arg -> None
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False

View File

@ -3,6 +3,6 @@ enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
prefix QTYPE
module indented-expr.json
command eins None -> None
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
command zwei None -> None
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False

View File

@ -139,8 +139,8 @@
{ 'command': 'boxed-struct', 'boxed': true, 'data': 'UserDefZero' }
{ 'command': 'boxed-union', 'data': 'UserDefNativeListUnion', 'boxed': true }
# Smoke test on Out-Of-Band
{ 'command': 'an-oob-command', 'allow-oob': true }
# Smoke test on Out-Of-Band and allow-preconfig-test
{ 'command': 'test-flags-command', 'allow-oob': true, 'allow-preconfig': true }
# For testing integer range flattening in opts-visitor. The following schema
# corresponds to the option format:

View File

@ -16,7 +16,7 @@ object Empty1
object Empty2
base Empty1
command user_def_cmd0 Empty2 -> Empty2
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
enum QEnumTwo ['value1', 'value2']
prefix QENUM_TWO
object UserDefOne
@ -143,31 +143,31 @@ object UserDefNativeListUnion
case sizes: q_obj_sizeList-wrapper
case any: q_obj_anyList-wrapper
command user_def_cmd None -> None
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
object q_obj_user_def_cmd1-arg
member ud1a: UserDefOne optional=False
command user_def_cmd1 q_obj_user_def_cmd1-arg -> None
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
object q_obj_user_def_cmd2-arg
member ud1a: UserDefOne optional=False
member ud1b: UserDefOne optional=True
command user_def_cmd2 q_obj_user_def_cmd2-arg -> UserDefTwo
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
object q_obj_guest-get-time-arg
member a: int optional=False
member b: int optional=True
command guest-get-time q_obj_guest-get-time-arg -> int
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
object q_obj_guest-sync-arg
member arg: any optional=False
command guest-sync q_obj_guest-sync-arg -> any
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False
command boxed-struct UserDefZero -> None
gen=True success_response=True boxed=True oob=False
gen=True success_response=True boxed=True oob=False preconfig=False
command boxed-union UserDefNativeListUnion -> None
gen=True success_response=True boxed=True oob=False
command an-oob-command None -> None
gen=True success_response=True boxed=False oob=True
gen=True success_response=True boxed=True oob=False preconfig=False
command test-flags-command None -> None
gen=True success_response=True boxed=False oob=True preconfig=True
object UserDefOptions
member i64: intList optional=True
member u64: uint64List optional=True
@ -231,4 +231,4 @@ object q_obj___org.qemu_x-command-arg
member c: __org.qemu_x-Union2 optional=False
member d: __org.qemu_x-Alt optional=False
command __org.qemu_x-command q_obj___org.qemu_x-command-arg -> __org.qemu_x-Union1
gen=True success_response=True boxed=False oob=False
gen=True success_response=True boxed=False oob=False preconfig=False

View File

@ -45,8 +45,8 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
success_response, boxed, allow_oob, allow_preconfig):
print('command %s %s -> %s' % \
(name, arg_type and arg_type.name, ret_type and ret_type.name))
print(' gen=%s success_response=%s boxed=%s oob=%s' % \
(gen, success_response, boxed, allow_oob))
print(' gen=%s success_response=%s boxed=%s oob=%s preconfig=%s' % \
(gen, success_response, boxed, allow_oob, allow_preconfig))
def visit_event(self, name, info, arg_type, boxed):
print('event %s %s' % (name, arg_type and arg_type.name))

View File

@ -16,7 +16,7 @@ void qmp_user_def_cmd(Error **errp)
{
}
void qmp_an_oob_command(Error **errp)
void qmp_test_flags_command(Error **errp)
{
}