seccomp: add cacheflush to whitelist
[qemu/ar7.git] / tests / qapi-schema / qapi-schema-test.json
blob44638da948c99d4fd58ebb1b0329bad3ab47ab2b
1 # *-*- Mode: Python -*-*
3 # This file is a stress test of supported qapi constructs that must
4 # parse and compile correctly.
6 { 'struct': 'TestStruct',
7   'data': { 'integer': 'int', 'boolean': 'bool', 'string': 'str' } }
9 # for testing enums
10 { 'struct': 'NestedEnumsOne',
11   'data': { 'enum1': 'EnumOne',   # Intentional forward reference
12             '*enum2': 'EnumOne', 'enum3': 'EnumOne', '*enum4': 'EnumOne' } }
14 # An empty enum, although unusual, is currently acceptable
15 { 'enum': 'MyEnum', 'data': [ ] }
17 # Likewise for an empty struct, including an empty base
18 { 'struct': 'Empty1', 'data': { } }
19 { 'struct': 'Empty2', 'base': 'Empty1', 'data': { } }
21 # for testing override of default naming heuristic
22 { 'enum': 'QEnumTwo',
23   'prefix': 'QENUM_TWO',
24   'data': [ 'value1', 'value2' ] }
26 # for testing nested structs
27 { 'struct': 'UserDefOne',
28   'base': 'UserDefZero',        # intentional forward reference
29   'data': { 'string': 'str',
30             '*enum1': 'EnumOne' } }   # intentional forward reference
32 { 'enum': 'EnumOne',
33   'data': [ 'value1', 'value2', 'value3' ] }
35 { 'struct': 'UserDefZero',
36   'data': { 'integer': 'int' } }
38 { 'struct': 'UserDefTwoDictDict',
39   'data': { 'userdef': 'UserDefOne', 'string': 'str' } }
41 { 'struct': 'UserDefTwoDict',
42   'data': { 'string1': 'str',
43             'dict2': 'UserDefTwoDictDict',
44             '*dict3': 'UserDefTwoDictDict' } }
46 { 'struct': 'UserDefTwo',
47   'data': { 'string0': 'str',
48             'dict1': 'UserDefTwoDict' } }
50 # dummy struct to force generation of array types not otherwise mentioned
51 { 'struct': 'ForceArrays',
52   'data': { 'unused1':['UserDefOne'], 'unused2':['UserDefTwo'],
53             'unused3':['TestStruct'] } }
55 # for testing unions
56 # Among other things, test that a name collision between branches does
57 # not cause any problems (since only one branch can be in use at a time),
58 # by intentionally using two branches that both have a C member 'a_b'
59 { 'struct': 'UserDefA',
60   'data': { 'boolean': 'bool', '*a_b': 'int' } }
62 { 'struct': 'UserDefB',
63   'data': { 'intb': 'int', '*a-b': 'bool' } }
65 { 'union': 'UserDefFlatUnion',
66   'base': 'UserDefUnionBase',   # intentional forward reference
67   'discriminator': 'enum1',
68   'data': { 'value1' : 'UserDefA',
69             'value2' : 'UserDefB',
70             'value3' : 'UserDefB' } }
72 { 'struct': 'UserDefUnionBase',
73   'base': 'UserDefZero',
74   'data': { 'string': 'str', 'enum1': 'EnumOne' } }
76 # this variant of UserDefFlatUnion defaults to a union that uses fields with
77 # allocated types to test corner cases in the cleanup/dealloc visitor
78 { 'union': 'UserDefFlatUnion2',
79   'base': 'UserDefUnionBase',
80   'discriminator': 'enum1',
81   'data': { 'value1' : 'UserDefC', # intentional forward reference
82             'value2' : 'UserDefB',
83             'value3' : 'UserDefA' } }
85 { 'alternate': 'UserDefAlternate',
86   'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } }
88 { 'struct': 'UserDefC',
89   'data': { 'string1': 'str', 'string2': 'str' } }
91 # for testing use of 'number' within alternates
92 { 'alternate': 'AltStrBool', 'data': { 's': 'str', 'b': 'bool' } }
93 { 'alternate': 'AltStrNum', 'data': { 's': 'str', 'n': 'number' } }
94 { 'alternate': 'AltNumStr', 'data': { 'n': 'number', 's': 'str' } }
95 { 'alternate': 'AltStrInt', 'data': { 's': 'str', 'i': 'int' } }
96 { 'alternate': 'AltIntNum', 'data': { 'i': 'int', 'n': 'number' } }
97 { 'alternate': 'AltNumInt', 'data': { 'n': 'number', 'i': 'int' } }
99 # for testing native lists
100 { 'union': 'UserDefNativeListUnion',
101   'data': { 'integer': ['int'],
102             's8': ['int8'],
103             's16': ['int16'],
104             's32': ['int32'],
105             's64': ['int64'],
106             'u8': ['uint8'],
107             'u16': ['uint16'],
108             'u32': ['uint32'],
109             'u64': ['uint64'],
110             'number': ['number'],
111             'boolean': ['bool'],
112             'string': ['str'],
113             'sizes': ['size'],
114             'any': ['any'] } }
116 # testing commands
117 { 'command': 'user_def_cmd', 'data': {} }
118 { 'command': 'user_def_cmd1', 'data': {'ud1a': 'UserDefOne'} }
119 { 'command': 'user_def_cmd2',
120   'data': {'ud1a': 'UserDefOne', '*ud1b': 'UserDefOne'},
121   'returns': 'UserDefTwo' }
123 # Returning a non-dictionary requires a name from the whitelist
124 { 'command': 'guest-get-time', 'data': {'a': 'int', '*b': 'int' },
125   'returns': 'int' }
126 { 'command': 'guest-sync', 'data': { 'arg': 'any' }, 'returns': 'any' }
128 # For testing integer range flattening in opts-visitor. The following schema
129 # corresponds to the option format:
131 # -userdef i64=3-6,i64=-5--1,u64=2,u16=1,u16=7-12
133 # For simplicity, this example doesn't use [type=]discriminator nor optargs
134 # specific to discriminator values.
135 { 'struct': 'UserDefOptions',
136   'data': {
137     '*i64' : [ 'int'    ],
138     '*u64' : [ 'uint64' ],
139     '*u16' : [ 'uint16' ],
140     '*i64x':   'int'     ,
141     '*u64x':   'uint64'  } }
143 # testing event
144 { 'struct': 'EventStructOne',
145   'data': { 'struct1': 'UserDefOne', 'string': 'str', '*enum2': 'EnumOne' } }
147 { 'event': 'EVENT_A' }
148 { 'event': 'EVENT_B',
149   'data': { } }
150 { 'event': 'EVENT_C',
151   'data': { '*a': 'int', '*b': 'UserDefOne', 'c': 'str' } }
152 { 'event': 'EVENT_D',
153   'data': { 'a' : 'EventStructOne', 'b' : 'str', '*c': 'str', '*enum3': 'EnumOne' } }
155 # test that we correctly compile downstream extensions
156 { 'enum': '__org.qemu_x-Enum', 'data': [ '__org.qemu_x-value' ] }
157 { 'struct': '__org.qemu_x-Base',
158   'data': { '__org.qemu_x-member1': '__org.qemu_x-Enum' } }
159 { 'struct': '__org.qemu_x-Struct', 'base': '__org.qemu_x-Base',
160   'data': { '__org.qemu_x-member2': 'str' } }
161 { 'union': '__org.qemu_x-Union1', 'data': { '__org.qemu_x-branch': 'str' } }
162 { 'struct': '__org.qemu_x-Struct2',
163   'data': { 'array': ['__org.qemu_x-Union1'] } }
164 { 'union': '__org.qemu_x-Union2', 'base': '__org.qemu_x-Base',
165   'discriminator': '__org.qemu_x-member1',
166   'data': { '__org.qemu_x-value': '__org.qemu_x-Struct2' } }
167 { 'alternate': '__org.qemu_x-Alt',
168   'data': { '__org.qemu_x-branch': 'str', 'b': '__org.qemu_x-Base' } }
169 { 'event': '__ORG.QEMU_X-EVENT', 'data': '__org.qemu_x-Struct' }
170 { 'command': '__org.qemu_x-command',
171   'data': { 'a': ['__org.qemu_x-Enum'], 'b': ['__org.qemu_x-Struct'],
172             'c': '__org.qemu_x-Union2', 'd': '__org.qemu_x-Alt' },
173   'returns': '__org.qemu_x-Union1' }