2021-02-01 19:37:39 +00:00
|
|
|
module ./builtin
|
2018-02-11 09:35:54 +00:00
|
|
|
object q_empty
|
2018-12-13 12:37:05 +00:00
|
|
|
enum QType
|
2018-02-11 09:35:54 +00:00
|
|
|
prefix QTYPE
|
2018-12-13 12:37:05 +00:00
|
|
|
member none
|
|
|
|
member qnull
|
|
|
|
member qnum
|
|
|
|
member qstring
|
|
|
|
member qdict
|
|
|
|
member qlist
|
|
|
|
member qbool
|
2018-02-11 09:35:55 +00:00
|
|
|
module qapi-schema-test.json
|
2018-02-11 09:35:54 +00:00
|
|
|
object TestStruct
|
|
|
|
member integer: int optional=False
|
|
|
|
member boolean: bool optional=False
|
2015-09-16 11:06:08 +00:00
|
|
|
member string: str optional=False
|
|
|
|
object NestedEnumsOne
|
|
|
|
member enum1: EnumOne optional=False
|
|
|
|
member enum2: EnumOne optional=True
|
|
|
|
member enum3: EnumOne optional=False
|
|
|
|
member enum4: EnumOne optional=True
|
2018-12-13 12:37:05 +00:00
|
|
|
enum MyEnum
|
2018-02-11 09:35:54 +00:00
|
|
|
object Empty1
|
|
|
|
object Empty2
|
|
|
|
base Empty1
|
2019-09-13 20:13:43 +00:00
|
|
|
object q_obj_Union-base
|
|
|
|
member type: EnumOne optional=False
|
|
|
|
object Union
|
|
|
|
base q_obj_Union-base
|
|
|
|
tag type
|
|
|
|
case value1: q_empty
|
|
|
|
case value2: q_empty
|
|
|
|
case value3: q_empty
|
|
|
|
case value4: q_empty
|
2021-03-23 09:40:21 +00:00
|
|
|
command user-def-cmd0 Empty2 -> Empty2
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2018-12-13 12:37:05 +00:00
|
|
|
enum QEnumTwo
|
2015-09-16 11:06:08 +00:00
|
|
|
prefix QENUM_TWO
|
2018-12-13 12:37:05 +00:00
|
|
|
member value1
|
|
|
|
member value2
|
2018-02-11 09:35:54 +00:00
|
|
|
object UserDefOne
|
|
|
|
base UserDefZero
|
|
|
|
member string: str optional=False
|
|
|
|
member enum1: EnumOne optional=True
|
2018-12-13 12:37:05 +00:00
|
|
|
enum EnumOne
|
|
|
|
member value1
|
|
|
|
member value2
|
|
|
|
member value3
|
|
|
|
member value4
|
2018-02-11 09:35:54 +00:00
|
|
|
object UserDefZero
|
qapi: Use generated TestStruct machinery in tests
Commit d88f5fd and friends first introduced the various test-qmp-*
tests in 2011, with duplicated hand-rolled TestStruct machinery,
to make sure the qapi visitor interface was tested. Later, commit
4f193e3 in 2013 added a .json file for further testing use by the
files, but without consolidating any of the existing hand-rolled
visitors. And with four copies, subtle differences have crept in,
between the tests themselves (mainly whitespace differences, but
also a question of whether to use NULL or "TestStruct" when
calling visit_start_struct()) and from what the generator produces
(the hand-rolled versions did not cater to partially-allocated
objects, because they did not have a deallocation usage).
Of course, just because the visitor interface is tested does not
mean it is a sane interface; and future patches will be changing
some of the visitor contracts. Rather than having to duplicate
the cleanup work in each copy of the TestStruct visitor, and keep
each hand-rolled copy in sync with what the generator supplies, we
might as well just test what the generator should give us in the
first place.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1446791754-23823-2-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-06 06:35:25 +00:00
|
|
|
member integer: int optional=False
|
2018-02-11 09:35:54 +00:00
|
|
|
object UserDefTwoDictDict
|
|
|
|
member userdef: UserDefOne optional=False
|
qapi: Use generated TestStruct machinery in tests
Commit d88f5fd and friends first introduced the various test-qmp-*
tests in 2011, with duplicated hand-rolled TestStruct machinery,
to make sure the qapi visitor interface was tested. Later, commit
4f193e3 in 2013 added a .json file for further testing use by the
files, but without consolidating any of the existing hand-rolled
visitors. And with four copies, subtle differences have crept in,
between the tests themselves (mainly whitespace differences, but
also a question of whether to use NULL or "TestStruct" when
calling visit_start_struct()) and from what the generator produces
(the hand-rolled versions did not cater to partially-allocated
objects, because they did not have a deallocation usage).
Of course, just because the visitor interface is tested does not
mean it is a sane interface; and future patches will be changing
some of the visitor contracts. Rather than having to duplicate
the cleanup work in each copy of the TestStruct visitor, and keep
each hand-rolled copy in sync with what the generator supplies, we
might as well just test what the generator should give us in the
first place.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1446791754-23823-2-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-06 06:35:25 +00:00
|
|
|
member string: str optional=False
|
2018-02-11 09:35:54 +00:00
|
|
|
object UserDefTwoDict
|
|
|
|
member string1: str optional=False
|
|
|
|
member dict2: UserDefTwoDictDict optional=False
|
|
|
|
member dict3: UserDefTwoDictDict optional=True
|
|
|
|
object UserDefTwo
|
|
|
|
member string0: str optional=False
|
|
|
|
member dict1: UserDefTwoDict optional=False
|
2018-07-03 15:56:35 +00:00
|
|
|
object UserDefThree
|
|
|
|
member string0: str optional=False
|
2019-03-01 15:40:45 +00:00
|
|
|
array UserDefOneList UserDefOne
|
|
|
|
array UserDefTwoList UserDefTwo
|
|
|
|
array TestStructList TestStruct
|
2018-02-11 09:35:54 +00:00
|
|
|
object ForceArrays
|
|
|
|
member unused1: UserDefOneList optional=False
|
|
|
|
member unused2: UserDefTwoList optional=False
|
|
|
|
member unused3: TestStructList optional=False
|
2015-09-16 11:06:08 +00:00
|
|
|
object UserDefA
|
|
|
|
member boolean: bool optional=False
|
qapi: Test for various name collisions
Expose some weaknesses in the generator: we don't always forbid
the generation of structs that contain multiple members that map
to the same C or QMP name. This has already been marked FIXME in
qapi.py in commit d90675f, but having more tests will make sure
future patches produce desired behavior; and updating existing
patches to better document things doesn't hurt, either. Some of
these collisions are already caught in the old-style parser
checks, but ultimately we want all collisions to be caught in the
new-style QAPISchema*.check() methods.
This patch focuses on C struct members, and does not consider
collisions between commands and events (affecting C function
names), or even collisions between generated C type names with
user type names (for things like automatic FOOList struct
representing array types or FOOKind for an implicit enum).
There are two types of struct collisions we want to catch:
1) Collision between two keys in a JSON object. qapi.py prevents
that within a single struct (see test duplicate-key), but it is
possible to have collisions between a type's members and its
base type's members (existing tests struct-base-clash,
struct-base-clash-deep), and its flat union variant members
(renamed test flat-union-clash-member).
2) Collision between two members of the C struct that is generated
for a given QAPI type:
a) Multiple QAPI names map to the same C name (new test
args-name-clash)
b) A QAPI name maps to a C name that is used for another purpose
(new tests flat-union-clash-branch, struct-base-clash-base,
union-clash-data). We already fixed some such cases in commit
0f61af3e and 1e6c1616, but more remain.
c) Two C names generated for other purposes clash
(updated test alternate-clash, new test union-clash-branches,
union-clash-type, flat-union-clash-type)
Ultimately, if we need to have a flat union where a tag value
clashes with a base member name, we could change the generator to
name the union (using 'foo.u.value' rather than 'foo.value') or
otherwise munge the C name corresponding to tag values. But
unless such a need arises, it will probably be easier to just
forbid these collisions.
Some of these negative tests will be deleted later, and positive
tests added to qapi-schema-test.json in their place, when the
generator code is reworked to avoid particular code generation
collisions in class 2).
[Note that viewing this patch with git rename detection enabled
may see some confusion due to renaming some tests while adding
others, but where the content is similar enough that git picks
the wrong pre- and post-patch files to associate]
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-6-git-send-email-eblake@redhat.com>
[Improve commit message and comments a bit, drop an unrelated test]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-29 22:21:03 +00:00
|
|
|
member a_b: int optional=True
|
2015-09-16 11:06:08 +00:00
|
|
|
object UserDefB
|
|
|
|
member intb: int optional=False
|
qapi: Test for various name collisions
Expose some weaknesses in the generator: we don't always forbid
the generation of structs that contain multiple members that map
to the same C or QMP name. This has already been marked FIXME in
qapi.py in commit d90675f, but having more tests will make sure
future patches produce desired behavior; and updating existing
patches to better document things doesn't hurt, either. Some of
these collisions are already caught in the old-style parser
checks, but ultimately we want all collisions to be caught in the
new-style QAPISchema*.check() methods.
This patch focuses on C struct members, and does not consider
collisions between commands and events (affecting C function
names), or even collisions between generated C type names with
user type names (for things like automatic FOOList struct
representing array types or FOOKind for an implicit enum).
There are two types of struct collisions we want to catch:
1) Collision between two keys in a JSON object. qapi.py prevents
that within a single struct (see test duplicate-key), but it is
possible to have collisions between a type's members and its
base type's members (existing tests struct-base-clash,
struct-base-clash-deep), and its flat union variant members
(renamed test flat-union-clash-member).
2) Collision between two members of the C struct that is generated
for a given QAPI type:
a) Multiple QAPI names map to the same C name (new test
args-name-clash)
b) A QAPI name maps to a C name that is used for another purpose
(new tests flat-union-clash-branch, struct-base-clash-base,
union-clash-data). We already fixed some such cases in commit
0f61af3e and 1e6c1616, but more remain.
c) Two C names generated for other purposes clash
(updated test alternate-clash, new test union-clash-branches,
union-clash-type, flat-union-clash-type)
Ultimately, if we need to have a flat union where a tag value
clashes with a base member name, we could change the generator to
name the union (using 'foo.u.value' rather than 'foo.value') or
otherwise munge the C name corresponding to tag values. But
unless such a need arises, it will probably be easier to just
forbid these collisions.
Some of these negative tests will be deleted later, and positive
tests added to qapi-schema-test.json in their place, when the
generator code is reworked to avoid particular code generation
collisions in class 2).
[Note that viewing this patch with git rename detection enabled
may see some confusion due to renaming some tests while adding
others, but where the content is similar enough that git picks
the wrong pre- and post-patch files to associate]
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-6-git-send-email-eblake@redhat.com>
[Improve commit message and comments a bit, drop an unrelated test]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-29 22:21:03 +00:00
|
|
|
member a-b: bool optional=True
|
2015-09-16 11:06:08 +00:00
|
|
|
object UserDefFlatUnion
|
|
|
|
base UserDefUnionBase
|
|
|
|
tag enum1
|
|
|
|
case value1: UserDefA
|
|
|
|
case value2: UserDefB
|
|
|
|
case value3: UserDefB
|
2018-06-18 08:40:05 +00:00
|
|
|
case value4: q_empty
|
2018-02-11 09:35:54 +00:00
|
|
|
object UserDefUnionBase
|
|
|
|
base UserDefZero
|
|
|
|
member string: str optional=False
|
|
|
|
member enum1: EnumOne optional=False
|
|
|
|
object q_obj_UserDefFlatUnion2-base
|
|
|
|
member integer: int optional=True
|
|
|
|
member string: str optional=False
|
|
|
|
member enum1: QEnumTwo optional=False
|
2015-09-16 11:06:08 +00:00
|
|
|
object UserDefFlatUnion2
|
2016-03-17 22:48:39 +00:00
|
|
|
base q_obj_UserDefFlatUnion2-base
|
2015-09-16 11:06:08 +00:00
|
|
|
tag enum1
|
|
|
|
case value1: UserDefC
|
|
|
|
case value2: UserDefB
|
2018-02-11 09:35:54 +00:00
|
|
|
object WrapAlternate
|
|
|
|
member alt: UserDefAlternate optional=False
|
|
|
|
alternate UserDefAlternate
|
|
|
|
tag type
|
|
|
|
case udfu: UserDefFlatUnion
|
|
|
|
case e: EnumOne
|
|
|
|
case i: int
|
|
|
|
case n: null
|
|
|
|
object UserDefC
|
|
|
|
member string1: str optional=False
|
|
|
|
member string2: str optional=False
|
|
|
|
alternate AltEnumBool
|
|
|
|
tag type
|
|
|
|
case e: EnumOne
|
|
|
|
case b: bool
|
|
|
|
alternate AltEnumNum
|
|
|
|
tag type
|
|
|
|
case e: EnumOne
|
|
|
|
case n: number
|
|
|
|
alternate AltNumEnum
|
|
|
|
tag type
|
|
|
|
case n: number
|
|
|
|
case e: EnumOne
|
|
|
|
alternate AltEnumInt
|
|
|
|
tag type
|
|
|
|
case e: EnumOne
|
|
|
|
case i: int
|
|
|
|
alternate AltStrObj
|
|
|
|
tag type
|
|
|
|
case s: str
|
|
|
|
case o: TestStruct
|
2021-09-17 14:31:22 +00:00
|
|
|
object ArrayStruct
|
|
|
|
member integer: intList optional=False
|
|
|
|
member s8: int8List optional=False
|
|
|
|
member s16: int16List optional=False
|
|
|
|
member s32: int32List optional=False
|
|
|
|
member s64: int64List optional=False
|
|
|
|
member u8: uint8List optional=False
|
|
|
|
member u16: uint16List optional=False
|
|
|
|
member u32: uint32List optional=False
|
|
|
|
member u64: uint64List optional=False
|
|
|
|
member number: numberList optional=False
|
|
|
|
member boolean: boolList optional=False
|
|
|
|
member string: strList optional=False
|
|
|
|
member sz: sizeList optional=True
|
|
|
|
member any: anyList optional=True
|
|
|
|
member user: StatusList optional=True
|
2019-03-01 15:40:48 +00:00
|
|
|
include include/sub-module.json
|
2021-03-23 09:40:21 +00:00
|
|
|
command user-def-cmd None -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2021-03-23 09:40:21 +00:00
|
|
|
object q_obj_user-def-cmd1-arg
|
2018-02-11 09:35:54 +00:00
|
|
|
member ud1a: UserDefOne optional=False
|
2021-03-23 09:40:21 +00:00
|
|
|
command user-def-cmd1 q_obj_user-def-cmd1-arg -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2021-03-23 09:40:21 +00:00
|
|
|
object q_obj_user-def-cmd2-arg
|
2018-02-11 09:35:54 +00:00
|
|
|
member ud1a: UserDefOne optional=False
|
|
|
|
member ud1b: UserDefOne optional=True
|
2021-03-23 09:40:21 +00:00
|
|
|
command user-def-cmd2 q_obj_user-def-cmd2-arg -> UserDefTwo
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2018-08-30 15:58:10 +00:00
|
|
|
command cmd-success-response None -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=False boxed=False oob=False preconfig=False
|
2020-10-05 15:58:49 +00:00
|
|
|
command coroutine-cmd None -> None
|
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False coroutine=True
|
2018-02-11 09:35:54 +00:00
|
|
|
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
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2018-02-11 09:35:54 +00:00
|
|
|
object q_obj_guest-sync-arg
|
|
|
|
member arg: any optional=False
|
|
|
|
command guest-sync q_obj_guest-sync-arg -> any
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2018-02-11 09:35:54 +00:00
|
|
|
command boxed-struct UserDefZero -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=True oob=False preconfig=False
|
2021-09-17 14:31:26 +00:00
|
|
|
command boxed-union UserDefFlatUnion -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=True oob=False preconfig=False
|
2019-09-13 20:13:41 +00:00
|
|
|
command boxed-empty Empty1 -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=True oob=False preconfig=False
|
2018-05-11 17:15:59 +00:00
|
|
|
command test-flags-command None -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=True preconfig=True
|
2015-09-16 11:06:08 +00:00
|
|
|
object UserDefOptions
|
|
|
|
member i64: intList optional=True
|
|
|
|
member u64: uint64List optional=True
|
|
|
|
member u16: uint16List optional=True
|
|
|
|
member i64x: int optional=True
|
|
|
|
member u64x: uint64 optional=True
|
2018-02-11 09:35:54 +00:00
|
|
|
object EventStructOne
|
|
|
|
member struct1: UserDefOne optional=False
|
2015-09-16 11:06:08 +00:00
|
|
|
member string: str optional=False
|
2018-02-11 09:35:54 +00:00
|
|
|
member enum2: EnumOne optional=True
|
|
|
|
event EVENT_A None
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=False
|
2018-02-11 09:35:54 +00:00
|
|
|
event EVENT_B None
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=False
|
2018-02-11 09:35:54 +00:00
|
|
|
object q_obj_EVENT_C-arg
|
|
|
|
member a: int optional=True
|
|
|
|
member b: UserDefOne optional=True
|
|
|
|
member c: str optional=False
|
|
|
|
event EVENT_C q_obj_EVENT_C-arg
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=False
|
2018-02-11 09:35:54 +00:00
|
|
|
object q_obj_EVENT_D-arg
|
|
|
|
member a: EventStructOne optional=False
|
|
|
|
member b: str optional=False
|
|
|
|
member c: str optional=True
|
|
|
|
member enum3: EnumOne optional=True
|
|
|
|
event EVENT_D q_obj_EVENT_D-arg
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=False
|
2018-02-11 09:35:54 +00:00
|
|
|
event EVENT_E UserDefZero
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=True
|
2019-09-13 20:13:36 +00:00
|
|
|
event EVENT_F UserDefFlatUnion
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=True
|
2019-09-13 20:13:41 +00:00
|
|
|
event EVENT_G Empty1
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=True
|
2018-12-13 12:37:05 +00:00
|
|
|
enum __org.qemu_x-Enum
|
|
|
|
member __org.qemu_x-value
|
2015-09-16 11:06:08 +00:00
|
|
|
object __org.qemu_x-Base
|
|
|
|
member __org.qemu_x-member1: __org.qemu_x-Enum optional=False
|
|
|
|
object __org.qemu_x-Struct
|
|
|
|
base __org.qemu_x-Base
|
|
|
|
member __org.qemu_x-member2: str optional=False
|
2015-11-18 08:52:52 +00:00
|
|
|
member wchar-t: int optional=True
|
2019-09-13 20:13:42 +00:00
|
|
|
alternate __org.qemu_x-Alt1
|
|
|
|
tag type
|
|
|
|
case __org.qemu_x-branch: str
|
2021-09-17 14:31:30 +00:00
|
|
|
array __org.qemu_x-UnionList __org.qemu_x-Union
|
2018-02-11 09:35:54 +00:00
|
|
|
object __org.qemu_x-Struct2
|
2021-09-17 14:31:30 +00:00
|
|
|
member array: __org.qemu_x-UnionList optional=False
|
|
|
|
object __org.qemu_x-Union
|
2015-09-16 11:06:08 +00:00
|
|
|
base __org.qemu_x-Base
|
|
|
|
tag __org.qemu_x-member1
|
|
|
|
case __org.qemu_x-value: __org.qemu_x-Struct2
|
2018-02-11 09:35:54 +00:00
|
|
|
alternate __org.qemu_x-Alt
|
|
|
|
tag type
|
2019-09-13 20:13:42 +00:00
|
|
|
case __org.qemu_x-branch: __org.qemu_x-Base
|
2018-02-11 09:35:54 +00:00
|
|
|
event __ORG.QEMU_X-EVENT __org.qemu_x-Struct
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=False
|
2019-03-01 15:40:45 +00:00
|
|
|
array __org.qemu_x-EnumList __org.qemu_x-Enum
|
|
|
|
array __org.qemu_x-StructList __org.qemu_x-Struct
|
2016-03-17 22:48:29 +00:00
|
|
|
object q_obj___org.qemu_x-command-arg
|
|
|
|
member a: __org.qemu_x-EnumList optional=False
|
|
|
|
member b: __org.qemu_x-StructList optional=False
|
2021-09-17 14:31:30 +00:00
|
|
|
member c: __org.qemu_x-Union optional=False
|
2016-03-17 22:48:29 +00:00
|
|
|
member d: __org.qemu_x-Alt optional=False
|
2021-09-17 14:31:30 +00:00
|
|
|
command __org.qemu_x-command q_obj___org.qemu_x-command-arg -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2018-07-03 15:56:35 +00:00
|
|
|
object TestIfStruct
|
|
|
|
member foo: int optional=False
|
2018-12-13 12:37:15 +00:00
|
|
|
member bar: int optional=False
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_STRUCT_BAR
|
|
|
|
if TEST_IF_STRUCT
|
2018-12-13 12:37:05 +00:00
|
|
|
enum TestIfEnum
|
|
|
|
member foo
|
|
|
|
member bar
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_ENUM_BAR
|
|
|
|
if TEST_IF_ENUM
|
2021-09-17 14:31:28 +00:00
|
|
|
object q_obj_TestIfUnion-base
|
|
|
|
member type: TestIfEnum optional=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']}
|
2018-07-03 15:56:35 +00:00
|
|
|
object TestIfUnion
|
2021-09-17 14:31:28 +00:00
|
|
|
base q_obj_TestIfUnion-base
|
2018-07-03 15:56:35 +00:00
|
|
|
tag type
|
2021-09-17 14:31:28 +00:00
|
|
|
case foo: TestStruct
|
|
|
|
case bar: UserDefZero
|
|
|
|
if TEST_IF_ENUM_BAR
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:21 +00:00
|
|
|
object q_obj_test-if-union-cmd-arg
|
2021-03-23 09:40:23 +00:00
|
|
|
member union-cmd-arg: TestIfUnion optional=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:21 +00:00
|
|
|
command test-if-union-cmd q_obj_test-if-union-cmd-arg -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT']}
|
2018-07-03 15:56:35 +00:00
|
|
|
alternate TestIfAlternate
|
|
|
|
tag type
|
|
|
|
case foo: int
|
|
|
|
case bar: TestStruct
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_ALT_BAR
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:21 +00:00
|
|
|
object q_obj_test-if-alternate-cmd-arg
|
2021-03-23 09:40:23 +00:00
|
|
|
member alt-cmd-arg: TestIfAlternate optional=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:21 +00:00
|
|
|
command test-if-alternate-cmd q_obj_test-if-alternate-cmd-arg -> None
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:21 +00:00
|
|
|
object q_obj_test-if-cmd-arg
|
2018-07-03 15:56:35 +00:00
|
|
|
member foo: TestIfStruct optional=False
|
2018-12-13 12:37:11 +00:00
|
|
|
member bar: TestIfEnum optional=False
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_CMD_BAR
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_CMD', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:21 +00:00
|
|
|
command test-if-cmd q_obj_test-if-cmd-arg -> UserDefThree
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_CMD', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:21 +00:00
|
|
|
command test-cmd-return-def-three None -> UserDefThree
|
2019-10-18 08:14:50 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2019-03-01 15:40:46 +00:00
|
|
|
array TestIfEnumList TestIfEnum
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_ENUM
|
2021-03-23 09:40:10 +00:00
|
|
|
object q_obj_TEST_IF_EVENT-arg
|
2018-07-03 15:56:35 +00:00
|
|
|
member foo: TestIfStruct optional=False
|
2019-03-01 15:40:46 +00:00
|
|
|
member bar: TestIfEnumList optional=False
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_EVT_BAR
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT']}
|
2021-03-23 09:40:10 +00:00
|
|
|
event TEST_IF_EVENT q_obj_TEST_IF_EVENT-arg
|
2019-10-18 08:14:50 +00:00
|
|
|
boxed=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT']}
|
2021-08-31 12:38:01 +00:00
|
|
|
event TEST_IF_EVENT2 None
|
|
|
|
boxed=False
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
|
2019-06-06 15:37:58 +00:00
|
|
|
object FeatureStruct0
|
|
|
|
member foo: int optional=False
|
|
|
|
object FeatureStruct1
|
|
|
|
member foo: int optional=False
|
2020-03-17 11:54:50 +00:00
|
|
|
feature deprecated
|
2019-06-06 15:37:58 +00:00
|
|
|
feature feature1
|
|
|
|
object FeatureStruct2
|
|
|
|
member foo: int optional=False
|
qapi: New special feature flag "unstable"
By convention, names starting with "x-" are experimental. The parts
of external interfaces so named may be withdrawn or changed
incompatibly in future releases.
The naming convention makes unstable interfaces easy to recognize.
Promoting something from experimental to stable involves a name
change. Client code needs to be updated. Occasionally bothersome.
Worse, the convention is not universally observed:
* QOM type "input-barrier" has properties "x-origin", "y-origin".
Looks accidental, but it's ABI since 4.2.
* QOM types "memory-backend-file", "memory-backend-memfd",
"memory-backend-ram", and "memory-backend-epc" have a property
"x-use-canonical-path-for-ramblock-id" that is documented to be
stable despite its name.
We could document these exceptions, but documentation helps only
humans. We want to recognize "unstable" in code, like "deprecated".
So support recognizing it the same way: introduce new special feature
flag "unstable". It will be treated specially by the QAPI generator,
like the existing feature flag "deprecated", and unlike regular
feature flags.
This commit updates documentation and prepares tests. The next commit
updates the QAPI schema. The remaining patches update the QAPI
generator and wire up -compat policy checking.
Management applications can then use query-qmp-schema and -compat to
manage or guard against use of unstable interfaces the same way as for
deprecated interfaces.
docs/devel/qapi-code-gen.txt no longer mandates the naming convention.
Using it anyway might help writers of programs that aren't
full-fledged management applications. Not using it can save us
bothersome renames. We'll see how that shakes out.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-2-armbru@redhat.com>
2021-10-28 10:25:12 +00:00
|
|
|
feature unstable
|
2019-06-06 15:37:58 +00:00
|
|
|
feature feature1
|
|
|
|
object FeatureStruct3
|
|
|
|
member foo: int optional=False
|
|
|
|
feature feature1
|
|
|
|
feature feature2
|
|
|
|
object FeatureStruct4
|
|
|
|
member namespace-test: int optional=False
|
|
|
|
feature namespace-test
|
|
|
|
feature int
|
|
|
|
feature name
|
|
|
|
feature if
|
|
|
|
object CondFeatureStruct1
|
|
|
|
member foo: int optional=False
|
|
|
|
feature feature1
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_FEATURE_1
|
2019-06-06 15:37:58 +00:00
|
|
|
object CondFeatureStruct2
|
|
|
|
member foo: int optional=False
|
|
|
|
feature feature1
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_FEATURE_1
|
2019-06-06 15:37:58 +00:00
|
|
|
feature feature2
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_FEATURE_2
|
2019-06-06 15:37:58 +00:00
|
|
|
object CondFeatureStruct3
|
|
|
|
member foo: int optional=False
|
|
|
|
feature feature1
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_COND_1', 'TEST_IF_COND_2']}
|
2021-08-04 08:31:02 +00:00
|
|
|
object CondFeatureStruct4
|
|
|
|
member foo: int optional=False
|
|
|
|
feature feature1
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'any': ['TEST_IF_COND_1', 'TEST_IF_COND_2']}
|
2020-03-17 11:54:37 +00:00
|
|
|
enum FeatureEnum1
|
|
|
|
member eins
|
|
|
|
member zwei
|
|
|
|
member drei
|
2021-10-25 04:24:02 +00:00
|
|
|
feature deprecated
|
2020-03-17 11:54:37 +00:00
|
|
|
feature feature1
|
|
|
|
object q_obj_FeatureUnion1-base
|
|
|
|
member tag: FeatureEnum1 optional=False
|
|
|
|
object FeatureUnion1
|
|
|
|
base q_obj_FeatureUnion1-base
|
|
|
|
tag tag
|
|
|
|
case eins: FeatureStruct1
|
|
|
|
case zwei: q_empty
|
|
|
|
case drei: q_empty
|
|
|
|
feature feature1
|
|
|
|
alternate FeatureAlternate1
|
|
|
|
tag type
|
|
|
|
case eins: FeatureStruct1
|
|
|
|
feature feature1
|
|
|
|
object q_obj_test-features0-arg
|
qapi: Implement deprecated-output=hide for QMP command results
This policy suppresses deprecated bits in output, and thus permits
"testing the future". Implement it for QMP command results. Example:
when QEMU is run with -compat deprecated-output=hide, then
{"execute": "query-cpus-fast"}
yields
{"return": [{"thread-id": 9805, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
instead of
{"return": [{"arch": "x86", "thread-id": 22436, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
Note the suppression of deprecated member "arch".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210318155519.1224118-4-armbru@redhat.com>
2021-03-18 15:55:11 +00:00
|
|
|
member fs0: FeatureStruct0 optional=True
|
|
|
|
member fs1: FeatureStruct1 optional=True
|
|
|
|
member fs2: FeatureStruct2 optional=True
|
|
|
|
member fs3: FeatureStruct3 optional=True
|
|
|
|
member fs4: FeatureStruct4 optional=True
|
|
|
|
member cfs1: CondFeatureStruct1 optional=True
|
|
|
|
member cfs2: CondFeatureStruct2 optional=True
|
|
|
|
member cfs3: CondFeatureStruct3 optional=True
|
2021-08-04 08:31:02 +00:00
|
|
|
member cfs4: CondFeatureStruct4 optional=True
|
qapi: Implement deprecated-output=hide for QMP command results
This policy suppresses deprecated bits in output, and thus permits
"testing the future". Implement it for QMP command results. Example:
when QEMU is run with -compat deprecated-output=hide, then
{"execute": "query-cpus-fast"}
yields
{"return": [{"thread-id": 9805, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
instead of
{"return": [{"arch": "x86", "thread-id": 22436, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
Note the suppression of deprecated member "arch".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210318155519.1224118-4-armbru@redhat.com>
2021-03-18 15:55:11 +00:00
|
|
|
command test-features0 q_obj_test-features0-arg -> FeatureStruct1
|
2019-10-18 08:14:52 +00:00
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
|
|
|
command test-command-features1 None -> None
|
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
2020-03-17 11:54:50 +00:00
|
|
|
feature deprecated
|
2019-10-18 08:14:52 +00:00
|
|
|
command test-command-features3 None -> None
|
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
qapi: New special feature flag "unstable"
By convention, names starting with "x-" are experimental. The parts
of external interfaces so named may be withdrawn or changed
incompatibly in future releases.
The naming convention makes unstable interfaces easy to recognize.
Promoting something from experimental to stable involves a name
change. Client code needs to be updated. Occasionally bothersome.
Worse, the convention is not universally observed:
* QOM type "input-barrier" has properties "x-origin", "y-origin".
Looks accidental, but it's ABI since 4.2.
* QOM types "memory-backend-file", "memory-backend-memfd",
"memory-backend-ram", and "memory-backend-epc" have a property
"x-use-canonical-path-for-ramblock-id" that is documented to be
stable despite its name.
We could document these exceptions, but documentation helps only
humans. We want to recognize "unstable" in code, like "deprecated".
So support recognizing it the same way: introduce new special feature
flag "unstable". It will be treated specially by the QAPI generator,
like the existing feature flag "deprecated", and unlike regular
feature flags.
This commit updates documentation and prepares tests. The next commit
updates the QAPI schema. The remaining patches update the QAPI
generator and wire up -compat policy checking.
Management applications can then use query-qmp-schema and -compat to
manage or guard against use of unstable interfaces the same way as for
deprecated interfaces.
docs/devel/qapi-code-gen.txt no longer mandates the naming convention.
Using it anyway might help writers of programs that aren't
full-fledged management applications. Not using it can save us
bothersome renames. We'll see how that shakes out.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-2-armbru@redhat.com>
2021-10-28 10:25:12 +00:00
|
|
|
feature unstable
|
2019-10-18 08:14:52 +00:00
|
|
|
feature feature1
|
|
|
|
feature feature2
|
|
|
|
command test-command-cond-features1 None -> None
|
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
|
|
|
feature feature1
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_FEATURE_1
|
2019-10-18 08:14:52 +00:00
|
|
|
command test-command-cond-features2 None -> None
|
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
|
|
|
feature feature1
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_FEATURE_1
|
2019-10-18 08:14:52 +00:00
|
|
|
feature feature2
|
2021-08-04 08:31:05 +00:00
|
|
|
if TEST_IF_FEATURE_2
|
2019-10-18 08:14:52 +00:00
|
|
|
command test-command-cond-features3 None -> None
|
|
|
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
|
|
|
feature feature1
|
tests/qapi-schema: Hide OrderedDict in test output
Since commit 5d83b9a130 "qapi: replace if condition list with dict
{'all': [...]}", we represent if conditionals as trees consisting of
OrderedDict, list and str. This results in less than legible test
output. For instance:
if OrderedDict([('not', OrderedDict([('any', [OrderedDict([('not', 'TEST_IF_EVT')]), OrderedDict([('not', 'TEST_IF_STRUCT')])])]))])
We intend to replace OrderedDict by dict when we get Python 3.7, which
will result in more legible output:
if {'not': {'any': [{'not': 'TEST_IF_EVT'}, {'not': 'TEST_IF_STRUCT'}]}}
Can't wait: put in a hack to get that now, with a comment to revert it
when we replace OrderedDict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-11-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-31 12:38:07 +00:00
|
|
|
if {'all': ['TEST_IF_COND_1', 'TEST_IF_COND_2']}
|
2021-03-23 09:40:10 +00:00
|
|
|
event TEST_EVENT_FEATURES0 FeatureStruct1
|
2021-03-18 15:55:13 +00:00
|
|
|
boxed=False
|
2021-03-23 09:40:10 +00:00
|
|
|
event TEST_EVENT_FEATURES1 None
|
2020-03-17 11:54:37 +00:00
|
|
|
boxed=False
|
2020-03-17 11:54:50 +00:00
|
|
|
feature deprecated
|
qapi: New special feature flag "unstable"
By convention, names starting with "x-" are experimental. The parts
of external interfaces so named may be withdrawn or changed
incompatibly in future releases.
The naming convention makes unstable interfaces easy to recognize.
Promoting something from experimental to stable involves a name
change. Client code needs to be updated. Occasionally bothersome.
Worse, the convention is not universally observed:
* QOM type "input-barrier" has properties "x-origin", "y-origin".
Looks accidental, but it's ABI since 4.2.
* QOM types "memory-backend-file", "memory-backend-memfd",
"memory-backend-ram", and "memory-backend-epc" have a property
"x-use-canonical-path-for-ramblock-id" that is documented to be
stable despite its name.
We could document these exceptions, but documentation helps only
humans. We want to recognize "unstable" in code, like "deprecated".
So support recognizing it the same way: introduce new special feature
flag "unstable". It will be treated specially by the QAPI generator,
like the existing feature flag "deprecated", and unlike regular
feature flags.
This commit updates documentation and prepares tests. The next commit
updates the QAPI schema. The remaining patches update the QAPI
generator and wire up -compat policy checking.
Management applications can then use query-qmp-schema and -compat to
manage or guard against use of unstable interfaces the same way as for
deprecated interfaces.
docs/devel/qapi-code-gen.txt no longer mandates the naming convention.
Using it anyway might help writers of programs that aren't
full-fledged management applications. Not using it can save us
bothersome renames. We'll see how that shakes out.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-Id: <20211028102520.747396-2-armbru@redhat.com>
2021-10-28 10:25:12 +00:00
|
|
|
event TEST_EVENT_FEATURES2 None
|
|
|
|
boxed=False
|
|
|
|
feature unstable
|
2019-11-20 18:25:50 +00:00
|
|
|
module include/sub-module.json
|
|
|
|
include sub-sub-module.json
|
|
|
|
object SecondArrayRef
|
|
|
|
member s: StatusList optional=False
|
|
|
|
module sub-sub-module.json
|
|
|
|
array StatusList Status
|
|
|
|
enum Status
|
|
|
|
member good
|
|
|
|
member bad
|
|
|
|
member ugly
|