4fd1cbaf14
-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJbO+iNAAoJEDhwtADrkYZTX9gQAJFT0DPtUYQsqbYAhrUIJo/a
lT5OAnMnMou6Qu0XHjSYrqdZu7Ega00rvyeYgtB54lmLcOVrjAxF0SwcPcoOuz7K
O9o00ZmwuFPUugJuYBLDRqJryejbZTCGSOg3cp+YlV6naW6Omck97iu7G/MZWLvB
FJvIIUaPIAGklRhSodhC+yePp1PNbfGVcpDjAxn4e1UQ/2M6gwSFx9iPbNl2WotN
CXjRHmkB4ZcxwcDtzzFLwkXTDkryZE27sOgFjDG5xFWO/oCS+Px7a0vME8YM+j2r
eNa93g16ZohNqHb9t6GarlqrqNqbQF2t6JAPpmlIX5qb3Dtb87MQ/ExdN+FJ4btD
IfBkTnXbs7qkZpConRlrhdd2J01ChnCdcmddUeenlq+8mIMjQJXH2RCwRVKyoZYs
4Z74XWy2A+xMJgjqY9WO7E4jy4QVDSckKIm6je/O8fXzXWxthi4H1/2EN5nAv1hY
zNxP/SW0vpqiR/cVQAr2N6VGz2/m9cWQIf0NwFc765gypPBbCL5HLrb+/xC86Bi3
ylg9YlTw84oXtpSauTYu3oE989iDndu/s9BEUe5fW5g+8azs+h5SHVTwq0Y8dzSZ
n2FsGxr76BlOIu5i1oIYNUUhAoU3txddueT4SNHE5Iaz1x6fAKnMP2hxoo5DWDzn
1Rzgq4ATB8H+V6Og942n
=/2SW
-----END PGP SIGNATURE-----
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2018-07-03-v2' into staging
Monitor patches for 2018-07-03
# gpg: Signature made Tue 03 Jul 2018 22:20:13 BST
# gpg: using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-monitor-2018-07-03-v2: (32 commits)
qapi: Polish command flags documentation in qapi-code-gen.txt
monitor: Improve some comments
qmp: Clean up capability negotiation after commit 02130314d8
qobject: Let qobject_from_jsonf() fail instead of abort
qmp: Switch timestamp_put() to qdict_from_jsonf_nofail()
qmp: Add some comments around null responses
qmp: Simplify monitor_qmp_respond()
qmp: Replace get_qmp_greeting() by qmp_greeting()
qmp: Replace monitor_json_emitter{,raw}() by qmp_{queue,send}_response()
qmp: Use QDict * instead of QObject * for response objects
qmp: De-duplicate error response building
qobject: New qdict_from_jsonf_nofail()
monitor: Peel off @mon_global wrapper
monitor: Rename use_io_thr to use_io_thread
qmp: Don't let JSON errors jump the queue
qmp: Don't let malformed in-band commands jump the queue
tests/qmp-test: Demonstrate QMP errors jumping the queue
qmp: Simplify code around monitor_qmp_dispatch_one()
qmp: Always free QMPRequest with qmp_request_free()
qmp: Revert change to handle_qmp_command tracepoint
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
222 lines
7.8 KiB
Python
222 lines
7.8 KiB
Python
# *-*- Mode: Python -*-*
|
|
|
|
# This file is a stress test of supported qapi constructs that must
|
|
# parse and compile correctly.
|
|
|
|
# Whitelists to permit QAPI rule violations
|
|
{ 'pragma': {
|
|
# Commands allowed to return a non-dictionary:
|
|
'returns-whitelist': [
|
|
'guest-get-time',
|
|
'guest-sync' ] } }
|
|
|
|
{ 'struct': 'TestStruct',
|
|
'data': { 'integer': 'int', 'boolean': 'bool', 'string': 'str' } }
|
|
|
|
# for testing enums
|
|
{ 'struct': 'NestedEnumsOne',
|
|
'data': { 'enum1': 'EnumOne', # Intentional forward reference
|
|
'*enum2': 'EnumOne', 'enum3': 'EnumOne', '*enum4': 'EnumOne' } }
|
|
|
|
# An empty enum, although unusual, is currently acceptable
|
|
{ 'enum': 'MyEnum', 'data': [ ] }
|
|
|
|
# Likewise for an empty struct, including an empty base
|
|
{ 'struct': 'Empty1', 'data': { } }
|
|
{ 'struct': 'Empty2', 'base': 'Empty1', 'data': { } }
|
|
|
|
{ 'command': 'user_def_cmd0', 'data': 'Empty2', 'returns': 'Empty2' }
|
|
|
|
# for testing override of default naming heuristic
|
|
{ 'enum': 'QEnumTwo',
|
|
'prefix': 'QENUM_TWO',
|
|
'data': [ 'value1', 'value2' ] }
|
|
|
|
# for testing nested structs
|
|
{ 'struct': 'UserDefOne',
|
|
'base': 'UserDefZero', # intentional forward reference
|
|
'data': { 'string': 'str',
|
|
'*enum1': 'EnumOne' } } # intentional forward reference
|
|
|
|
{ 'enum': 'EnumOne',
|
|
'data': [ 'value1', 'value2', 'value3', 'value4' ] }
|
|
|
|
{ 'struct': 'UserDefZero',
|
|
'data': { 'integer': 'int' } }
|
|
|
|
{ 'struct': 'UserDefTwoDictDict',
|
|
'data': { 'userdef': 'UserDefOne', 'string': 'str' } }
|
|
|
|
{ 'struct': 'UserDefTwoDict',
|
|
'data': { 'string1': 'str',
|
|
'dict2': 'UserDefTwoDictDict',
|
|
'*dict3': 'UserDefTwoDictDict' } }
|
|
|
|
{ 'struct': 'UserDefTwo',
|
|
'data': { 'string0': 'str',
|
|
'dict1': 'UserDefTwoDict' } }
|
|
|
|
{ 'struct': 'UserDefThree',
|
|
'data': { 'string0': 'str' } }
|
|
|
|
# dummy struct to force generation of array types not otherwise mentioned
|
|
{ 'struct': 'ForceArrays',
|
|
'data': { 'unused1':['UserDefOne'], 'unused2':['UserDefTwo'],
|
|
'unused3':['TestStruct'] } }
|
|
|
|
# for testing unions
|
|
# Among other things, test that a name collision between branches does
|
|
# not cause any problems (since only one branch can be in use at a time),
|
|
# by intentionally using two branches that both have a C member 'a_b'
|
|
{ 'struct': 'UserDefA',
|
|
'data': { 'boolean': 'bool', '*a_b': 'int' } }
|
|
|
|
{ 'struct': 'UserDefB',
|
|
'data': { 'intb': 'int', '*a-b': 'bool' } }
|
|
|
|
{ 'union': 'UserDefFlatUnion',
|
|
'base': 'UserDefUnionBase', # intentional forward reference
|
|
'discriminator': 'enum1',
|
|
'data': { 'value1' : 'UserDefA',
|
|
'value2' : 'UserDefB',
|
|
'value3' : 'UserDefB'
|
|
# 'value4' defaults to empty
|
|
} }
|
|
|
|
{ 'struct': 'UserDefUnionBase',
|
|
'base': 'UserDefZero',
|
|
'data': { 'string': 'str', 'enum1': 'EnumOne' } }
|
|
|
|
# this variant of UserDefFlatUnion defaults to a union that uses members with
|
|
# allocated types to test corner cases in the cleanup/dealloc visitor
|
|
{ 'union': 'UserDefFlatUnion2',
|
|
'base': { '*integer': 'int', 'string': 'str', 'enum1': 'QEnumTwo' },
|
|
'discriminator': 'enum1',
|
|
'data': { 'value1' : 'UserDefC', # intentional forward reference
|
|
'value2' : 'UserDefB' } }
|
|
|
|
{ 'struct': 'WrapAlternate',
|
|
'data': { 'alt': 'UserDefAlternate' } }
|
|
{ 'alternate': 'UserDefAlternate',
|
|
'data': { 'udfu': 'UserDefFlatUnion', 'e': 'EnumOne', 'i': 'int',
|
|
'n': 'null' } }
|
|
|
|
{ 'struct': 'UserDefC',
|
|
'data': { 'string1': 'str', 'string2': 'str' } }
|
|
|
|
# for testing use of 'number' within alternates
|
|
{ 'alternate': 'AltEnumBool', 'data': { 'e': 'EnumOne', 'b': 'bool' } }
|
|
{ 'alternate': 'AltEnumNum', 'data': { 'e': 'EnumOne', 'n': 'number' } }
|
|
{ 'alternate': 'AltNumEnum', 'data': { 'n': 'number', 'e': 'EnumOne' } }
|
|
{ 'alternate': 'AltEnumInt', 'data': { 'e': 'EnumOne', 'i': 'int' } }
|
|
|
|
# for testing use of 'str' within alternates
|
|
{ 'alternate': 'AltStrObj', 'data': { 's': 'str', 'o': 'TestStruct' } }
|
|
|
|
# for testing native lists
|
|
{ 'union': 'UserDefNativeListUnion',
|
|
'data': { 'integer': ['int'],
|
|
's8': ['int8'],
|
|
's16': ['int16'],
|
|
's32': ['int32'],
|
|
's64': ['int64'],
|
|
'u8': ['uint8'],
|
|
'u16': ['uint16'],
|
|
'u32': ['uint32'],
|
|
'u64': ['uint64'],
|
|
'number': ['number'],
|
|
'boolean': ['bool'],
|
|
'string': ['str'],
|
|
'sizes': ['size'],
|
|
'any': ['any'] } }
|
|
|
|
# testing commands
|
|
{ 'command': 'user_def_cmd', 'data': {} }
|
|
{ 'command': 'user_def_cmd1', 'data': {'ud1a': 'UserDefOne'} }
|
|
{ 'command': 'user_def_cmd2',
|
|
'data': {'ud1a': 'UserDefOne', '*ud1b': 'UserDefOne'},
|
|
'returns': 'UserDefTwo' }
|
|
|
|
# Returning a non-dictionary requires a name from the whitelist
|
|
{ 'command': 'guest-get-time', 'data': {'a': 'int', '*b': 'int' },
|
|
'returns': 'int' }
|
|
{ 'command': 'guest-sync', 'data': { 'arg': 'any' }, 'returns': 'any' }
|
|
{ 'command': 'boxed-struct', 'boxed': true, 'data': 'UserDefZero' }
|
|
{ 'command': 'boxed-union', 'data': 'UserDefNativeListUnion', 'boxed': 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:
|
|
#
|
|
# -userdef i64=3-6,i64=-5--1,u64=2,u16=1,u16=7-12
|
|
#
|
|
# For simplicity, this example doesn't use [type=]discriminator nor optargs
|
|
# specific to discriminator values.
|
|
{ 'struct': 'UserDefOptions',
|
|
'data': {
|
|
'*i64' : [ 'int' ],
|
|
'*u64' : [ 'uint64' ],
|
|
'*u16' : [ 'uint16' ],
|
|
'*i64x': 'int' ,
|
|
'*u64x': 'uint64' } }
|
|
|
|
# testing event
|
|
{ 'struct': 'EventStructOne',
|
|
'data': { 'struct1': 'UserDefOne', 'string': 'str', '*enum2': 'EnumOne' } }
|
|
|
|
{ 'event': 'EVENT_A' }
|
|
{ 'event': 'EVENT_B',
|
|
'data': { } }
|
|
{ 'event': 'EVENT_C',
|
|
'data': { '*a': 'int', '*b': 'UserDefOne', 'c': 'str' } }
|
|
{ 'event': 'EVENT_D',
|
|
'data': { 'a' : 'EventStructOne', 'b' : 'str', '*c': 'str', '*enum3': 'EnumOne' } }
|
|
{ 'event': 'EVENT_E', 'boxed': true, 'data': 'UserDefZero' }
|
|
{ 'event': 'EVENT_F', 'boxed': true, 'data': 'UserDefAlternate' }
|
|
|
|
# test that we correctly compile downstream extensions, as well as munge
|
|
# ticklish names
|
|
{ 'enum': '__org.qemu_x-Enum', 'data': [ '__org.qemu_x-value' ] }
|
|
{ 'struct': '__org.qemu_x-Base',
|
|
'data': { '__org.qemu_x-member1': '__org.qemu_x-Enum' } }
|
|
{ 'struct': '__org.qemu_x-Struct', 'base': '__org.qemu_x-Base',
|
|
'data': { '__org.qemu_x-member2': 'str', '*wchar-t': 'int' } }
|
|
{ 'union': '__org.qemu_x-Union1', 'data': { '__org.qemu_x-branch': 'str' } }
|
|
{ 'struct': '__org.qemu_x-Struct2',
|
|
'data': { 'array': ['__org.qemu_x-Union1'] } }
|
|
{ 'union': '__org.qemu_x-Union2', 'base': '__org.qemu_x-Base',
|
|
'discriminator': '__org.qemu_x-member1',
|
|
'data': { '__org.qemu_x-value': '__org.qemu_x-Struct2' } }
|
|
{ 'alternate': '__org.qemu_x-Alt',
|
|
'data': { '__org.qemu_x-branch': 'str', 'b': '__org.qemu_x-Base' } }
|
|
{ 'event': '__ORG.QEMU_X-EVENT', 'data': '__org.qemu_x-Struct' }
|
|
{ 'command': '__org.qemu_x-command',
|
|
'data': { 'a': ['__org.qemu_x-Enum'], 'b': ['__org.qemu_x-Struct'],
|
|
'c': '__org.qemu_x-Union2', 'd': '__org.qemu_x-Alt' },
|
|
'returns': '__org.qemu_x-Union1' }
|
|
|
|
# test 'if' condition handling
|
|
|
|
{ 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
|
|
'if': 'defined(TEST_IF_STRUCT)' }
|
|
|
|
{ 'enum': 'TestIfEnum', 'data': [ 'foo', 'bar' ],
|
|
'if': 'defined(TEST_IF_ENUM)' }
|
|
|
|
{ 'union': 'TestIfUnion', 'data': { 'foo': 'TestStruct' },
|
|
'if': 'defined(TEST_IF_UNION) && defined(TEST_IF_STRUCT)' }
|
|
|
|
{ 'alternate': 'TestIfAlternate', 'data': { 'foo': 'int', 'bar': 'TestStruct' },
|
|
'if': 'defined(TEST_IF_ALT) && defined(TEST_IF_STRUCT)' }
|
|
|
|
{ 'command': 'TestIfCmd', 'data': { 'foo': 'TestIfStruct' },
|
|
'returns': 'UserDefThree',
|
|
'if': ['defined(TEST_IF_CMD)', 'defined(TEST_IF_STRUCT)'] }
|
|
|
|
{ 'command': 'TestCmdReturnDefThree', 'returns': 'UserDefThree' }
|
|
|
|
{ 'event': 'TestIfEvent', 'data': { 'foo': 'TestIfStruct' },
|
|
'if': 'defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT)' }
|