diff options
author | Yang Zhang <yang.z.zhang@intel.com> | 2015-08-28 09:58:54 +0800 |
---|---|---|
committer | Yang Zhang <yang.z.zhang@intel.com> | 2015-09-01 12:44:00 +0800 |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/tests/qapi-schema | |
parent | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff) |
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/tests/qapi-schema')
431 files changed, 943 insertions, 0 deletions
diff --git a/qemu/tests/qapi-schema/alternate-array.err b/qemu/tests/qapi-schema/alternate-array.err new file mode 100644 index 000000000..7b930c64a --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-array.err @@ -0,0 +1 @@ +tests/qapi-schema/alternate-array.json:5: Member 'two' of alternate 'Alt' cannot be an array diff --git a/qemu/tests/qapi-schema/alternate-array.exit b/qemu/tests/qapi-schema/alternate-array.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-array.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/alternate-array.json b/qemu/tests/qapi-schema/alternate-array.json new file mode 100644 index 000000000..f241aac12 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-array.json @@ -0,0 +1,7 @@ +# we do not allow array branches in alternates +# TODO: should we support this? +{ 'struct': 'One', + 'data': { 'name': 'str' } } +{ 'alternate': 'Alt', + 'data': { 'one': 'One', + 'two': [ 'int' ] } } diff --git a/qemu/tests/qapi-schema/alternate-array.out b/qemu/tests/qapi-schema/alternate-array.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-array.out diff --git a/qemu/tests/qapi-schema/alternate-base.err b/qemu/tests/qapi-schema/alternate-base.err new file mode 100644 index 000000000..30d8a3437 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-base.err @@ -0,0 +1 @@ +tests/qapi-schema/alternate-base.json:4: Unknown key 'base' in alternate 'Alt' diff --git a/qemu/tests/qapi-schema/alternate-base.exit b/qemu/tests/qapi-schema/alternate-base.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-base.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/alternate-base.json b/qemu/tests/qapi-schema/alternate-base.json new file mode 100644 index 000000000..529430ecf --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-base.json @@ -0,0 +1,6 @@ +# we reject alternate with base type +{ 'struct': 'Base', + 'data': { 'string': 'str' } } +{ 'alternate': 'Alt', + 'base': 'Base', + 'data': { 'number': 'int' } } diff --git a/qemu/tests/qapi-schema/alternate-base.out b/qemu/tests/qapi-schema/alternate-base.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-base.out diff --git a/qemu/tests/qapi-schema/alternate-clash.err b/qemu/tests/qapi-schema/alternate-clash.err new file mode 100644 index 000000000..51bea3e27 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-clash.err @@ -0,0 +1 @@ +tests/qapi-schema/alternate-clash.json:2: Alternate 'Alt1' member 'ONE' clashes with 'one' diff --git a/qemu/tests/qapi-schema/alternate-clash.exit b/qemu/tests/qapi-schema/alternate-clash.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-clash.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/alternate-clash.json b/qemu/tests/qapi-schema/alternate-clash.json new file mode 100644 index 000000000..39479353b --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-clash.json @@ -0,0 +1,3 @@ +# we detect C enum collisions in an alternate +{ 'alternate': 'Alt1', + 'data': { 'one': 'str', 'ONE': 'int' } } diff --git a/qemu/tests/qapi-schema/alternate-clash.out b/qemu/tests/qapi-schema/alternate-clash.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-clash.out diff --git a/qemu/tests/qapi-schema/alternate-conflict-dict.err b/qemu/tests/qapi-schema/alternate-conflict-dict.err new file mode 100644 index 000000000..0f411f4fa --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-dict.err @@ -0,0 +1 @@ +tests/qapi-schema/alternate-conflict-dict.json:6: Alternate 'Alt' member 'two' can't be distinguished from member 'one' diff --git a/qemu/tests/qapi-schema/alternate-conflict-dict.exit b/qemu/tests/qapi-schema/alternate-conflict-dict.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-dict.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/alternate-conflict-dict.json b/qemu/tests/qapi-schema/alternate-conflict-dict.json new file mode 100644 index 000000000..d566cca81 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-dict.json @@ -0,0 +1,8 @@ +# we reject alternates with multiple object branches +{ 'struct': 'One', + 'data': { 'name': 'str' } } +{ 'struct': 'Two', + 'data': { 'value': 'int' } } +{ 'alternate': 'Alt', + 'data': { 'one': 'One', + 'two': 'Two' } } diff --git a/qemu/tests/qapi-schema/alternate-conflict-dict.out b/qemu/tests/qapi-schema/alternate-conflict-dict.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-dict.out diff --git a/qemu/tests/qapi-schema/alternate-conflict-string.err b/qemu/tests/qapi-schema/alternate-conflict-string.err new file mode 100644 index 000000000..fc523b087 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-string.err @@ -0,0 +1 @@ +tests/qapi-schema/alternate-conflict-string.json:4: Alternate 'Alt' member 'two' can't be distinguished from member 'one' diff --git a/qemu/tests/qapi-schema/alternate-conflict-string.exit b/qemu/tests/qapi-schema/alternate-conflict-string.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-string.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/alternate-conflict-string.json b/qemu/tests/qapi-schema/alternate-conflict-string.json new file mode 100644 index 000000000..72f04a820 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-string.json @@ -0,0 +1,6 @@ +# we reject alternates with multiple string-like branches +{ 'enum': 'Enum', + 'data': [ 'hello', 'world' ] } +{ 'alternate': 'Alt', + 'data': { 'one': 'str', + 'two': 'Enum' } } diff --git a/qemu/tests/qapi-schema/alternate-conflict-string.out b/qemu/tests/qapi-schema/alternate-conflict-string.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-conflict-string.out diff --git a/qemu/tests/qapi-schema/alternate-good.err b/qemu/tests/qapi-schema/alternate-good.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-good.err diff --git a/qemu/tests/qapi-schema/alternate-good.exit b/qemu/tests/qapi-schema/alternate-good.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-good.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/alternate-good.json b/qemu/tests/qapi-schema/alternate-good.json new file mode 100644 index 000000000..33717704c --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-good.json @@ -0,0 +1,9 @@ +# Working example of alternate +{ 'struct': 'Data', + 'data': { '*number': 'int', '*name': 'str' } } +{ 'enum': 'Enum', + 'data': [ 'hello', 'world' ] } +{ 'alternate': 'Alt', + 'data': { 'value': 'int', + 'string': 'Enum', + 'struct': 'Data' } } diff --git a/qemu/tests/qapi-schema/alternate-good.out b/qemu/tests/qapi-schema/alternate-good.out new file mode 100644 index 000000000..99848eefb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-good.out @@ -0,0 +1,6 @@ +[OrderedDict([('struct', 'Data'), ('data', OrderedDict([('*number', 'int'), ('*name', 'str')]))]), + OrderedDict([('enum', 'Enum'), ('data', ['hello', 'world'])]), + OrderedDict([('alternate', 'Alt'), ('data', OrderedDict([('value', 'int'), ('string', 'Enum'), ('struct', 'Data')]))])] +[{'enum_name': 'Enum', 'enum_values': ['hello', 'world']}, + {'enum_name': 'AltKind', 'enum_values': None}] +[OrderedDict([('struct', 'Data'), ('data', OrderedDict([('*number', 'int'), ('*name', 'str')]))])] diff --git a/qemu/tests/qapi-schema/alternate-nested.err b/qemu/tests/qapi-schema/alternate-nested.err new file mode 100644 index 000000000..4d1187e60 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-nested.err @@ -0,0 +1 @@ +tests/qapi-schema/alternate-nested.json:4: Member 'nested' of alternate 'Alt2' cannot use alternate type 'Alt1' diff --git a/qemu/tests/qapi-schema/alternate-nested.exit b/qemu/tests/qapi-schema/alternate-nested.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-nested.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/alternate-nested.json b/qemu/tests/qapi-schema/alternate-nested.json new file mode 100644 index 000000000..c4233b9f3 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-nested.json @@ -0,0 +1,5 @@ +# we reject a nested alternate branch +{ 'alternate': 'Alt1', + 'data': { 'name': 'str', 'value': 'int' } } +{ 'alternate': 'Alt2', + 'data': { 'nested': 'Alt1' } } diff --git a/qemu/tests/qapi-schema/alternate-nested.out b/qemu/tests/qapi-schema/alternate-nested.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-nested.out diff --git a/qemu/tests/qapi-schema/alternate-unknown.err b/qemu/tests/qapi-schema/alternate-unknown.err new file mode 100644 index 000000000..dea45dc73 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-unknown.err @@ -0,0 +1 @@ +tests/qapi-schema/alternate-unknown.json:2: Member 'unknown' of alternate 'Alt' uses unknown type 'MissingType' diff --git a/qemu/tests/qapi-schema/alternate-unknown.exit b/qemu/tests/qapi-schema/alternate-unknown.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/alternate-unknown.json b/qemu/tests/qapi-schema/alternate-unknown.json new file mode 100644 index 000000000..ad5c10302 --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-unknown.json @@ -0,0 +1,3 @@ +# we reject an alternate with unknown type in branch +{ 'alternate': 'Alt', + 'data': { 'unknown': 'MissingType' } } diff --git a/qemu/tests/qapi-schema/alternate-unknown.out b/qemu/tests/qapi-schema/alternate-unknown.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/alternate-unknown.out diff --git a/qemu/tests/qapi-schema/bad-base.err b/qemu/tests/qapi-schema/bad-base.err new file mode 100644 index 000000000..154274bdd --- /dev/null +++ b/qemu/tests/qapi-schema/bad-base.err @@ -0,0 +1 @@ +tests/qapi-schema/bad-base.json:3: 'base' for struct 'MyType' cannot use union type 'Union' diff --git a/qemu/tests/qapi-schema/bad-base.exit b/qemu/tests/qapi-schema/bad-base.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-base.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/bad-base.json b/qemu/tests/qapi-schema/bad-base.json new file mode 100644 index 000000000..a634331cd --- /dev/null +++ b/qemu/tests/qapi-schema/bad-base.json @@ -0,0 +1,3 @@ +# we reject a base that is not a struct +{ 'union': 'Union', 'data': { 'a': 'int', 'b': 'str' } } +{ 'struct': 'MyType', 'base': 'Union', 'data': { 'c': 'int' } } diff --git a/qemu/tests/qapi-schema/bad-base.out b/qemu/tests/qapi-schema/bad-base.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/bad-base.out diff --git a/qemu/tests/qapi-schema/bad-data.err b/qemu/tests/qapi-schema/bad-data.err new file mode 100644 index 000000000..8523ac4f4 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-data.err @@ -0,0 +1 @@ +tests/qapi-schema/bad-data.json:2: 'data' for command 'oops' cannot be an array diff --git a/qemu/tests/qapi-schema/bad-data.exit b/qemu/tests/qapi-schema/bad-data.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-data.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/bad-data.json b/qemu/tests/qapi-schema/bad-data.json new file mode 100644 index 000000000..832eeb76f --- /dev/null +++ b/qemu/tests/qapi-schema/bad-data.json @@ -0,0 +1,2 @@ +# we ensure 'data' is a dictionary for all but enums +{ 'command': 'oops', 'data': [ ] } diff --git a/qemu/tests/qapi-schema/bad-data.out b/qemu/tests/qapi-schema/bad-data.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/bad-data.out diff --git a/qemu/tests/qapi-schema/bad-ident.err b/qemu/tests/qapi-schema/bad-ident.err new file mode 100644 index 000000000..c4190602b --- /dev/null +++ b/qemu/tests/qapi-schema/bad-ident.err @@ -0,0 +1 @@ +tests/qapi-schema/bad-ident.json:2: 'struct' does not allow optional name '*oops' diff --git a/qemu/tests/qapi-schema/bad-ident.exit b/qemu/tests/qapi-schema/bad-ident.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-ident.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/bad-ident.json b/qemu/tests/qapi-schema/bad-ident.json new file mode 100644 index 000000000..763627ad2 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-ident.json @@ -0,0 +1,2 @@ +# we reject creating a type name with bad name +{ 'struct': '*oops', 'data': { 'i': 'int' } } diff --git a/qemu/tests/qapi-schema/bad-ident.out b/qemu/tests/qapi-schema/bad-ident.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/bad-ident.out diff --git a/qemu/tests/qapi-schema/bad-type-bool.err b/qemu/tests/qapi-schema/bad-type-bool.err new file mode 100644 index 000000000..62fd70baa --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-bool.err @@ -0,0 +1 @@ +tests/qapi-schema/bad-type-bool.json:2: 'struct' key must have a string value diff --git a/qemu/tests/qapi-schema/bad-type-bool.exit b/qemu/tests/qapi-schema/bad-type-bool.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-bool.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/bad-type-bool.json b/qemu/tests/qapi-schema/bad-type-bool.json new file mode 100644 index 000000000..bde17b56c --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-bool.json @@ -0,0 +1,2 @@ +# we reject an expression with a metatype that is not a string +{ 'struct': true, 'data': { } } diff --git a/qemu/tests/qapi-schema/bad-type-bool.out b/qemu/tests/qapi-schema/bad-type-bool.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-bool.out diff --git a/qemu/tests/qapi-schema/bad-type-dict.err b/qemu/tests/qapi-schema/bad-type-dict.err new file mode 100644 index 000000000..0b2a2aeac --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-dict.err @@ -0,0 +1 @@ +tests/qapi-schema/bad-type-dict.json:2: 'command' key must have a string value diff --git a/qemu/tests/qapi-schema/bad-type-dict.exit b/qemu/tests/qapi-schema/bad-type-dict.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-dict.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/bad-type-dict.json b/qemu/tests/qapi-schema/bad-type-dict.json new file mode 100644 index 000000000..2a91b241f --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-dict.json @@ -0,0 +1,2 @@ +# we reject an expression with a metatype that is not a string +{ 'command': { } } diff --git a/qemu/tests/qapi-schema/bad-type-dict.out b/qemu/tests/qapi-schema/bad-type-dict.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-dict.out diff --git a/qemu/tests/qapi-schema/bad-type-int.err b/qemu/tests/qapi-schema/bad-type-int.err new file mode 100644 index 000000000..da8989540 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-int.err @@ -0,0 +1 @@ +tests/qapi-schema/bad-type-int.json:3:13: Stray "1" diff --git a/qemu/tests/qapi-schema/bad-type-int.exit b/qemu/tests/qapi-schema/bad-type-int.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-int.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/bad-type-int.json b/qemu/tests/qapi-schema/bad-type-int.json new file mode 100644 index 000000000..56fc6f812 --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-int.json @@ -0,0 +1,3 @@ +# we reject an expression with a metatype that is not a string +# FIXME: once the parser understands integer inputs, improve the error message +{ 'struct': 1, 'data': { } } diff --git a/qemu/tests/qapi-schema/bad-type-int.out b/qemu/tests/qapi-schema/bad-type-int.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/bad-type-int.out diff --git a/qemu/tests/qapi-schema/command-int.err b/qemu/tests/qapi-schema/command-int.err new file mode 100644 index 000000000..0f9300679 --- /dev/null +++ b/qemu/tests/qapi-schema/command-int.err @@ -0,0 +1 @@ +tests/qapi-schema/command-int.json:2: built-in 'int' is already defined diff --git a/qemu/tests/qapi-schema/command-int.exit b/qemu/tests/qapi-schema/command-int.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/command-int.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/command-int.json b/qemu/tests/qapi-schema/command-int.json new file mode 100644 index 000000000..c90d408ab --- /dev/null +++ b/qemu/tests/qapi-schema/command-int.json @@ -0,0 +1,3 @@ +# we reject collisions between commands and types +{ 'command': 'int', 'data': { 'character': 'str' }, + 'returns': { 'value': 'int' } } diff --git a/qemu/tests/qapi-schema/command-int.out b/qemu/tests/qapi-schema/command-int.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/command-int.out diff --git a/qemu/tests/qapi-schema/comments.err b/qemu/tests/qapi-schema/comments.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/comments.err diff --git a/qemu/tests/qapi-schema/comments.exit b/qemu/tests/qapi-schema/comments.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/comments.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/comments.json b/qemu/tests/qapi-schema/comments.json new file mode 100644 index 000000000..e643f3a74 --- /dev/null +++ b/qemu/tests/qapi-schema/comments.json @@ -0,0 +1,4 @@ +# Unindented comment +{ 'enum': 'Status', # Comment to the right of code + # Indented comment + 'data': [ 'good', 'bad', 'ugly' ] } diff --git a/qemu/tests/qapi-schema/comments.out b/qemu/tests/qapi-schema/comments.out new file mode 100644 index 000000000..4ce3dcf12 --- /dev/null +++ b/qemu/tests/qapi-schema/comments.out @@ -0,0 +1,3 @@ +[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])] +[{'enum_name': 'Status', 'enum_values': ['good', 'bad', 'ugly']}] +[] diff --git a/qemu/tests/qapi-schema/data-array-empty.err b/qemu/tests/qapi-schema/data-array-empty.err new file mode 100644 index 000000000..f713f1489 --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-empty.err @@ -0,0 +1 @@ +tests/qapi-schema/data-array-empty.json:2: Member 'empty' of 'data' for command 'oops': array type must contain single type name diff --git a/qemu/tests/qapi-schema/data-array-empty.exit b/qemu/tests/qapi-schema/data-array-empty.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-empty.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/data-array-empty.json b/qemu/tests/qapi-schema/data-array-empty.json new file mode 100644 index 000000000..652dcfb24 --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-empty.json @@ -0,0 +1,2 @@ +# we reject an array for data if it does not contain a known type +{ 'command': 'oops', 'data': { 'empty': [ ] } } diff --git a/qemu/tests/qapi-schema/data-array-empty.out b/qemu/tests/qapi-schema/data-array-empty.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-empty.out diff --git a/qemu/tests/qapi-schema/data-array-unknown.err b/qemu/tests/qapi-schema/data-array-unknown.err new file mode 100644 index 000000000..8b731bbcc --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-unknown.err @@ -0,0 +1 @@ +tests/qapi-schema/data-array-unknown.json:2: Member 'array' of 'data' for command 'oops' uses unknown type 'array of NoSuchType' diff --git a/qemu/tests/qapi-schema/data-array-unknown.exit b/qemu/tests/qapi-schema/data-array-unknown.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/data-array-unknown.json b/qemu/tests/qapi-schema/data-array-unknown.json new file mode 100644 index 000000000..6f3e88331 --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-unknown.json @@ -0,0 +1,2 @@ +# we reject an array for data if it does not contain a known type +{ 'command': 'oops', 'data': { 'array': [ 'NoSuchType' ] } } diff --git a/qemu/tests/qapi-schema/data-array-unknown.out b/qemu/tests/qapi-schema/data-array-unknown.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/data-array-unknown.out diff --git a/qemu/tests/qapi-schema/data-int.err b/qemu/tests/qapi-schema/data-int.err new file mode 100644 index 000000000..1a9b077c0 --- /dev/null +++ b/qemu/tests/qapi-schema/data-int.err @@ -0,0 +1 @@ +tests/qapi-schema/data-int.json:2: 'data' for command 'oops' cannot use built-in type 'int' diff --git a/qemu/tests/qapi-schema/data-int.exit b/qemu/tests/qapi-schema/data-int.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/data-int.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/data-int.json b/qemu/tests/qapi-schema/data-int.json new file mode 100644 index 000000000..a334d92e8 --- /dev/null +++ b/qemu/tests/qapi-schema/data-int.json @@ -0,0 +1,2 @@ +# we reject commands where data is not an array or complex type +{ 'command': 'oops', 'data': 'int' } diff --git a/qemu/tests/qapi-schema/data-int.out b/qemu/tests/qapi-schema/data-int.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/data-int.out diff --git a/qemu/tests/qapi-schema/data-member-array-bad.err b/qemu/tests/qapi-schema/data-member-array-bad.err new file mode 100644 index 000000000..2c072d598 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array-bad.err @@ -0,0 +1 @@ +tests/qapi-schema/data-member-array-bad.json:2: Member 'member' of 'data' for command 'oops': array type must contain single type name diff --git a/qemu/tests/qapi-schema/data-member-array-bad.exit b/qemu/tests/qapi-schema/data-member-array-bad.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array-bad.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/data-member-array-bad.json b/qemu/tests/qapi-schema/data-member-array-bad.json new file mode 100644 index 000000000..b2ff144ec --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array-bad.json @@ -0,0 +1,2 @@ +# we reject data if it does not contain a valid array type +{ 'command': 'oops', 'data': { 'member': [ { 'nested': 'str' } ] } } diff --git a/qemu/tests/qapi-schema/data-member-array-bad.out b/qemu/tests/qapi-schema/data-member-array-bad.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array-bad.out diff --git a/qemu/tests/qapi-schema/data-member-array.err b/qemu/tests/qapi-schema/data-member-array.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array.err diff --git a/qemu/tests/qapi-schema/data-member-array.exit b/qemu/tests/qapi-schema/data-member-array.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/data-member-array.json b/qemu/tests/qapi-schema/data-member-array.json new file mode 100644 index 000000000..e6f7f5da1 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array.json @@ -0,0 +1,4 @@ +# valid array members +{ 'enum': 'abc', 'data': [ 'a', 'b', 'c' ] } +{ 'struct': 'def', 'data': { 'array': [ 'abc' ] } } +{ 'command': 'okay', 'data': { 'member1': [ 'int' ], 'member2': [ 'def' ] } } diff --git a/qemu/tests/qapi-schema/data-member-array.out b/qemu/tests/qapi-schema/data-member-array.out new file mode 100644 index 000000000..c39fa2548 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-array.out @@ -0,0 +1,5 @@ +[OrderedDict([('enum', 'abc'), ('data', ['a', 'b', 'c'])]), + OrderedDict([('struct', 'def'), ('data', OrderedDict([('array', ['abc'])]))]), + OrderedDict([('command', 'okay'), ('data', OrderedDict([('member1', ['int']), ('member2', ['def'])]))])] +[{'enum_name': 'abc', 'enum_values': ['a', 'b', 'c']}] +[OrderedDict([('struct', 'def'), ('data', OrderedDict([('array', ['abc'])]))])] diff --git a/qemu/tests/qapi-schema/data-member-unknown.err b/qemu/tests/qapi-schema/data-member-unknown.err new file mode 100644 index 000000000..ab905db80 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-unknown.err @@ -0,0 +1 @@ +tests/qapi-schema/data-member-unknown.json:2: Member 'member' of 'data' for command 'oops' uses unknown type 'NoSuchType' diff --git a/qemu/tests/qapi-schema/data-member-unknown.exit b/qemu/tests/qapi-schema/data-member-unknown.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/data-member-unknown.json b/qemu/tests/qapi-schema/data-member-unknown.json new file mode 100644 index 000000000..342a41ec9 --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-unknown.json @@ -0,0 +1,2 @@ +# we reject data if it does not contain a known type +{ 'command': 'oops', 'data': { 'member': 'NoSuchType' } } diff --git a/qemu/tests/qapi-schema/data-member-unknown.out b/qemu/tests/qapi-schema/data-member-unknown.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/data-member-unknown.out diff --git a/qemu/tests/qapi-schema/data-unknown.err b/qemu/tests/qapi-schema/data-unknown.err new file mode 100644 index 000000000..5b07277a9 --- /dev/null +++ b/qemu/tests/qapi-schema/data-unknown.err @@ -0,0 +1 @@ +tests/qapi-schema/data-unknown.json:2: 'data' for command 'oops' uses unknown type 'NoSuchType' diff --git a/qemu/tests/qapi-schema/data-unknown.exit b/qemu/tests/qapi-schema/data-unknown.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/data-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/data-unknown.json b/qemu/tests/qapi-schema/data-unknown.json new file mode 100644 index 000000000..32aba43b3 --- /dev/null +++ b/qemu/tests/qapi-schema/data-unknown.json @@ -0,0 +1,2 @@ +# we reject data if it does not contain a known type +{ 'command': 'oops', 'data': 'NoSuchType' } diff --git a/qemu/tests/qapi-schema/data-unknown.out b/qemu/tests/qapi-schema/data-unknown.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/data-unknown.out diff --git a/qemu/tests/qapi-schema/double-data.err b/qemu/tests/qapi-schema/double-data.err new file mode 100644 index 000000000..cc765c4ff --- /dev/null +++ b/qemu/tests/qapi-schema/double-data.err @@ -0,0 +1 @@ +tests/qapi-schema/double-data.json:2:41: Duplicate key "data" diff --git a/qemu/tests/qapi-schema/double-data.exit b/qemu/tests/qapi-schema/double-data.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/double-data.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/double-data.json b/qemu/tests/qapi-schema/double-data.json new file mode 100644 index 000000000..e76b51953 --- /dev/null +++ b/qemu/tests/qapi-schema/double-data.json @@ -0,0 +1,2 @@ +# we reject an expression with duplicate top-level keys +{ 'struct': 'bar', 'data': { }, 'data': { 'string': 'str'} } diff --git a/qemu/tests/qapi-schema/double-data.out b/qemu/tests/qapi-schema/double-data.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/double-data.out diff --git a/qemu/tests/qapi-schema/double-type.err b/qemu/tests/qapi-schema/double-type.err new file mode 100644 index 000000000..f9613c6d6 --- /dev/null +++ b/qemu/tests/qapi-schema/double-type.err @@ -0,0 +1 @@ +tests/qapi-schema/double-type.json:2: Unknown key 'command' in struct 'bar' diff --git a/qemu/tests/qapi-schema/double-type.exit b/qemu/tests/qapi-schema/double-type.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/double-type.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/double-type.json b/qemu/tests/qapi-schema/double-type.json new file mode 100644 index 000000000..911fa7af5 --- /dev/null +++ b/qemu/tests/qapi-schema/double-type.json @@ -0,0 +1,2 @@ +# we reject an expression with ambiguous metatype +{ 'command': 'foo', 'struct': 'bar', 'data': { } } diff --git a/qemu/tests/qapi-schema/double-type.out b/qemu/tests/qapi-schema/double-type.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/double-type.out diff --git a/qemu/tests/qapi-schema/duplicate-key.err b/qemu/tests/qapi-schema/duplicate-key.err new file mode 100644 index 000000000..768b276f8 --- /dev/null +++ b/qemu/tests/qapi-schema/duplicate-key.err @@ -0,0 +1 @@ +tests/qapi-schema/duplicate-key.json:2:10: Duplicate key "key" diff --git a/qemu/tests/qapi-schema/duplicate-key.exit b/qemu/tests/qapi-schema/duplicate-key.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/duplicate-key.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/duplicate-key.json b/qemu/tests/qapi-schema/duplicate-key.json new file mode 100644 index 000000000..1b55d8810 --- /dev/null +++ b/qemu/tests/qapi-schema/duplicate-key.json @@ -0,0 +1,2 @@ +{ 'key': 'value', + 'key': 'value' } diff --git a/qemu/tests/qapi-schema/duplicate-key.out b/qemu/tests/qapi-schema/duplicate-key.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/duplicate-key.out diff --git a/qemu/tests/qapi-schema/empty.err b/qemu/tests/qapi-schema/empty.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/empty.err diff --git a/qemu/tests/qapi-schema/empty.exit b/qemu/tests/qapi-schema/empty.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/empty.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/empty.json b/qemu/tests/qapi-schema/empty.json new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/empty.json diff --git a/qemu/tests/qapi-schema/empty.out b/qemu/tests/qapi-schema/empty.out new file mode 100644 index 000000000..b7f89a45c --- /dev/null +++ b/qemu/tests/qapi-schema/empty.out @@ -0,0 +1,3 @@ +[] +[] +[] diff --git a/qemu/tests/qapi-schema/enum-bad-name.err b/qemu/tests/qapi-schema/enum-bad-name.err new file mode 100644 index 000000000..9c3c1002b --- /dev/null +++ b/qemu/tests/qapi-schema/enum-bad-name.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-bad-name.json:2: Member of enum 'MyEnum' uses invalid name 'not^possible' diff --git a/qemu/tests/qapi-schema/enum-bad-name.exit b/qemu/tests/qapi-schema/enum-bad-name.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-bad-name.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-bad-name.json b/qemu/tests/qapi-schema/enum-bad-name.json new file mode 100644 index 000000000..8506562b3 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-bad-name.json @@ -0,0 +1,2 @@ +# we ensure all enum names can map to C +{ 'enum': 'MyEnum', 'data': [ 'not^possible' ] } diff --git a/qemu/tests/qapi-schema/enum-bad-name.out b/qemu/tests/qapi-schema/enum-bad-name.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-bad-name.out diff --git a/qemu/tests/qapi-schema/enum-clash-member.err b/qemu/tests/qapi-schema/enum-clash-member.err new file mode 100644 index 000000000..48bd1360e --- /dev/null +++ b/qemu/tests/qapi-schema/enum-clash-member.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-clash-member.json:2: Enum 'MyEnum' member 'ONE' clashes with 'one' diff --git a/qemu/tests/qapi-schema/enum-clash-member.exit b/qemu/tests/qapi-schema/enum-clash-member.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-clash-member.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-clash-member.json b/qemu/tests/qapi-schema/enum-clash-member.json new file mode 100644 index 000000000..b7dc02a28 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-clash-member.json @@ -0,0 +1,2 @@ +# we reject enums where members will clash when mapped to C enum +{ 'enum': 'MyEnum', 'data': [ 'one', 'ONE' ] } diff --git a/qemu/tests/qapi-schema/enum-clash-member.out b/qemu/tests/qapi-schema/enum-clash-member.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-clash-member.out diff --git a/qemu/tests/qapi-schema/enum-dict-member.err b/qemu/tests/qapi-schema/enum-dict-member.err new file mode 100644 index 000000000..8ca146ea5 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-dict-member.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-dict-member.json:2: Member of enum 'MyEnum' requires a string name diff --git a/qemu/tests/qapi-schema/enum-dict-member.exit b/qemu/tests/qapi-schema/enum-dict-member.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-dict-member.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-dict-member.json b/qemu/tests/qapi-schema/enum-dict-member.json new file mode 100644 index 000000000..79672e0f0 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-dict-member.json @@ -0,0 +1,2 @@ +# we reject any enum member that is not a string +{ 'enum': 'MyEnum', 'data': [ { 'value': 'str' } ] } diff --git a/qemu/tests/qapi-schema/enum-dict-member.out b/qemu/tests/qapi-schema/enum-dict-member.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-dict-member.out diff --git a/qemu/tests/qapi-schema/enum-empty.err b/qemu/tests/qapi-schema/enum-empty.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-empty.err diff --git a/qemu/tests/qapi-schema/enum-empty.exit b/qemu/tests/qapi-schema/enum-empty.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-empty.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/enum-empty.json b/qemu/tests/qapi-schema/enum-empty.json new file mode 100644 index 000000000..40d4e85a2 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-empty.json @@ -0,0 +1,2 @@ +# An empty enum, although unusual, is currently acceptable +{ 'enum': 'MyEnum', 'data': [ ] } diff --git a/qemu/tests/qapi-schema/enum-empty.out b/qemu/tests/qapi-schema/enum-empty.out new file mode 100644 index 000000000..3b75c1613 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-empty.out @@ -0,0 +1,3 @@ +[OrderedDict([('enum', 'MyEnum'), ('data', [])])] +[{'enum_name': 'MyEnum', 'enum_values': []}] +[] diff --git a/qemu/tests/qapi-schema/enum-int-member.err b/qemu/tests/qapi-schema/enum-int-member.err new file mode 100644 index 000000000..071c5213d --- /dev/null +++ b/qemu/tests/qapi-schema/enum-int-member.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-int-member.json:3:31: Stray "1" diff --git a/qemu/tests/qapi-schema/enum-int-member.exit b/qemu/tests/qapi-schema/enum-int-member.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-int-member.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-int-member.json b/qemu/tests/qapi-schema/enum-int-member.json new file mode 100644 index 000000000..6c9c32e14 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-int-member.json @@ -0,0 +1,3 @@ +# we reject any enum member that is not a string +# FIXME: once the parser understands integer inputs, improve the error message +{ 'enum': 'MyEnum', 'data': [ 1 ] } diff --git a/qemu/tests/qapi-schema/enum-int-member.out b/qemu/tests/qapi-schema/enum-int-member.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-int-member.out diff --git a/qemu/tests/qapi-schema/enum-max-member.err b/qemu/tests/qapi-schema/enum-max-member.err new file mode 100644 index 000000000..f77837fb4 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-max-member.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-max-member.json:3: Enum 'MyEnum' member 'max' clashes with '(automatic)' diff --git a/qemu/tests/qapi-schema/enum-max-member.exit b/qemu/tests/qapi-schema/enum-max-member.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-max-member.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-max-member.json b/qemu/tests/qapi-schema/enum-max-member.json new file mode 100644 index 000000000..4bcda0bf0 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-max-member.json @@ -0,0 +1,3 @@ +# we reject user-supplied 'max' for clashing with implicit enum end +# TODO: should we instead munge the implicit value to avoid the clash? +{ 'enum': 'MyEnum', 'data': [ 'max' ] } diff --git a/qemu/tests/qapi-schema/enum-max-member.out b/qemu/tests/qapi-schema/enum-max-member.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-max-member.out diff --git a/qemu/tests/qapi-schema/enum-missing-data.err b/qemu/tests/qapi-schema/enum-missing-data.err new file mode 100644 index 000000000..ba4873ae6 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-missing-data.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-missing-data.json:2: Key 'data' is missing from enum 'MyEnum' diff --git a/qemu/tests/qapi-schema/enum-missing-data.exit b/qemu/tests/qapi-schema/enum-missing-data.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-missing-data.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-missing-data.json b/qemu/tests/qapi-schema/enum-missing-data.json new file mode 100644 index 000000000..558fd35e9 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-missing-data.json @@ -0,0 +1,2 @@ +# we require that all QAPI enums have a data array +{ 'enum': 'MyEnum' } diff --git a/qemu/tests/qapi-schema/enum-missing-data.out b/qemu/tests/qapi-schema/enum-missing-data.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-missing-data.out diff --git a/qemu/tests/qapi-schema/enum-union-clash.err b/qemu/tests/qapi-schema/enum-union-clash.err new file mode 100644 index 000000000..c04e1a806 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-union-clash.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-union-clash.json:2: enum 'UnionKind' should not end in 'Kind' diff --git a/qemu/tests/qapi-schema/enum-union-clash.exit b/qemu/tests/qapi-schema/enum-union-clash.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-union-clash.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-union-clash.json b/qemu/tests/qapi-schema/enum-union-clash.json new file mode 100644 index 000000000..593282b6c --- /dev/null +++ b/qemu/tests/qapi-schema/enum-union-clash.json @@ -0,0 +1,4 @@ +# we reject types that would conflict with implicit union enum +{ 'enum': 'UnionKind', 'data': [ 'oops' ] } +{ 'union': 'Union', + 'data': { 'a': 'int' } } diff --git a/qemu/tests/qapi-schema/enum-union-clash.out b/qemu/tests/qapi-schema/enum-union-clash.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-union-clash.out diff --git a/qemu/tests/qapi-schema/enum-wrong-data.err b/qemu/tests/qapi-schema/enum-wrong-data.err new file mode 100644 index 000000000..11b43471c --- /dev/null +++ b/qemu/tests/qapi-schema/enum-wrong-data.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-wrong-data.json:2: Enum 'MyEnum' requires an array for 'data' diff --git a/qemu/tests/qapi-schema/enum-wrong-data.exit b/qemu/tests/qapi-schema/enum-wrong-data.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-wrong-data.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/enum-wrong-data.json b/qemu/tests/qapi-schema/enum-wrong-data.json new file mode 100644 index 000000000..7b3e255c1 --- /dev/null +++ b/qemu/tests/qapi-schema/enum-wrong-data.json @@ -0,0 +1,2 @@ +# we require that all qapi enums have an array for data +{ 'enum': 'MyEnum', 'data': { 'value': 'str' } } diff --git a/qemu/tests/qapi-schema/enum-wrong-data.out b/qemu/tests/qapi-schema/enum-wrong-data.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/enum-wrong-data.out diff --git a/qemu/tests/qapi-schema/escape-outside-string.err b/qemu/tests/qapi-schema/escape-outside-string.err new file mode 100644 index 000000000..b9b8837fd --- /dev/null +++ b/qemu/tests/qapi-schema/escape-outside-string.err @@ -0,0 +1 @@ +tests/qapi-schema/escape-outside-string.json:3:27: Stray "\" diff --git a/qemu/tests/qapi-schema/escape-outside-string.exit b/qemu/tests/qapi-schema/escape-outside-string.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/escape-outside-string.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/escape-outside-string.json b/qemu/tests/qapi-schema/escape-outside-string.json new file mode 100644 index 000000000..482f79554 --- /dev/null +++ b/qemu/tests/qapi-schema/escape-outside-string.json @@ -0,0 +1,3 @@ +# escape sequences are permitted only inside strings +# { 'command': 'foo', 'data': {} } +{ 'command': 'foo', 'data'\u003a{} } diff --git a/qemu/tests/qapi-schema/escape-outside-string.out b/qemu/tests/qapi-schema/escape-outside-string.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/escape-outside-string.out diff --git a/qemu/tests/qapi-schema/escape-too-big.err b/qemu/tests/qapi-schema/escape-too-big.err new file mode 100644 index 000000000..d9aeb5dc3 --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-big.err @@ -0,0 +1 @@ +tests/qapi-schema/escape-too-big.json:3:14: For now, \u escape only supports non-zero values up to \u007f diff --git a/qemu/tests/qapi-schema/escape-too-big.exit b/qemu/tests/qapi-schema/escape-too-big.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-big.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/escape-too-big.json b/qemu/tests/qapi-schema/escape-too-big.json new file mode 100644 index 000000000..62bcecd55 --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-big.json @@ -0,0 +1,3 @@ +# we don't support full Unicode strings, yet +# { 'command': 'é' } +{ 'command': '\u00e9' } diff --git a/qemu/tests/qapi-schema/escape-too-big.out b/qemu/tests/qapi-schema/escape-too-big.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-big.out diff --git a/qemu/tests/qapi-schema/escape-too-short.err b/qemu/tests/qapi-schema/escape-too-short.err new file mode 100644 index 000000000..934de598e --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-short.err @@ -0,0 +1 @@ +tests/qapi-schema/escape-too-short.json:3:14: \u escape needs 4 hex digits diff --git a/qemu/tests/qapi-schema/escape-too-short.exit b/qemu/tests/qapi-schema/escape-too-short.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-short.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/escape-too-short.json b/qemu/tests/qapi-schema/escape-too-short.json new file mode 100644 index 000000000..6cb1dec8f --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-short.json @@ -0,0 +1,3 @@ +# the \u escape requires 4 hex digits +# { 'command': 'a' } +{ 'command': '\u61' } diff --git a/qemu/tests/qapi-schema/escape-too-short.out b/qemu/tests/qapi-schema/escape-too-short.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/escape-too-short.out diff --git a/qemu/tests/qapi-schema/event-case.err b/qemu/tests/qapi-schema/event-case.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/event-case.err diff --git a/qemu/tests/qapi-schema/event-case.exit b/qemu/tests/qapi-schema/event-case.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/event-case.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/event-case.json b/qemu/tests/qapi-schema/event-case.json new file mode 100644 index 000000000..3a92d8b61 --- /dev/null +++ b/qemu/tests/qapi-schema/event-case.json @@ -0,0 +1,3 @@ +# TODO: might be nice to enforce naming conventions; but until then this works +# even though events should usually be ALL_CAPS +{ 'event': 'oops' } diff --git a/qemu/tests/qapi-schema/event-case.out b/qemu/tests/qapi-schema/event-case.out new file mode 100644 index 000000000..3764bc781 --- /dev/null +++ b/qemu/tests/qapi-schema/event-case.out @@ -0,0 +1,3 @@ +[OrderedDict([('event', 'oops')])] +[] +[] diff --git a/qemu/tests/qapi-schema/event-max.err b/qemu/tests/qapi-schema/event-max.err new file mode 100644 index 000000000..c85653437 --- /dev/null +++ b/qemu/tests/qapi-schema/event-max.err @@ -0,0 +1 @@ +tests/qapi-schema/event-max.json:2: Event name 'MAX' cannot be created diff --git a/qemu/tests/qapi-schema/event-max.exit b/qemu/tests/qapi-schema/event-max.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/event-max.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/event-max.json b/qemu/tests/qapi-schema/event-max.json new file mode 100644 index 000000000..f3d7de2a3 --- /dev/null +++ b/qemu/tests/qapi-schema/event-max.json @@ -0,0 +1,2 @@ +# an event named 'MAX' would conflict with implicit C enum +{ 'event': 'MAX' } diff --git a/qemu/tests/qapi-schema/event-max.out b/qemu/tests/qapi-schema/event-max.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/event-max.out diff --git a/qemu/tests/qapi-schema/event-nest-struct.err b/qemu/tests/qapi-schema/event-nest-struct.err new file mode 100644 index 000000000..5a42701b8 --- /dev/null +++ b/qemu/tests/qapi-schema/event-nest-struct.err @@ -0,0 +1 @@ +tests/qapi-schema/event-nest-struct.json:1: Member 'a' of 'data' for event 'EVENT_A' should be a type name diff --git a/qemu/tests/qapi-schema/event-nest-struct.exit b/qemu/tests/qapi-schema/event-nest-struct.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/event-nest-struct.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/event-nest-struct.json b/qemu/tests/qapi-schema/event-nest-struct.json new file mode 100644 index 000000000..ee6f3ecb6 --- /dev/null +++ b/qemu/tests/qapi-schema/event-nest-struct.json @@ -0,0 +1,2 @@ +{ 'event': 'EVENT_A', + 'data': { 'a' : { 'string' : 'str', 'integer': 'int' }, 'b' : 'str' } } diff --git a/qemu/tests/qapi-schema/event-nest-struct.out b/qemu/tests/qapi-schema/event-nest-struct.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/event-nest-struct.out diff --git a/qemu/tests/qapi-schema/flat-union-array-branch.err b/qemu/tests/qapi-schema/flat-union-array-branch.err new file mode 100644 index 000000000..8ea91eadb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-array-branch.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-array-branch.json:8: Member 'value1' of union 'TestUnion' cannot be an array diff --git a/qemu/tests/qapi-schema/flat-union-array-branch.exit b/qemu/tests/qapi-schema/flat-union-array-branch.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-array-branch.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-array-branch.json b/qemu/tests/qapi-schema/flat-union-array-branch.json new file mode 100644 index 000000000..0b98820a8 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-array-branch.json @@ -0,0 +1,12 @@ +# we require flat union branches to be a struct +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'Base', + 'data': { 'enum1': 'TestEnum' } } +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } +{ 'union': 'TestUnion', + 'base': 'Base', + 'discriminator': 'enum1', + 'data': { 'value1': ['TestTypeB'], + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-array-branch.out b/qemu/tests/qapi-schema/flat-union-array-branch.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-array-branch.out diff --git a/qemu/tests/qapi-schema/flat-union-bad-base.err b/qemu/tests/qapi-schema/flat-union-bad-base.err new file mode 100644 index 000000000..f9c31b2bf --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-base.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-bad-base.json:9: Flat union 'TestUnion' must have a string base field diff --git a/qemu/tests/qapi-schema/flat-union-bad-base.exit b/qemu/tests/qapi-schema/flat-union-bad-base.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-base.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-bad-base.json b/qemu/tests/qapi-schema/flat-union-bad-base.json new file mode 100644 index 000000000..e2e622bb6 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-base.json @@ -0,0 +1,13 @@ +# we require the base to be an existing struct +# TODO: should we allow an anonymous inline base type? +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } +{ 'union': 'TestUnion', + 'base': { 'enum1': 'TestEnum', 'kind': 'str' }, + 'discriminator': 'enum1', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-bad-base.out b/qemu/tests/qapi-schema/flat-union-bad-base.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-base.out diff --git a/qemu/tests/qapi-schema/flat-union-bad-discriminator.err b/qemu/tests/qapi-schema/flat-union-bad-discriminator.err new file mode 100644 index 000000000..c38cc8e4d --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-discriminator.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-bad-discriminator.json:11: Discriminator of flat union 'TestUnion' requires a string name diff --git a/qemu/tests/qapi-schema/flat-union-bad-discriminator.exit b/qemu/tests/qapi-schema/flat-union-bad-discriminator.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-bad-discriminator.json b/qemu/tests/qapi-schema/flat-union-bad-discriminator.json new file mode 100644 index 000000000..cd10b9d90 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-discriminator.json @@ -0,0 +1,15 @@ +# we require the discriminator to be a string naming a base-type member +# this tests the old syntax for anonymous unions before we added alternates +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'TestBase', + 'data': { 'enum1': 'TestEnum', 'kind': 'str' } } +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } +{ 'union': 'TestUnion', + 'base': 'TestBase', + 'discriminator': {}, + 'data': { 'kind1': 'TestTypeA', + 'kind2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-bad-discriminator.out b/qemu/tests/qapi-schema/flat-union-bad-discriminator.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-bad-discriminator.out diff --git a/qemu/tests/qapi-schema/flat-union-base-star.err b/qemu/tests/qapi-schema/flat-union-base-star.err new file mode 100644 index 000000000..b7748f08b --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-star.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-base-star.json:8: Base '**' is not a valid struct diff --git a/qemu/tests/qapi-schema/flat-union-base-star.exit b/qemu/tests/qapi-schema/flat-union-base-star.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-star.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-base-star.json b/qemu/tests/qapi-schema/flat-union-base-star.json new file mode 100644 index 000000000..5099439a9 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-star.json @@ -0,0 +1,12 @@ +# we require the base to be an existing struct +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } +{ 'union': 'TestUnion', + 'base': '**', + 'discriminator': 'enum1', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-base-star.out b/qemu/tests/qapi-schema/flat-union-base-star.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-star.out diff --git a/qemu/tests/qapi-schema/flat-union-base-union.err b/qemu/tests/qapi-schema/flat-union-base-union.err new file mode 100644 index 000000000..ede9859a3 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-union.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-base-union.json:11: Base 'UnionBase' is not a valid struct diff --git a/qemu/tests/qapi-schema/flat-union-base-union.exit b/qemu/tests/qapi-schema/flat-union-base-union.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-union.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-base-union.json b/qemu/tests/qapi-schema/flat-union-base-union.json new file mode 100644 index 000000000..6a8ea687a --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-union.json @@ -0,0 +1,15 @@ +# we require the base to be a struct +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } +{ 'union': 'UnionBase', + 'data': { 'kind1': 'TestTypeA', + 'kind2': 'TestTypeB' } } +{ 'union': 'TestUnion', + 'base': 'UnionBase', + 'discriminator': 'type', + 'data': { 'kind1': 'TestTypeA', + 'kind2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-base-union.out b/qemu/tests/qapi-schema/flat-union-base-union.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-base-union.out diff --git a/qemu/tests/qapi-schema/flat-union-branch-clash.err b/qemu/tests/qapi-schema/flat-union-branch-clash.err new file mode 100644 index 000000000..f11276688 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-branch-clash.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-branch-clash.json:10: Member name 'name' of branch 'value1' clashes with base 'Base' diff --git a/qemu/tests/qapi-schema/flat-union-branch-clash.exit b/qemu/tests/qapi-schema/flat-union-branch-clash.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-branch-clash.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-branch-clash.json b/qemu/tests/qapi-schema/flat-union-branch-clash.json new file mode 100644 index 000000000..8fb054f00 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-branch-clash.json @@ -0,0 +1,14 @@ +# we check for no duplicate keys between branches and base +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'Base', + 'data': { 'enum1': 'TestEnum', '*name': 'str' } } +{ 'struct': 'Branch1', + 'data': { 'name': 'str' } } +{ 'struct': 'Branch2', + 'data': { 'value': 'int' } } +{ 'union': 'TestUnion', + 'base': 'Base', + 'discriminator': 'enum1', + 'data': { 'value1': 'Branch1', + 'value2': 'Branch2' } } diff --git a/qemu/tests/qapi-schema/flat-union-branch-clash.out b/qemu/tests/qapi-schema/flat-union-branch-clash.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-branch-clash.out diff --git a/qemu/tests/qapi-schema/flat-union-inline.err b/qemu/tests/qapi-schema/flat-union-inline.err new file mode 100644 index 000000000..ec586277b --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-inline.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-inline.json:7: Flat union 'TestUnion' must have a string base field diff --git a/qemu/tests/qapi-schema/flat-union-inline.exit b/qemu/tests/qapi-schema/flat-union-inline.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-inline.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-inline.json b/qemu/tests/qapi-schema/flat-union-inline.json new file mode 100644 index 000000000..6bfdd6581 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-inline.json @@ -0,0 +1,11 @@ +# we require branches to be a struct name +# TODO: should we allow anonymous inline types? +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'Base', + 'data': { 'enum1': 'TestEnum', 'kind': 'str' } } +{ 'union': 'TestUnion', + 'base': { 'enum1': 'TestEnum', 'kind': 'str' }, + 'discriminator': 'enum1', + 'data': { 'value1': { 'string': 'str' }, + 'value2': { 'integer': 'int' } } } diff --git a/qemu/tests/qapi-schema/flat-union-inline.out b/qemu/tests/qapi-schema/flat-union-inline.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-inline.out diff --git a/qemu/tests/qapi-schema/flat-union-int-branch.err b/qemu/tests/qapi-schema/flat-union-int-branch.err new file mode 100644 index 000000000..faf01573b --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-int-branch.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-int-branch.json:8: Member 'value1' of union 'TestUnion' cannot use built-in type 'int' diff --git a/qemu/tests/qapi-schema/flat-union-int-branch.exit b/qemu/tests/qapi-schema/flat-union-int-branch.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-int-branch.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-int-branch.json b/qemu/tests/qapi-schema/flat-union-int-branch.json new file mode 100644 index 000000000..9370c349e --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-int-branch.json @@ -0,0 +1,12 @@ +# we require flat union branches to be a struct +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } +{ 'struct': 'Base', + 'data': { 'enum1': 'TestEnum' } } +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } +{ 'union': 'TestUnion', + 'base': 'Base', + 'discriminator': 'enum1', + 'data': { 'value1': 'int', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-int-branch.out b/qemu/tests/qapi-schema/flat-union-int-branch.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-int-branch.out diff --git a/qemu/tests/qapi-schema/flat-union-invalid-branch-key.err b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.err new file mode 100644 index 000000000..ccf72d2df --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-invalid-branch-key.json:13: Discriminator value 'value_wrong' is not found in enum 'TestEnum' diff --git a/qemu/tests/qapi-schema/flat-union-invalid-branch-key.exit b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-invalid-branch-key.json b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.json new file mode 100644 index 000000000..95ff7746b --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.json @@ -0,0 +1,17 @@ +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } + +{ 'struct': 'TestBase', + 'data': { 'enum1': 'TestEnum' } } + +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } + +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } + +{ 'union': 'TestUnion', + 'base': 'TestBase', + 'discriminator': 'enum1', + 'data': { 'value_wrong': 'TestTypeA', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-invalid-branch-key.out b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-branch-key.out diff --git a/qemu/tests/qapi-schema/flat-union-invalid-discriminator.err b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.err new file mode 100644 index 000000000..5f4055614 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-invalid-discriminator.json:13: Discriminator 'enum_wrong' is not a member of base struct 'TestBase' diff --git a/qemu/tests/qapi-schema/flat-union-invalid-discriminator.exit b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-invalid-discriminator.json b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.json new file mode 100644 index 000000000..48b94c3a4 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.json @@ -0,0 +1,17 @@ +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } + +{ 'struct': 'TestBase', + 'data': { 'enum1': 'TestEnum' } } + +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } + +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } + +{ 'union': 'TestUnion', + 'base': 'TestBase', + 'discriminator': 'enum_wrong', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-invalid-discriminator.out b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-invalid-discriminator.out diff --git a/qemu/tests/qapi-schema/flat-union-no-base.err b/qemu/tests/qapi-schema/flat-union-no-base.err new file mode 100644 index 000000000..bb3f70874 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-no-base.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-no-base.json:9: Flat union 'TestUnion' must have a string base field diff --git a/qemu/tests/qapi-schema/flat-union-no-base.exit b/qemu/tests/qapi-schema/flat-union-no-base.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-no-base.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-no-base.json b/qemu/tests/qapi-schema/flat-union-no-base.json new file mode 100644 index 000000000..ffc4c6f0e --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-no-base.json @@ -0,0 +1,12 @@ +# flat unions require a base +# TODO: simple unions should be able to use an enum discriminator +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } +{ 'enum': 'Enum', + 'data': [ 'value1', 'value2' ] } +{ 'union': 'TestUnion', + 'discriminator': 'Enum', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-no-base.out b/qemu/tests/qapi-schema/flat-union-no-base.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-no-base.out diff --git a/qemu/tests/qapi-schema/flat-union-optional-discriminator.err b/qemu/tests/qapi-schema/flat-union-optional-discriminator.err new file mode 100644 index 000000000..aaabedb3b --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-optional-discriminator.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-optional-discriminator.json:6: Discriminator of flat union 'MyUnion' does not allow optional name '*switch' diff --git a/qemu/tests/qapi-schema/flat-union-optional-discriminator.exit b/qemu/tests/qapi-schema/flat-union-optional-discriminator.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-optional-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-optional-discriminator.json b/qemu/tests/qapi-schema/flat-union-optional-discriminator.json new file mode 100644 index 000000000..08a8f7ef8 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-optional-discriminator.json @@ -0,0 +1,10 @@ +# we require the discriminator to be non-optional +{ 'enum': 'Enum', 'data': [ 'one', 'two' ] } +{ 'struct': 'Base', + 'data': { '*switch': 'Enum' } } +{ 'struct': 'Branch', 'data': { 'name': 'str' } } +{ 'union': 'MyUnion', + 'base': 'Base', + 'discriminator': '*switch', + 'data': { 'one': 'Branch', + 'two': 'Branch' } } diff --git a/qemu/tests/qapi-schema/flat-union-optional-discriminator.out b/qemu/tests/qapi-schema/flat-union-optional-discriminator.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-optional-discriminator.out diff --git a/qemu/tests/qapi-schema/flat-union-reverse-define.err b/qemu/tests/qapi-schema/flat-union-reverse-define.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-reverse-define.err diff --git a/qemu/tests/qapi-schema/flat-union-reverse-define.exit b/qemu/tests/qapi-schema/flat-union-reverse-define.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-reverse-define.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/flat-union-reverse-define.json b/qemu/tests/qapi-schema/flat-union-reverse-define.json new file mode 100644 index 000000000..648bbfe2b --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-reverse-define.json @@ -0,0 +1,17 @@ +{ 'union': 'TestUnion', + 'base': 'TestBase', + 'discriminator': 'enum1', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } + +{ 'struct': 'TestBase', + 'data': { 'enum1': 'TestEnum' } } + +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } + +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } + +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } diff --git a/qemu/tests/qapi-schema/flat-union-reverse-define.out b/qemu/tests/qapi-schema/flat-union-reverse-define.out new file mode 100644 index 000000000..1ed7b8a51 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-reverse-define.out @@ -0,0 +1,9 @@ +[OrderedDict([('union', 'TestUnion'), ('base', 'TestBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'TestTypeA'), ('value2', 'TestTypeB')]))]), + OrderedDict([('struct', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum')]))]), + OrderedDict([('enum', 'TestEnum'), ('data', ['value1', 'value2'])]), + OrderedDict([('struct', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), + OrderedDict([('struct', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))])] +[{'enum_name': 'TestEnum', 'enum_values': ['value1', 'value2']}] +[OrderedDict([('struct', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum')]))]), + OrderedDict([('struct', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), + OrderedDict([('struct', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))])] diff --git a/qemu/tests/qapi-schema/flat-union-string-discriminator.err b/qemu/tests/qapi-schema/flat-union-string-discriminator.err new file mode 100644 index 000000000..200016bd5 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-string-discriminator.err @@ -0,0 +1 @@ +tests/qapi-schema/flat-union-string-discriminator.json:13: Discriminator 'kind' must be of enumeration type diff --git a/qemu/tests/qapi-schema/flat-union-string-discriminator.exit b/qemu/tests/qapi-schema/flat-union-string-discriminator.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-string-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/flat-union-string-discriminator.json b/qemu/tests/qapi-schema/flat-union-string-discriminator.json new file mode 100644 index 000000000..8af60333b --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-string-discriminator.json @@ -0,0 +1,17 @@ +{ 'enum': 'TestEnum', + 'data': [ 'value1', 'value2' ] } + +{ 'struct': 'TestBase', + 'data': { 'enum1': 'TestEnum', 'kind': 'str' } } + +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } + +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } + +{ 'union': 'TestUnion', + 'base': 'TestBase', + 'discriminator': 'kind', + 'data': { 'kind1': 'TestTypeA', + 'kind2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/flat-union-string-discriminator.out b/qemu/tests/qapi-schema/flat-union-string-discriminator.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/flat-union-string-discriminator.out diff --git a/qemu/tests/qapi-schema/funny-char.err b/qemu/tests/qapi-schema/funny-char.err new file mode 100644 index 000000000..bfc890cd9 --- /dev/null +++ b/qemu/tests/qapi-schema/funny-char.err @@ -0,0 +1 @@ +tests/qapi-schema/funny-char.json:2:36: Stray ";" diff --git a/qemu/tests/qapi-schema/funny-char.exit b/qemu/tests/qapi-schema/funny-char.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/funny-char.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/funny-char.json b/qemu/tests/qapi-schema/funny-char.json new file mode 100644 index 000000000..d4973a2cd --- /dev/null +++ b/qemu/tests/qapi-schema/funny-char.json @@ -0,0 +1,2 @@ +{ 'enum': 'Status', + 'data': [ 'good', 'bad', 'ugly' ]; } diff --git a/qemu/tests/qapi-schema/funny-char.out b/qemu/tests/qapi-schema/funny-char.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/funny-char.out diff --git a/qemu/tests/qapi-schema/ident-with-escape.err b/qemu/tests/qapi-schema/ident-with-escape.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/ident-with-escape.err diff --git a/qemu/tests/qapi-schema/ident-with-escape.exit b/qemu/tests/qapi-schema/ident-with-escape.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/ident-with-escape.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/ident-with-escape.json b/qemu/tests/qapi-schema/ident-with-escape.json new file mode 100644 index 000000000..56617501e --- /dev/null +++ b/qemu/tests/qapi-schema/ident-with-escape.json @@ -0,0 +1,4 @@ +# we allow escape sequences in strings, if they map back to ASCII +# { 'command': 'fooA', 'data': { 'bar1': 'str' } } +{ 'c\u006fmmand': '\u0066\u006f\u006FA', + 'd\u0061ta': { '\u0062\u0061\u00721': '\u0073\u0074\u0072' } } diff --git a/qemu/tests/qapi-schema/ident-with-escape.out b/qemu/tests/qapi-schema/ident-with-escape.out new file mode 100644 index 000000000..402843081 --- /dev/null +++ b/qemu/tests/qapi-schema/ident-with-escape.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'fooA'), ('data', OrderedDict([('bar1', 'str')]))])] +[] +[] diff --git a/qemu/tests/qapi-schema/include-before-err.err b/qemu/tests/qapi-schema/include-before-err.err new file mode 100644 index 000000000..55652751e --- /dev/null +++ b/qemu/tests/qapi-schema/include-before-err.err @@ -0,0 +1 @@ +tests/qapi-schema/include-before-err.json:2:13: Expected ":" diff --git a/qemu/tests/qapi-schema/include-before-err.exit b/qemu/tests/qapi-schema/include-before-err.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/include-before-err.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/include-before-err.json b/qemu/tests/qapi-schema/include-before-err.json new file mode 100644 index 000000000..afb6cb63c --- /dev/null +++ b/qemu/tests/qapi-schema/include-before-err.json @@ -0,0 +1,2 @@ +{ 'include': 'include-simple-sub.json' } +{ 'command' 'missing-colon' } diff --git a/qemu/tests/qapi-schema/include-before-err.out b/qemu/tests/qapi-schema/include-before-err.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-before-err.out diff --git a/qemu/tests/qapi-schema/include-cycle-b.json b/qemu/tests/qapi-schema/include-cycle-b.json new file mode 100644 index 000000000..4fa985dcd --- /dev/null +++ b/qemu/tests/qapi-schema/include-cycle-b.json @@ -0,0 +1 @@ +{ 'include': 'include-cycle-c.json' } diff --git a/qemu/tests/qapi-schema/include-cycle-c.json b/qemu/tests/qapi-schema/include-cycle-c.json new file mode 100644 index 000000000..d12b5924a --- /dev/null +++ b/qemu/tests/qapi-schema/include-cycle-c.json @@ -0,0 +1 @@ +{ 'include': 'include-cycle.json' } diff --git a/qemu/tests/qapi-schema/include-cycle.err b/qemu/tests/qapi-schema/include-cycle.err new file mode 100644 index 000000000..bdcd07dce --- /dev/null +++ b/qemu/tests/qapi-schema/include-cycle.err @@ -0,0 +1,3 @@ +In file included from tests/qapi-schema/include-cycle.json:1: +In file included from tests/qapi-schema/include-cycle-b.json:1: +tests/qapi-schema/include-cycle-c.json:1: Inclusion loop for include-cycle.json diff --git a/qemu/tests/qapi-schema/include-cycle.exit b/qemu/tests/qapi-schema/include-cycle.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/include-cycle.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/include-cycle.json b/qemu/tests/qapi-schema/include-cycle.json new file mode 100644 index 000000000..6fcf1ebaa --- /dev/null +++ b/qemu/tests/qapi-schema/include-cycle.json @@ -0,0 +1 @@ +{ 'include': 'include-cycle-b.json' } diff --git a/qemu/tests/qapi-schema/include-cycle.out b/qemu/tests/qapi-schema/include-cycle.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-cycle.out diff --git a/qemu/tests/qapi-schema/include-format-err.err b/qemu/tests/qapi-schema/include-format-err.err new file mode 100644 index 000000000..721ff4ecc --- /dev/null +++ b/qemu/tests/qapi-schema/include-format-err.err @@ -0,0 +1 @@ +tests/qapi-schema/include-format-err.json:1: Invalid 'include' directive diff --git a/qemu/tests/qapi-schema/include-format-err.exit b/qemu/tests/qapi-schema/include-format-err.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/include-format-err.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/include-format-err.json b/qemu/tests/qapi-schema/include-format-err.json new file mode 100644 index 000000000..44980f026 --- /dev/null +++ b/qemu/tests/qapi-schema/include-format-err.json @@ -0,0 +1,2 @@ +{ 'include': 'include-simple-sub.json', + 'foo': 'bar' } diff --git a/qemu/tests/qapi-schema/include-format-err.out b/qemu/tests/qapi-schema/include-format-err.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-format-err.out diff --git a/qemu/tests/qapi-schema/include-nested-err.err b/qemu/tests/qapi-schema/include-nested-err.err new file mode 100644 index 000000000..1b7b22706 --- /dev/null +++ b/qemu/tests/qapi-schema/include-nested-err.err @@ -0,0 +1,2 @@ +In file included from tests/qapi-schema/include-nested-err.json:1: +tests/qapi-schema/missing-colon.json:1:10: Expected ":" diff --git a/qemu/tests/qapi-schema/include-nested-err.exit b/qemu/tests/qapi-schema/include-nested-err.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/include-nested-err.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/include-nested-err.json b/qemu/tests/qapi-schema/include-nested-err.json new file mode 100644 index 000000000..5631e56ea --- /dev/null +++ b/qemu/tests/qapi-schema/include-nested-err.json @@ -0,0 +1 @@ +{ 'include': 'missing-colon.json' } diff --git a/qemu/tests/qapi-schema/include-nested-err.out b/qemu/tests/qapi-schema/include-nested-err.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-nested-err.out diff --git a/qemu/tests/qapi-schema/include-no-file.err b/qemu/tests/qapi-schema/include-no-file.err new file mode 100644 index 000000000..d5b9b22d8 --- /dev/null +++ b/qemu/tests/qapi-schema/include-no-file.err @@ -0,0 +1 @@ +tests/qapi-schema/include-no-file.json:1: No such file or directory: include-no-file-sub.json diff --git a/qemu/tests/qapi-schema/include-no-file.exit b/qemu/tests/qapi-schema/include-no-file.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/include-no-file.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/include-no-file.json b/qemu/tests/qapi-schema/include-no-file.json new file mode 100644 index 000000000..9249ebd50 --- /dev/null +++ b/qemu/tests/qapi-schema/include-no-file.json @@ -0,0 +1 @@ +{ 'include': 'include-no-file-sub.json' } diff --git a/qemu/tests/qapi-schema/include-no-file.out b/qemu/tests/qapi-schema/include-no-file.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-no-file.out diff --git a/qemu/tests/qapi-schema/include-non-file.err b/qemu/tests/qapi-schema/include-non-file.err new file mode 100644 index 000000000..9658c7880 --- /dev/null +++ b/qemu/tests/qapi-schema/include-non-file.err @@ -0,0 +1 @@ +tests/qapi-schema/include-non-file.json:1: Expected a file name (string), got: ['foo', 'bar'] diff --git a/qemu/tests/qapi-schema/include-non-file.exit b/qemu/tests/qapi-schema/include-non-file.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/include-non-file.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/include-non-file.json b/qemu/tests/qapi-schema/include-non-file.json new file mode 100644 index 000000000..cd43c3f9d --- /dev/null +++ b/qemu/tests/qapi-schema/include-non-file.json @@ -0,0 +1 @@ +{ 'include': [ 'foo', 'bar' ] } diff --git a/qemu/tests/qapi-schema/include-non-file.out b/qemu/tests/qapi-schema/include-non-file.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-non-file.out diff --git a/qemu/tests/qapi-schema/include-relpath-sub.json b/qemu/tests/qapi-schema/include-relpath-sub.json new file mode 100644 index 000000000..4bd4af416 --- /dev/null +++ b/qemu/tests/qapi-schema/include-relpath-sub.json @@ -0,0 +1,2 @@ +{ 'enum': 'Status', + 'data': [ 'good', 'bad', 'ugly' ] } diff --git a/qemu/tests/qapi-schema/include-relpath.err b/qemu/tests/qapi-schema/include-relpath.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-relpath.err diff --git a/qemu/tests/qapi-schema/include-relpath.exit b/qemu/tests/qapi-schema/include-relpath.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/include-relpath.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/include-relpath.json b/qemu/tests/qapi-schema/include-relpath.json new file mode 100644 index 000000000..05018f390 --- /dev/null +++ b/qemu/tests/qapi-schema/include-relpath.json @@ -0,0 +1 @@ +{ 'include': 'include/relpath.json' } diff --git a/qemu/tests/qapi-schema/include-relpath.out b/qemu/tests/qapi-schema/include-relpath.out new file mode 100644 index 000000000..4ce3dcf12 --- /dev/null +++ b/qemu/tests/qapi-schema/include-relpath.out @@ -0,0 +1,3 @@ +[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])] +[{'enum_name': 'Status', 'enum_values': ['good', 'bad', 'ugly']}] +[] diff --git a/qemu/tests/qapi-schema/include-repetition-sub.json b/qemu/tests/qapi-schema/include-repetition-sub.json new file mode 100644 index 000000000..6bfffdfd5 --- /dev/null +++ b/qemu/tests/qapi-schema/include-repetition-sub.json @@ -0,0 +1,2 @@ +{ 'include': 'comments.json' } +{ 'include': 'comments.json' } diff --git a/qemu/tests/qapi-schema/include-repetition.err b/qemu/tests/qapi-schema/include-repetition.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-repetition.err diff --git a/qemu/tests/qapi-schema/include-repetition.exit b/qemu/tests/qapi-schema/include-repetition.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/include-repetition.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/include-repetition.json b/qemu/tests/qapi-schema/include-repetition.json new file mode 100644 index 000000000..ec329dde5 --- /dev/null +++ b/qemu/tests/qapi-schema/include-repetition.json @@ -0,0 +1,3 @@ +{ 'include': 'comments.json' } +{ 'include': 'include-repetition-sub.json' } +{ 'include': 'comments.json' } diff --git a/qemu/tests/qapi-schema/include-repetition.out b/qemu/tests/qapi-schema/include-repetition.out new file mode 100644 index 000000000..4ce3dcf12 --- /dev/null +++ b/qemu/tests/qapi-schema/include-repetition.out @@ -0,0 +1,3 @@ +[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])] +[{'enum_name': 'Status', 'enum_values': ['good', 'bad', 'ugly']}] +[] diff --git a/qemu/tests/qapi-schema/include-self-cycle.err b/qemu/tests/qapi-schema/include-self-cycle.err new file mode 100644 index 000000000..981742ae5 --- /dev/null +++ b/qemu/tests/qapi-schema/include-self-cycle.err @@ -0,0 +1 @@ +tests/qapi-schema/include-self-cycle.json:1: Inclusion loop for include-self-cycle.json diff --git a/qemu/tests/qapi-schema/include-self-cycle.exit b/qemu/tests/qapi-schema/include-self-cycle.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/include-self-cycle.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/include-self-cycle.json b/qemu/tests/qapi-schema/include-self-cycle.json new file mode 100644 index 000000000..55fb1b596 --- /dev/null +++ b/qemu/tests/qapi-schema/include-self-cycle.json @@ -0,0 +1 @@ +{ 'include': 'include-self-cycle.json' } diff --git a/qemu/tests/qapi-schema/include-self-cycle.out b/qemu/tests/qapi-schema/include-self-cycle.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-self-cycle.out diff --git a/qemu/tests/qapi-schema/include-simple-sub.json b/qemu/tests/qapi-schema/include-simple-sub.json new file mode 100644 index 000000000..4bd4af416 --- /dev/null +++ b/qemu/tests/qapi-schema/include-simple-sub.json @@ -0,0 +1,2 @@ +{ 'enum': 'Status', + 'data': [ 'good', 'bad', 'ugly' ] } diff --git a/qemu/tests/qapi-schema/include-simple.err b/qemu/tests/qapi-schema/include-simple.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/include-simple.err diff --git a/qemu/tests/qapi-schema/include-simple.exit b/qemu/tests/qapi-schema/include-simple.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/include-simple.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/include-simple.json b/qemu/tests/qapi-schema/include-simple.json new file mode 100644 index 000000000..1dd391a59 --- /dev/null +++ b/qemu/tests/qapi-schema/include-simple.json @@ -0,0 +1 @@ +{ 'include': 'include-simple-sub.json' } diff --git a/qemu/tests/qapi-schema/include-simple.out b/qemu/tests/qapi-schema/include-simple.out new file mode 100644 index 000000000..4ce3dcf12 --- /dev/null +++ b/qemu/tests/qapi-schema/include-simple.out @@ -0,0 +1,3 @@ +[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])] +[{'enum_name': 'Status', 'enum_values': ['good', 'bad', 'ugly']}] +[] diff --git a/qemu/tests/qapi-schema/include/relpath.json b/qemu/tests/qapi-schema/include/relpath.json new file mode 100644 index 000000000..45dee2470 --- /dev/null +++ b/qemu/tests/qapi-schema/include/relpath.json @@ -0,0 +1 @@ +{ 'include': '../include-relpath-sub.json' } diff --git a/qemu/tests/qapi-schema/indented-expr.err b/qemu/tests/qapi-schema/indented-expr.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/indented-expr.err diff --git a/qemu/tests/qapi-schema/indented-expr.exit b/qemu/tests/qapi-schema/indented-expr.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/indented-expr.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/indented-expr.json b/qemu/tests/qapi-schema/indented-expr.json new file mode 100644 index 000000000..7115d3131 --- /dev/null +++ b/qemu/tests/qapi-schema/indented-expr.json @@ -0,0 +1,2 @@ +{ 'command' : 'eins' } + { 'command' : 'zwei' } diff --git a/qemu/tests/qapi-schema/indented-expr.out b/qemu/tests/qapi-schema/indented-expr.out new file mode 100644 index 000000000..b5ce9151b --- /dev/null +++ b/qemu/tests/qapi-schema/indented-expr.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'eins')]), OrderedDict([('command', 'zwei')])] +[] +[] diff --git a/qemu/tests/qapi-schema/missing-colon.err b/qemu/tests/qapi-schema/missing-colon.err new file mode 100644 index 000000000..d9d66b377 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-colon.err @@ -0,0 +1 @@ +tests/qapi-schema/missing-colon.json:1:10: Expected ":" diff --git a/qemu/tests/qapi-schema/missing-colon.exit b/qemu/tests/qapi-schema/missing-colon.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-colon.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/missing-colon.json b/qemu/tests/qapi-schema/missing-colon.json new file mode 100644 index 000000000..6fc27ce40 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-colon.json @@ -0,0 +1,2 @@ +{ 'enum' 'Status', + 'data': [ 'good', 'bad', 'ugly' ] } diff --git a/qemu/tests/qapi-schema/missing-colon.out b/qemu/tests/qapi-schema/missing-colon.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/missing-colon.out diff --git a/qemu/tests/qapi-schema/missing-comma-list.err b/qemu/tests/qapi-schema/missing-comma-list.err new file mode 100644 index 000000000..e73d2770d --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-list.err @@ -0,0 +1 @@ +tests/qapi-schema/missing-comma-list.json:2:20: Expected "," or "]" diff --git a/qemu/tests/qapi-schema/missing-comma-list.exit b/qemu/tests/qapi-schema/missing-comma-list.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-list.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/missing-comma-list.json b/qemu/tests/qapi-schema/missing-comma-list.json new file mode 100644 index 000000000..1af39b293 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-list.json @@ -0,0 +1,2 @@ +{ 'enum': 'Status', + 'data': [ 'good' 'bad', 'ugly' ] } diff --git a/qemu/tests/qapi-schema/missing-comma-list.out b/qemu/tests/qapi-schema/missing-comma-list.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-list.out diff --git a/qemu/tests/qapi-schema/missing-comma-object.err b/qemu/tests/qapi-schema/missing-comma-object.err new file mode 100644 index 000000000..52b3a8a1e --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-object.err @@ -0,0 +1 @@ +tests/qapi-schema/missing-comma-object.json:2:3: Expected "," or "}" diff --git a/qemu/tests/qapi-schema/missing-comma-object.exit b/qemu/tests/qapi-schema/missing-comma-object.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-object.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/missing-comma-object.json b/qemu/tests/qapi-schema/missing-comma-object.json new file mode 100644 index 000000000..50f51786e --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-object.json @@ -0,0 +1,2 @@ +{ 'enum': 'Status' + 'data': [ 'good', 'bad', 'ugly' ] } diff --git a/qemu/tests/qapi-schema/missing-comma-object.out b/qemu/tests/qapi-schema/missing-comma-object.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/missing-comma-object.out diff --git a/qemu/tests/qapi-schema/missing-type.err b/qemu/tests/qapi-schema/missing-type.err new file mode 100644 index 000000000..b3e7b14e4 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-type.err @@ -0,0 +1 @@ +tests/qapi-schema/missing-type.json:2: Expression is missing metatype diff --git a/qemu/tests/qapi-schema/missing-type.exit b/qemu/tests/qapi-schema/missing-type.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/missing-type.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/missing-type.json b/qemu/tests/qapi-schema/missing-type.json new file mode 100644 index 000000000..ff5349d3f --- /dev/null +++ b/qemu/tests/qapi-schema/missing-type.json @@ -0,0 +1,2 @@ +# we reject an expression with missing metatype +{ 'data': { } } diff --git a/qemu/tests/qapi-schema/missing-type.out b/qemu/tests/qapi-schema/missing-type.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/missing-type.out diff --git a/qemu/tests/qapi-schema/nested-struct-data.err b/qemu/tests/qapi-schema/nested-struct-data.err new file mode 100644 index 000000000..da767bade --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-data.err @@ -0,0 +1 @@ +tests/qapi-schema/nested-struct-data.json:2: Member 'a' of 'data' for command 'foo' should be a type name diff --git a/qemu/tests/qapi-schema/nested-struct-data.exit b/qemu/tests/qapi-schema/nested-struct-data.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-data.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/nested-struct-data.json b/qemu/tests/qapi-schema/nested-struct-data.json new file mode 100644 index 000000000..3d52d2b39 --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-data.json @@ -0,0 +1,4 @@ +# inline subtypes collide with our desired future use of defaults +{ 'command': 'foo', + 'data': { 'a' : { 'string' : 'str', 'integer': 'int' }, 'b' : 'str' }, + 'returns': {} } diff --git a/qemu/tests/qapi-schema/nested-struct-data.out b/qemu/tests/qapi-schema/nested-struct-data.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-data.out diff --git a/qemu/tests/qapi-schema/nested-struct-returns.err b/qemu/tests/qapi-schema/nested-struct-returns.err new file mode 100644 index 000000000..5238d075b --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-returns.err @@ -0,0 +1 @@ +tests/qapi-schema/nested-struct-returns.json:2: Member 'a' of 'returns' for command 'foo' should be a type name diff --git a/qemu/tests/qapi-schema/nested-struct-returns.exit b/qemu/tests/qapi-schema/nested-struct-returns.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-returns.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/nested-struct-returns.json b/qemu/tests/qapi-schema/nested-struct-returns.json new file mode 100644 index 000000000..d2cd047f0 --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-returns.json @@ -0,0 +1,3 @@ +# inline subtypes collide with our desired future use of defaults +{ 'command': 'foo', + 'returns': { 'a' : { 'string' : 'str', 'integer': 'int' }, 'b' : 'str' } } diff --git a/qemu/tests/qapi-schema/nested-struct-returns.out b/qemu/tests/qapi-schema/nested-struct-returns.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/nested-struct-returns.out diff --git a/qemu/tests/qapi-schema/non-objects.err b/qemu/tests/qapi-schema/non-objects.err new file mode 100644 index 000000000..334f0c91a --- /dev/null +++ b/qemu/tests/qapi-schema/non-objects.err @@ -0,0 +1 @@ +tests/qapi-schema/non-objects.json:1:1: Expected "{" diff --git a/qemu/tests/qapi-schema/non-objects.exit b/qemu/tests/qapi-schema/non-objects.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/non-objects.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/non-objects.json b/qemu/tests/qapi-schema/non-objects.json new file mode 100644 index 000000000..f3fa851d4 --- /dev/null +++ b/qemu/tests/qapi-schema/non-objects.json @@ -0,0 +1,2 @@ +'string' +[ ] diff --git a/qemu/tests/qapi-schema/non-objects.out b/qemu/tests/qapi-schema/non-objects.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/non-objects.out diff --git a/qemu/tests/qapi-schema/qapi-schema-test.err b/qemu/tests/qapi-schema/qapi-schema-test.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/qapi-schema-test.err diff --git a/qemu/tests/qapi-schema/qapi-schema-test.exit b/qemu/tests/qapi-schema/qapi-schema-test.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/qapi-schema-test.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/qapi-schema-test.json b/qemu/tests/qapi-schema/qapi-schema-test.json new file mode 100644 index 000000000..c7eaa865d --- /dev/null +++ b/qemu/tests/qapi-schema/qapi-schema-test.json @@ -0,0 +1,129 @@ +# *-*- Mode: Python -*-* + +# for testing enums +{ 'enum': 'EnumOne', + 'data': [ 'value1', 'value2', 'value3' ] } +{ 'struct': 'NestedEnumsOne', + 'data': { 'enum1': 'EnumOne', '*enum2': 'EnumOne', 'enum3': 'EnumOne', '*enum4': 'EnumOne' } } + +# for testing nested structs +{ 'struct': 'UserDefZero', + 'data': { 'integer': 'int' } } + +{ 'struct': 'UserDefOne', + 'base': 'UserDefZero', + 'data': { 'string': 'str', '*enum1': 'EnumOne' } } + +{ 'struct': 'UserDefTwoDictDict', + 'data': { 'userdef': 'UserDefOne', 'string': 'str' } } + +{ 'struct': 'UserDefTwoDict', + 'data': { 'string1': 'str', + 'dict2': 'UserDefTwoDictDict', + '*dict3': 'UserDefTwoDictDict' } } + +{ 'struct': 'UserDefTwo', + 'data': { 'string0': 'str', + 'dict1': 'UserDefTwoDict' } } + +# for testing unions +{ 'struct': 'UserDefA', + 'data': { 'boolean': 'bool' } } + +{ 'struct': 'UserDefB', + 'data': { 'integer': 'int' } } + +{ 'struct': 'UserDefC', + 'data': { 'string1': 'str', 'string2': 'str' } } + +{ 'struct': 'UserDefUnionBase', + 'data': { 'string': 'str', 'enum1': 'EnumOne' } } + +{ 'union': 'UserDefFlatUnion', + 'base': 'UserDefUnionBase', + 'discriminator': 'enum1', + 'data': { 'value1' : 'UserDefA', 'value2' : 'UserDefB', 'value3' : 'UserDefB' } } +# FIXME generated struct UserDefFlatUnion has members for direct base +# UserDefOne, but lacks members for indirect base UserDefZero + +# this variant of UserDefFlatUnion defaults to a union that uses fields with +# allocated types to test corner cases in the cleanup/dealloc visitor +{ 'union': 'UserDefFlatUnion2', + 'base': 'UserDefUnionBase', + 'discriminator': 'enum1', + 'data': { 'value1' : 'UserDefC', 'value2' : 'UserDefB', 'value3' : 'UserDefA' } } + +{ 'alternate': 'UserDefAlternate', + 'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } } + +# 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'] } } + +# 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' } +{ 'command': 'user_def_cmd3', 'data': {'a': 'int', '*b': 'int' }, + 'returns': 'int' } + +# 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' } } + +# test that we correctly compile downstream extensions +{ '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' } } +{ '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' } diff --git a/qemu/tests/qapi-schema/qapi-schema-test.out b/qemu/tests/qapi-schema/qapi-schema-test.out new file mode 100644 index 000000000..cf0ccc402 --- /dev/null +++ b/qemu/tests/qapi-schema/qapi-schema-test.out @@ -0,0 +1,55 @@ +[OrderedDict([('enum', 'EnumOne'), ('data', ['value1', 'value2', 'value3'])]), + OrderedDict([('struct', 'NestedEnumsOne'), ('data', OrderedDict([('enum1', 'EnumOne'), ('*enum2', 'EnumOne'), ('enum3', 'EnumOne'), ('*enum4', 'EnumOne')]))]), + OrderedDict([('struct', 'UserDefZero'), ('data', OrderedDict([('integer', 'int')]))]), + OrderedDict([('struct', 'UserDefOne'), ('base', 'UserDefZero'), ('data', OrderedDict([('string', 'str'), ('*enum1', 'EnumOne')]))]), + OrderedDict([('struct', 'UserDefTwoDictDict'), ('data', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')]))]), + OrderedDict([('struct', 'UserDefTwoDict'), ('data', OrderedDict([('string1', 'str'), ('dict2', 'UserDefTwoDictDict'), ('*dict3', 'UserDefTwoDictDict')]))]), + OrderedDict([('struct', 'UserDefTwo'), ('data', OrderedDict([('string0', 'str'), ('dict1', 'UserDefTwoDict')]))]), + OrderedDict([('struct', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]), + OrderedDict([('struct', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]), + OrderedDict([('struct', 'UserDefC'), ('data', OrderedDict([('string1', 'str'), ('string2', 'str')]))]), + OrderedDict([('struct', 'UserDefUnionBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]), + OrderedDict([('union', 'UserDefFlatUnion'), ('base', 'UserDefUnionBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'UserDefA'), ('value2', 'UserDefB'), ('value3', 'UserDefB')]))]), + OrderedDict([('union', 'UserDefFlatUnion2'), ('base', 'UserDefUnionBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'UserDefC'), ('value2', 'UserDefB'), ('value3', 'UserDefA')]))]), + OrderedDict([('alternate', 'UserDefAlternate'), ('data', OrderedDict([('uda', 'UserDefA'), ('s', 'str'), ('i', 'int')]))]), + OrderedDict([('union', 'UserDefNativeListUnion'), ('data', OrderedDict([('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'])]))]), + OrderedDict([('command', 'user_def_cmd'), ('data', OrderedDict())]), + OrderedDict([('command', 'user_def_cmd1'), ('data', OrderedDict([('ud1a', 'UserDefOne')]))]), + OrderedDict([('command', 'user_def_cmd2'), ('data', OrderedDict([('ud1a', 'UserDefOne'), ('*ud1b', 'UserDefOne')])), ('returns', 'UserDefTwo')]), + OrderedDict([('command', 'user_def_cmd3'), ('data', OrderedDict([('a', 'int'), ('*b', 'int')])), ('returns', 'int')]), + OrderedDict([('struct', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))]), + OrderedDict([('struct', 'EventStructOne'), ('data', OrderedDict([('struct1', 'UserDefOne'), ('string', 'str'), ('*enum2', 'EnumOne')]))]), + OrderedDict([('event', 'EVENT_A')]), + OrderedDict([('event', 'EVENT_B'), ('data', OrderedDict())]), + OrderedDict([('event', 'EVENT_C'), ('data', OrderedDict([('*a', 'int'), ('*b', 'UserDefOne'), ('c', 'str')]))]), + OrderedDict([('event', 'EVENT_D'), ('data', OrderedDict([('a', 'EventStructOne'), ('b', 'str'), ('*c', 'str'), ('*enum3', 'EnumOne')]))]), + OrderedDict([('enum', '__org.qemu_x-Enum'), ('data', ['__org.qemu_x-value'])]), + OrderedDict([('struct', '__org.qemu_x-Base'), ('data', OrderedDict([('__org.qemu_x-member1', '__org.qemu_x-Enum')]))]), + OrderedDict([('struct', '__org.qemu_x-Struct'), ('base', '__org.qemu_x-Base'), ('data', OrderedDict([('__org.qemu_x-member2', 'str')]))]), + OrderedDict([('union', '__org.qemu_x-Union1'), ('data', OrderedDict([('__org.qemu_x-branch', 'str')]))]), + OrderedDict([('struct', '__org.qemu_x-Struct2'), ('data', OrderedDict([('array', ['__org.qemu_x-Union1'])]))]), + OrderedDict([('union', '__org.qemu_x-Union2'), ('base', '__org.qemu_x-Base'), ('discriminator', '__org.qemu_x-member1'), ('data', OrderedDict([('__org.qemu_x-value', '__org.qemu_x-Struct2')]))]), + OrderedDict([('alternate', '__org.qemu_x-Alt'), ('data', OrderedDict([('__org.qemu_x-branch', 'str'), ('b', '__org.qemu_x-Base')]))]), + OrderedDict([('event', '__ORG.QEMU_X-EVENT'), ('data', '__org.qemu_x-Struct')]), + OrderedDict([('command', '__org.qemu_x-command'), ('data', OrderedDict([('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')])] +[{'enum_name': 'EnumOne', 'enum_values': ['value1', 'value2', 'value3']}, + {'enum_name': '__org.qemu_x-Enum', 'enum_values': ['__org.qemu_x-value']}, + {'enum_name': 'UserDefAlternateKind', 'enum_values': None}, + {'enum_name': 'UserDefNativeListUnionKind', 'enum_values': None}, + {'enum_name': '__org.qemu_x-Union1Kind', 'enum_values': None}, + {'enum_name': '__org.qemu_x-AltKind', 'enum_values': None}] +[OrderedDict([('struct', 'NestedEnumsOne'), ('data', OrderedDict([('enum1', 'EnumOne'), ('*enum2', 'EnumOne'), ('enum3', 'EnumOne'), ('*enum4', 'EnumOne')]))]), + OrderedDict([('struct', 'UserDefZero'), ('data', OrderedDict([('integer', 'int')]))]), + OrderedDict([('struct', 'UserDefOne'), ('base', 'UserDefZero'), ('data', OrderedDict([('string', 'str'), ('*enum1', 'EnumOne')]))]), + OrderedDict([('struct', 'UserDefTwoDictDict'), ('data', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')]))]), + OrderedDict([('struct', 'UserDefTwoDict'), ('data', OrderedDict([('string1', 'str'), ('dict2', 'UserDefTwoDictDict'), ('*dict3', 'UserDefTwoDictDict')]))]), + OrderedDict([('struct', 'UserDefTwo'), ('data', OrderedDict([('string0', 'str'), ('dict1', 'UserDefTwoDict')]))]), + OrderedDict([('struct', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]), + OrderedDict([('struct', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]), + OrderedDict([('struct', 'UserDefC'), ('data', OrderedDict([('string1', 'str'), ('string2', 'str')]))]), + OrderedDict([('struct', 'UserDefUnionBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]), + OrderedDict([('struct', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))]), + OrderedDict([('struct', 'EventStructOne'), ('data', OrderedDict([('struct1', 'UserDefOne'), ('string', 'str'), ('*enum2', 'EnumOne')]))]), + OrderedDict([('struct', '__org.qemu_x-Base'), ('data', OrderedDict([('__org.qemu_x-member1', '__org.qemu_x-Enum')]))]), + OrderedDict([('struct', '__org.qemu_x-Struct'), ('base', '__org.qemu_x-Base'), ('data', OrderedDict([('__org.qemu_x-member2', 'str')]))]), + OrderedDict([('struct', '__org.qemu_x-Struct2'), ('data', OrderedDict([('array', ['__org.qemu_x-Union1'])]))])] diff --git a/qemu/tests/qapi-schema/quoted-structural-chars.err b/qemu/tests/qapi-schema/quoted-structural-chars.err new file mode 100644 index 000000000..9b183841d --- /dev/null +++ b/qemu/tests/qapi-schema/quoted-structural-chars.err @@ -0,0 +1 @@ +tests/qapi-schema/quoted-structural-chars.json:1:1: Expected "{" diff --git a/qemu/tests/qapi-schema/quoted-structural-chars.exit b/qemu/tests/qapi-schema/quoted-structural-chars.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/quoted-structural-chars.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/quoted-structural-chars.json b/qemu/tests/qapi-schema/quoted-structural-chars.json new file mode 100644 index 000000000..9fe657ae9 --- /dev/null +++ b/qemu/tests/qapi-schema/quoted-structural-chars.json @@ -0,0 +1 @@ +'{' 'key1' ':' 'value1' ',' 'key2' ':' '[' ']' '}' diff --git a/qemu/tests/qapi-schema/quoted-structural-chars.out b/qemu/tests/qapi-schema/quoted-structural-chars.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/quoted-structural-chars.out diff --git a/qemu/tests/qapi-schema/redefined-builtin.err b/qemu/tests/qapi-schema/redefined-builtin.err new file mode 100644 index 000000000..b2757225c --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-builtin.err @@ -0,0 +1 @@ +tests/qapi-schema/redefined-builtin.json:2: built-in 'size' is already defined diff --git a/qemu/tests/qapi-schema/redefined-builtin.exit b/qemu/tests/qapi-schema/redefined-builtin.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-builtin.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/redefined-builtin.json b/qemu/tests/qapi-schema/redefined-builtin.json new file mode 100644 index 000000000..45b8a550a --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-builtin.json @@ -0,0 +1,2 @@ +# we reject types that duplicate builtin names +{ 'struct': 'size', 'data': { 'myint': 'size' } } diff --git a/qemu/tests/qapi-schema/redefined-builtin.out b/qemu/tests/qapi-schema/redefined-builtin.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-builtin.out diff --git a/qemu/tests/qapi-schema/redefined-command.err b/qemu/tests/qapi-schema/redefined-command.err new file mode 100644 index 000000000..82ae256e6 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-command.err @@ -0,0 +1 @@ +tests/qapi-schema/redefined-command.json:3: command 'foo' is already defined diff --git a/qemu/tests/qapi-schema/redefined-command.exit b/qemu/tests/qapi-schema/redefined-command.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-command.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/redefined-command.json b/qemu/tests/qapi-schema/redefined-command.json new file mode 100644 index 000000000..247e40194 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-command.json @@ -0,0 +1,3 @@ +# we reject commands defined more than once +{ 'command': 'foo', 'data': { 'one': 'str' } } +{ 'command': 'foo', 'data': { '*two': 'str' } } diff --git a/qemu/tests/qapi-schema/redefined-command.out b/qemu/tests/qapi-schema/redefined-command.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-command.out diff --git a/qemu/tests/qapi-schema/redefined-event.err b/qemu/tests/qapi-schema/redefined-event.err new file mode 100644 index 000000000..35429cb48 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-event.err @@ -0,0 +1 @@ +tests/qapi-schema/redefined-event.json:3: event 'EVENT_A' is already defined diff --git a/qemu/tests/qapi-schema/redefined-event.exit b/qemu/tests/qapi-schema/redefined-event.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-event.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/redefined-event.json b/qemu/tests/qapi-schema/redefined-event.json new file mode 100644 index 000000000..7717e91c1 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-event.json @@ -0,0 +1,3 @@ +# we reject duplicate events +{ 'event': 'EVENT_A', 'data': { 'myint': 'int' } } +{ 'event': 'EVENT_A', 'data': { 'myint': 'int' } } diff --git a/qemu/tests/qapi-schema/redefined-event.out b/qemu/tests/qapi-schema/redefined-event.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-event.out diff --git a/qemu/tests/qapi-schema/redefined-type.err b/qemu/tests/qapi-schema/redefined-type.err new file mode 100644 index 000000000..06ea78c47 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-type.err @@ -0,0 +1 @@ +tests/qapi-schema/redefined-type.json:3: struct 'foo' is already defined diff --git a/qemu/tests/qapi-schema/redefined-type.exit b/qemu/tests/qapi-schema/redefined-type.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-type.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/redefined-type.json b/qemu/tests/qapi-schema/redefined-type.json new file mode 100644 index 000000000..a09e768ba --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-type.json @@ -0,0 +1,3 @@ +# we reject types defined more than once +{ 'struct': 'foo', 'data': { 'one': 'str' } } +{ 'enum': 'foo', 'data': [ 'two' ] } diff --git a/qemu/tests/qapi-schema/redefined-type.out b/qemu/tests/qapi-schema/redefined-type.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/redefined-type.out diff --git a/qemu/tests/qapi-schema/returns-alternate.err b/qemu/tests/qapi-schema/returns-alternate.err new file mode 100644 index 000000000..dfbb419ca --- /dev/null +++ b/qemu/tests/qapi-schema/returns-alternate.err @@ -0,0 +1 @@ +tests/qapi-schema/returns-alternate.json:3: 'returns' for command 'oops' cannot use alternate type 'Alt' diff --git a/qemu/tests/qapi-schema/returns-alternate.exit b/qemu/tests/qapi-schema/returns-alternate.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-alternate.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/returns-alternate.json b/qemu/tests/qapi-schema/returns-alternate.json new file mode 100644 index 000000000..972390c06 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-alternate.json @@ -0,0 +1,3 @@ +# we reject returns if it is an alternate type +{ 'alternate': 'Alt', 'data': { 'a': 'int', 'b': 'str' } } +{ 'command': 'oops', 'returns': 'Alt' } diff --git a/qemu/tests/qapi-schema/returns-alternate.out b/qemu/tests/qapi-schema/returns-alternate.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/returns-alternate.out diff --git a/qemu/tests/qapi-schema/returns-array-bad.err b/qemu/tests/qapi-schema/returns-array-bad.err new file mode 100644 index 000000000..138095ccd --- /dev/null +++ b/qemu/tests/qapi-schema/returns-array-bad.err @@ -0,0 +1 @@ +tests/qapi-schema/returns-array-bad.json:2: 'returns' for command 'oops': array type must contain single type name diff --git a/qemu/tests/qapi-schema/returns-array-bad.exit b/qemu/tests/qapi-schema/returns-array-bad.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-array-bad.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/returns-array-bad.json b/qemu/tests/qapi-schema/returns-array-bad.json new file mode 100644 index 000000000..09b0b1f18 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-array-bad.json @@ -0,0 +1,2 @@ +# we reject an array return that is not a single type +{ 'command': 'oops', 'returns': [ 'str', 'str' ] } diff --git a/qemu/tests/qapi-schema/returns-array-bad.out b/qemu/tests/qapi-schema/returns-array-bad.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/returns-array-bad.out diff --git a/qemu/tests/qapi-schema/returns-int.err b/qemu/tests/qapi-schema/returns-int.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/returns-int.err diff --git a/qemu/tests/qapi-schema/returns-int.exit b/qemu/tests/qapi-schema/returns-int.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-int.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/returns-int.json b/qemu/tests/qapi-schema/returns-int.json new file mode 100644 index 000000000..870ec6366 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-int.json @@ -0,0 +1,3 @@ +# It is okay (although not extensible) to return a non-dictionary +# But to make it work, the name must be in a whitelist +{ 'command': 'guest-get-time', 'returns': 'int' } diff --git a/qemu/tests/qapi-schema/returns-int.out b/qemu/tests/qapi-schema/returns-int.out new file mode 100644 index 000000000..70b3ac5e6 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-int.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'guest-get-time'), ('returns', 'int')])] +[] +[] diff --git a/qemu/tests/qapi-schema/returns-unknown.err b/qemu/tests/qapi-schema/returns-unknown.err new file mode 100644 index 000000000..1f43e3ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-unknown.err @@ -0,0 +1 @@ +tests/qapi-schema/returns-unknown.json:2: 'returns' for command 'oops' uses unknown type 'NoSuchType' diff --git a/qemu/tests/qapi-schema/returns-unknown.exit b/qemu/tests/qapi-schema/returns-unknown.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/returns-unknown.json b/qemu/tests/qapi-schema/returns-unknown.json new file mode 100644 index 000000000..25bd498bf --- /dev/null +++ b/qemu/tests/qapi-schema/returns-unknown.json @@ -0,0 +1,2 @@ +# we reject returns if it does not contain a known type +{ 'command': 'oops', 'returns': 'NoSuchType' } diff --git a/qemu/tests/qapi-schema/returns-unknown.out b/qemu/tests/qapi-schema/returns-unknown.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/returns-unknown.out diff --git a/qemu/tests/qapi-schema/returns-whitelist.err b/qemu/tests/qapi-schema/returns-whitelist.err new file mode 100644 index 000000000..a41f019a5 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-whitelist.err @@ -0,0 +1 @@ +tests/qapi-schema/returns-whitelist.json:10: 'returns' for command 'no-way-this-will-get-whitelisted' cannot use built-in type 'array of int' diff --git a/qemu/tests/qapi-schema/returns-whitelist.exit b/qemu/tests/qapi-schema/returns-whitelist.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-whitelist.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/returns-whitelist.json b/qemu/tests/qapi-schema/returns-whitelist.json new file mode 100644 index 000000000..e8b3cea39 --- /dev/null +++ b/qemu/tests/qapi-schema/returns-whitelist.json @@ -0,0 +1,11 @@ +# we enforce that 'returns' be a dict or array of dict unless whitelisted +{ 'command': 'human-monitor-command', + 'data': {'command-line': 'str', '*cpu-index': 'int'}, + 'returns': 'str' } +{ 'enum': 'TpmModel', 'data': [ 'tpm-tis' ] } +{ 'command': 'query-tpm-models', 'returns': ['TpmModel'] } +{ 'command': 'guest-get-time', + 'returns': 'int' } + +{ 'command': 'no-way-this-will-get-whitelisted', + 'returns': [ 'int' ] } diff --git a/qemu/tests/qapi-schema/returns-whitelist.out b/qemu/tests/qapi-schema/returns-whitelist.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/returns-whitelist.out diff --git a/qemu/tests/qapi-schema/struct-base-clash-deep.err b/qemu/tests/qapi-schema/struct-base-clash-deep.err new file mode 100644 index 000000000..e3e9f8d28 --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash-deep.err @@ -0,0 +1 @@ +tests/qapi-schema/struct-base-clash-deep.json:7: Member name 'name' clashes with base 'Base' diff --git a/qemu/tests/qapi-schema/struct-base-clash-deep.exit b/qemu/tests/qapi-schema/struct-base-clash-deep.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash-deep.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/struct-base-clash-deep.json b/qemu/tests/qapi-schema/struct-base-clash-deep.json new file mode 100644 index 000000000..552fe9431 --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash-deep.json @@ -0,0 +1,9 @@ +# we check for no duplicate keys with indirect base +{ 'struct': 'Base', + 'data': { 'name': 'str' } } +{ 'struct': 'Mid', + 'base': 'Base', + 'data': { 'value': 'int' } } +{ 'struct': 'Sub', + 'base': 'Mid', + 'data': { '*name': 'str' } } diff --git a/qemu/tests/qapi-schema/struct-base-clash-deep.out b/qemu/tests/qapi-schema/struct-base-clash-deep.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash-deep.out diff --git a/qemu/tests/qapi-schema/struct-base-clash.err b/qemu/tests/qapi-schema/struct-base-clash.err new file mode 100644 index 000000000..3ac37fb26 --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash.err @@ -0,0 +1 @@ +tests/qapi-schema/struct-base-clash.json:4: Member name 'name' clashes with base 'Base' diff --git a/qemu/tests/qapi-schema/struct-base-clash.exit b/qemu/tests/qapi-schema/struct-base-clash.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/struct-base-clash.json b/qemu/tests/qapi-schema/struct-base-clash.json new file mode 100644 index 000000000..f2afc9b6f --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash.json @@ -0,0 +1,6 @@ +# we check for no duplicate keys with base +{ 'struct': 'Base', + 'data': { 'name': 'str' } } +{ 'struct': 'Sub', + 'base': 'Base', + 'data': { 'name': 'str' } } diff --git a/qemu/tests/qapi-schema/struct-base-clash.out b/qemu/tests/qapi-schema/struct-base-clash.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/struct-base-clash.out diff --git a/qemu/tests/qapi-schema/test-qapi.py b/qemu/tests/qapi-schema/test-qapi.py new file mode 100644 index 000000000..634ef2d00 --- /dev/null +++ b/qemu/tests/qapi-schema/test-qapi.py @@ -0,0 +1,25 @@ +# +# QAPI parser test harness +# +# Copyright (c) 2013 Red Hat Inc. +# +# Authors: +# Markus Armbruster <armbru@redhat.com> +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. +# + +from qapi import * +from pprint import pprint +import os +import sys + +try: + exprs = parse_schema(sys.argv[1]) +except SystemExit: + raise + +pprint(exprs) +pprint(enum_types) +pprint(struct_types) diff --git a/qemu/tests/qapi-schema/trailing-comma-list.err b/qemu/tests/qapi-schema/trailing-comma-list.err new file mode 100644 index 000000000..24c24b010 --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-list.err @@ -0,0 +1 @@ +tests/qapi-schema/trailing-comma-list.json:2:36: Expected "{", "[" or string diff --git a/qemu/tests/qapi-schema/trailing-comma-list.exit b/qemu/tests/qapi-schema/trailing-comma-list.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-list.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/trailing-comma-list.json b/qemu/tests/qapi-schema/trailing-comma-list.json new file mode 100644 index 000000000..9b0c8bd70 --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-list.json @@ -0,0 +1,2 @@ +{ 'enum': 'Status', + 'data': [ 'good', 'bad', 'ugly', ] } diff --git a/qemu/tests/qapi-schema/trailing-comma-list.out b/qemu/tests/qapi-schema/trailing-comma-list.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-list.out diff --git a/qemu/tests/qapi-schema/trailing-comma-object.err b/qemu/tests/qapi-schema/trailing-comma-object.err new file mode 100644 index 000000000..30bce5e19 --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-object.err @@ -0,0 +1 @@ +tests/qapi-schema/trailing-comma-object.json:2:38: Expected string diff --git a/qemu/tests/qapi-schema/trailing-comma-object.exit b/qemu/tests/qapi-schema/trailing-comma-object.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-object.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/trailing-comma-object.json b/qemu/tests/qapi-schema/trailing-comma-object.json new file mode 100644 index 000000000..bbaea550c --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-object.json @@ -0,0 +1,2 @@ +{ 'enum': 'Status', + 'data': [ 'good', 'bad', 'ugly' ], } diff --git a/qemu/tests/qapi-schema/trailing-comma-object.out b/qemu/tests/qapi-schema/trailing-comma-object.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/trailing-comma-object.out diff --git a/qemu/tests/qapi-schema/type-bypass-bad-gen.err b/qemu/tests/qapi-schema/type-bypass-bad-gen.err new file mode 100644 index 000000000..a83c3c655 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-bad-gen.err @@ -0,0 +1 @@ +tests/qapi-schema/type-bypass-bad-gen.json:2: 'gen' of command 'foo' should only use false value diff --git a/qemu/tests/qapi-schema/type-bypass-bad-gen.exit b/qemu/tests/qapi-schema/type-bypass-bad-gen.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-bad-gen.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/type-bypass-bad-gen.json b/qemu/tests/qapi-schema/type-bypass-bad-gen.json new file mode 100644 index 000000000..e8dec3424 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-bad-gen.json @@ -0,0 +1,2 @@ +# 'gen' should only appear with value false +{ 'command': 'foo', 'gen': 'whatever' } diff --git a/qemu/tests/qapi-schema/type-bypass-bad-gen.out b/qemu/tests/qapi-schema/type-bypass-bad-gen.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-bad-gen.out diff --git a/qemu/tests/qapi-schema/type-bypass-no-gen.err b/qemu/tests/qapi-schema/type-bypass-no-gen.err new file mode 100644 index 000000000..20cef0a8a --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-no-gen.err @@ -0,0 +1 @@ +tests/qapi-schema/type-bypass-no-gen.json:2: Member 'arg' of 'data' for command 'unsafe' uses '**' but did not request 'gen':false diff --git a/qemu/tests/qapi-schema/type-bypass-no-gen.exit b/qemu/tests/qapi-schema/type-bypass-no-gen.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-no-gen.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/type-bypass-no-gen.json b/qemu/tests/qapi-schema/type-bypass-no-gen.json new file mode 100644 index 000000000..4feae3719 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-no-gen.json @@ -0,0 +1,2 @@ +# type bypass only works with 'gen':false +{ 'command': 'unsafe', 'data': { 'arg': '**' }, 'returns': '**' } diff --git a/qemu/tests/qapi-schema/type-bypass-no-gen.out b/qemu/tests/qapi-schema/type-bypass-no-gen.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass-no-gen.out diff --git a/qemu/tests/qapi-schema/type-bypass.err b/qemu/tests/qapi-schema/type-bypass.err new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass.err diff --git a/qemu/tests/qapi-schema/type-bypass.exit b/qemu/tests/qapi-schema/type-bypass.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass.exit @@ -0,0 +1 @@ +0 diff --git a/qemu/tests/qapi-schema/type-bypass.json b/qemu/tests/qapi-schema/type-bypass.json new file mode 100644 index 000000000..48b213783 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass.json @@ -0,0 +1,2 @@ +# Use of 'gen':false allows bypassing type system +{ 'command': 'unsafe', 'data': { 'arg': '**' }, 'returns': '**', 'gen': false } diff --git a/qemu/tests/qapi-schema/type-bypass.out b/qemu/tests/qapi-schema/type-bypass.out new file mode 100644 index 000000000..eaf20f834 --- /dev/null +++ b/qemu/tests/qapi-schema/type-bypass.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'unsafe'), ('data', OrderedDict([('arg', '**')])), ('returns', '**'), ('gen', False)])] +[] +[] diff --git a/qemu/tests/qapi-schema/unclosed-list.err b/qemu/tests/qapi-schema/unclosed-list.err new file mode 100644 index 000000000..fb41a86ab --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-list.err @@ -0,0 +1 @@ +tests/qapi-schema/unclosed-list.json:1:20: Expected "," or "]" diff --git a/qemu/tests/qapi-schema/unclosed-list.exit b/qemu/tests/qapi-schema/unclosed-list.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-list.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/unclosed-list.json b/qemu/tests/qapi-schema/unclosed-list.json new file mode 100644 index 000000000..e3e956698 --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-list.json @@ -0,0 +1 @@ +{ 'key': [ 'value' } diff --git a/qemu/tests/qapi-schema/unclosed-list.out b/qemu/tests/qapi-schema/unclosed-list.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-list.out diff --git a/qemu/tests/qapi-schema/unclosed-object.err b/qemu/tests/qapi-schema/unclosed-object.err new file mode 100644 index 000000000..db3deedd6 --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-object.err @@ -0,0 +1 @@ +tests/qapi-schema/unclosed-object.json:1:21: Expected "," or "}" diff --git a/qemu/tests/qapi-schema/unclosed-object.exit b/qemu/tests/qapi-schema/unclosed-object.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-object.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/unclosed-object.json b/qemu/tests/qapi-schema/unclosed-object.json new file mode 100644 index 000000000..8ac069dce --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-object.json @@ -0,0 +1 @@ +{ 'key': [ 'value' ] diff --git a/qemu/tests/qapi-schema/unclosed-object.out b/qemu/tests/qapi-schema/unclosed-object.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-object.out diff --git a/qemu/tests/qapi-schema/unclosed-string.err b/qemu/tests/qapi-schema/unclosed-string.err new file mode 100644 index 000000000..12b187074 --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-string.err @@ -0,0 +1 @@ +tests/qapi-schema/unclosed-string.json:1:11: Missing terminating "'" diff --git a/qemu/tests/qapi-schema/unclosed-string.exit b/qemu/tests/qapi-schema/unclosed-string.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-string.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/unclosed-string.json b/qemu/tests/qapi-schema/unclosed-string.json new file mode 100644 index 000000000..8c16b6b6f --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-string.json @@ -0,0 +1,2 @@ +{ 'text': 'lorem ips +} diff --git a/qemu/tests/qapi-schema/unclosed-string.out b/qemu/tests/qapi-schema/unclosed-string.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/unclosed-string.out diff --git a/qemu/tests/qapi-schema/unicode-str.err b/qemu/tests/qapi-schema/unicode-str.err new file mode 100644 index 000000000..f621cd644 --- /dev/null +++ b/qemu/tests/qapi-schema/unicode-str.err @@ -0,0 +1 @@ +tests/qapi-schema/unicode-str.json:2: 'command' uses invalid name 'é' diff --git a/qemu/tests/qapi-schema/unicode-str.exit b/qemu/tests/qapi-schema/unicode-str.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/unicode-str.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/unicode-str.json b/qemu/tests/qapi-schema/unicode-str.json new file mode 100644 index 000000000..5253a1b9f --- /dev/null +++ b/qemu/tests/qapi-schema/unicode-str.json @@ -0,0 +1,2 @@ +# we don't support full Unicode strings, yet +{ 'command': 'é' } diff --git a/qemu/tests/qapi-schema/unicode-str.out b/qemu/tests/qapi-schema/unicode-str.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/unicode-str.out diff --git a/qemu/tests/qapi-schema/union-bad-branch.err b/qemu/tests/qapi-schema/union-bad-branch.err new file mode 100644 index 000000000..882273556 --- /dev/null +++ b/qemu/tests/qapi-schema/union-bad-branch.err @@ -0,0 +1 @@ +tests/qapi-schema/union-bad-branch.json:6: Union 'MyUnion' member 'ONE' clashes with 'one' diff --git a/qemu/tests/qapi-schema/union-bad-branch.exit b/qemu/tests/qapi-schema/union-bad-branch.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/union-bad-branch.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/union-bad-branch.json b/qemu/tests/qapi-schema/union-bad-branch.json new file mode 100644 index 000000000..913aa38bc --- /dev/null +++ b/qemu/tests/qapi-schema/union-bad-branch.json @@ -0,0 +1,8 @@ +# we reject normal unions where branches would collide in C +{ 'struct': 'One', + 'data': { 'string': 'str' } } +{ 'struct': 'Two', + 'data': { 'number': 'int' } } +{ 'union': 'MyUnion', + 'data': { 'one': 'One', + 'ONE': 'Two' } } diff --git a/qemu/tests/qapi-schema/union-bad-branch.out b/qemu/tests/qapi-schema/union-bad-branch.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/union-bad-branch.out diff --git a/qemu/tests/qapi-schema/union-base-no-discriminator.err b/qemu/tests/qapi-schema/union-base-no-discriminator.err new file mode 100644 index 000000000..fc8b79c45 --- /dev/null +++ b/qemu/tests/qapi-schema/union-base-no-discriminator.err @@ -0,0 +1 @@ +tests/qapi-schema/union-base-no-discriminator.json:11: Union 'TestUnion' requires a discriminator to go along with base diff --git a/qemu/tests/qapi-schema/union-base-no-discriminator.exit b/qemu/tests/qapi-schema/union-base-no-discriminator.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/union-base-no-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/union-base-no-discriminator.json b/qemu/tests/qapi-schema/union-base-no-discriminator.json new file mode 100644 index 000000000..1409cf5c9 --- /dev/null +++ b/qemu/tests/qapi-schema/union-base-no-discriminator.json @@ -0,0 +1,14 @@ +# we reject simple unions with a base (or flat unions without discriminator) +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } + +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } + +{ 'struct': 'Base', + 'data': { 'string': 'str' } } + +{ 'union': 'TestUnion', + 'base': 'Base', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/union-base-no-discriminator.out b/qemu/tests/qapi-schema/union-base-no-discriminator.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/union-base-no-discriminator.out diff --git a/qemu/tests/qapi-schema/union-invalid-base.err b/qemu/tests/qapi-schema/union-invalid-base.err new file mode 100644 index 000000000..9f637963e --- /dev/null +++ b/qemu/tests/qapi-schema/union-invalid-base.err @@ -0,0 +1 @@ +tests/qapi-schema/union-invalid-base.json:8: Base 'int' is not a valid struct diff --git a/qemu/tests/qapi-schema/union-invalid-base.exit b/qemu/tests/qapi-schema/union-invalid-base.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/union-invalid-base.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/union-invalid-base.json b/qemu/tests/qapi-schema/union-invalid-base.json new file mode 100644 index 000000000..92be39df6 --- /dev/null +++ b/qemu/tests/qapi-schema/union-invalid-base.json @@ -0,0 +1,12 @@ +# a union base type must be a struct +{ 'struct': 'TestTypeA', + 'data': { 'string': 'str' } } + +{ 'struct': 'TestTypeB', + 'data': { 'integer': 'int' } } + +{ 'union': 'TestUnion', + 'base': 'int', + 'discriminator': 'int', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } diff --git a/qemu/tests/qapi-schema/union-invalid-base.out b/qemu/tests/qapi-schema/union-invalid-base.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/union-invalid-base.out diff --git a/qemu/tests/qapi-schema/union-max.err b/qemu/tests/qapi-schema/union-max.err new file mode 100644 index 000000000..55ce4399d --- /dev/null +++ b/qemu/tests/qapi-schema/union-max.err @@ -0,0 +1 @@ +tests/qapi-schema/union-max.json:2: Union 'Union' member 'max' clashes with '(automatic)' diff --git a/qemu/tests/qapi-schema/union-max.exit b/qemu/tests/qapi-schema/union-max.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/union-max.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/union-max.json b/qemu/tests/qapi-schema/union-max.json new file mode 100644 index 000000000..d6ad98699 --- /dev/null +++ b/qemu/tests/qapi-schema/union-max.json @@ -0,0 +1,3 @@ +# we reject 'max' branch in a union, for collision with C enum +{ 'union': 'Union', + 'data': { 'max': 'int' } } diff --git a/qemu/tests/qapi-schema/union-max.out b/qemu/tests/qapi-schema/union-max.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/union-max.out diff --git a/qemu/tests/qapi-schema/union-optional-branch.err b/qemu/tests/qapi-schema/union-optional-branch.err new file mode 100644 index 000000000..3ada1334d --- /dev/null +++ b/qemu/tests/qapi-schema/union-optional-branch.err @@ -0,0 +1 @@ +tests/qapi-schema/union-optional-branch.json:2: Member of union 'Union' does not allow optional name '*a' diff --git a/qemu/tests/qapi-schema/union-optional-branch.exit b/qemu/tests/qapi-schema/union-optional-branch.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/union-optional-branch.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/union-optional-branch.json b/qemu/tests/qapi-schema/union-optional-branch.json new file mode 100644 index 000000000..591615fc6 --- /dev/null +++ b/qemu/tests/qapi-schema/union-optional-branch.json @@ -0,0 +1,2 @@ +# union branches cannot be optional +{ 'union': 'Union', 'data': { '*a': 'int', 'b': 'str' } } diff --git a/qemu/tests/qapi-schema/union-optional-branch.out b/qemu/tests/qapi-schema/union-optional-branch.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/union-optional-branch.out diff --git a/qemu/tests/qapi-schema/union-unknown.err b/qemu/tests/qapi-schema/union-unknown.err new file mode 100644 index 000000000..54fe456f9 --- /dev/null +++ b/qemu/tests/qapi-schema/union-unknown.err @@ -0,0 +1 @@ +tests/qapi-schema/union-unknown.json:2: Member 'unknown' of union 'Union' uses unknown type 'MissingType' diff --git a/qemu/tests/qapi-schema/union-unknown.exit b/qemu/tests/qapi-schema/union-unknown.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/union-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/union-unknown.json b/qemu/tests/qapi-schema/union-unknown.json new file mode 100644 index 000000000..aa7e8143d --- /dev/null +++ b/qemu/tests/qapi-schema/union-unknown.json @@ -0,0 +1,3 @@ +# we reject a union with unknown type in branch +{ 'union': 'Union', + 'data': { 'unknown': 'MissingType' } } diff --git a/qemu/tests/qapi-schema/union-unknown.out b/qemu/tests/qapi-schema/union-unknown.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/union-unknown.out diff --git a/qemu/tests/qapi-schema/unknown-escape.err b/qemu/tests/qapi-schema/unknown-escape.err new file mode 100644 index 000000000..000e30ddf --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-escape.err @@ -0,0 +1 @@ +tests/qapi-schema/unknown-escape.json:3:21: Unknown escape \x diff --git a/qemu/tests/qapi-schema/unknown-escape.exit b/qemu/tests/qapi-schema/unknown-escape.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-escape.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/unknown-escape.json b/qemu/tests/qapi-schema/unknown-escape.json new file mode 100644 index 000000000..8e6891e52 --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-escape.json @@ -0,0 +1,3 @@ +# we only recognize JSON escape sequences, plus our \' extension (no \x) +# { 'command': 'foo', 'data': {} } +{ 'command': 'foo', 'dat\x61':{} } diff --git a/qemu/tests/qapi-schema/unknown-escape.out b/qemu/tests/qapi-schema/unknown-escape.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-escape.out diff --git a/qemu/tests/qapi-schema/unknown-expr-key.err b/qemu/tests/qapi-schema/unknown-expr-key.err new file mode 100644 index 000000000..12f5ed5b4 --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-expr-key.err @@ -0,0 +1 @@ +tests/qapi-schema/unknown-expr-key.json:2: Unknown key 'bogus' in struct 'bar' diff --git a/qemu/tests/qapi-schema/unknown-expr-key.exit b/qemu/tests/qapi-schema/unknown-expr-key.exit new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-expr-key.exit @@ -0,0 +1 @@ +1 diff --git a/qemu/tests/qapi-schema/unknown-expr-key.json b/qemu/tests/qapi-schema/unknown-expr-key.json new file mode 100644 index 000000000..3b2be00cc --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-expr-key.json @@ -0,0 +1,2 @@ +# we reject an expression with unknown top-level keys +{ 'struct': 'bar', 'data': { 'string': 'str'}, 'bogus': { } } diff --git a/qemu/tests/qapi-schema/unknown-expr-key.out b/qemu/tests/qapi-schema/unknown-expr-key.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/qemu/tests/qapi-schema/unknown-expr-key.out |