diff options
Diffstat (limited to 'tests/qapi-schema')
303 files changed, 573 insertions, 85 deletions
diff --git a/tests/qapi-schema/alternate-array.err b/tests/qapi-schema/alternate-array.err new file mode 100644 index 0000000000..7b930c64ab --- /dev/null +++ b/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/tests/qapi-schema/alternate-array.exit b/tests/qapi-schema/alternate-array.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/alternate-array.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/alternate-array.json b/tests/qapi-schema/alternate-array.json new file mode 100644 index 0000000000..f241aac122 --- /dev/null +++ b/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/tests/qapi-schema/alternate-array.out b/tests/qapi-schema/alternate-array.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-array.out diff --git a/tests/qapi-schema/alternate-base.err b/tests/qapi-schema/alternate-base.err new file mode 100644 index 0000000000..30d8a34373 --- /dev/null +++ b/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/tests/qapi-schema/alternate-base.exit b/tests/qapi-schema/alternate-base.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/alternate-base.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/alternate-base.json b/tests/qapi-schema/alternate-base.json new file mode 100644 index 0000000000..529430ecf2 --- /dev/null +++ b/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/tests/qapi-schema/alternate-base.out b/tests/qapi-schema/alternate-base.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-base.out diff --git a/tests/qapi-schema/alternate-clash.err b/tests/qapi-schema/alternate-clash.err new file mode 100644 index 0000000000..51bea3e272 --- /dev/null +++ b/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/tests/qapi-schema/alternate-clash.exit b/tests/qapi-schema/alternate-clash.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/alternate-clash.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/alternate-clash.json b/tests/qapi-schema/alternate-clash.json new file mode 100644 index 0000000000..39479353bb --- /dev/null +++ b/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/tests/qapi-schema/alternate-clash.out b/tests/qapi-schema/alternate-clash.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-clash.out diff --git a/tests/qapi-schema/alternate-conflict-dict.err b/tests/qapi-schema/alternate-conflict-dict.err new file mode 100644 index 0000000000..0f411f4faf --- /dev/null +++ b/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/tests/qapi-schema/alternate-conflict-dict.exit b/tests/qapi-schema/alternate-conflict-dict.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/alternate-conflict-dict.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/alternate-conflict-dict.json b/tests/qapi-schema/alternate-conflict-dict.json new file mode 100644 index 0000000000..d566cca816 --- /dev/null +++ b/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/tests/qapi-schema/alternate-conflict-dict.out b/tests/qapi-schema/alternate-conflict-dict.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-conflict-dict.out diff --git a/tests/qapi-schema/alternate-conflict-string.err b/tests/qapi-schema/alternate-conflict-string.err new file mode 100644 index 0000000000..fc523b0879 --- /dev/null +++ b/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/tests/qapi-schema/alternate-conflict-string.exit b/tests/qapi-schema/alternate-conflict-string.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/alternate-conflict-string.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/alternate-conflict-string.json b/tests/qapi-schema/alternate-conflict-string.json new file mode 100644 index 0000000000..72f04a820a --- /dev/null +++ b/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/tests/qapi-schema/alternate-conflict-string.out b/tests/qapi-schema/alternate-conflict-string.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-conflict-string.out diff --git a/tests/qapi-schema/alternate-good.err b/tests/qapi-schema/alternate-good.err new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-good.err diff --git a/tests/qapi-schema/alternate-good.exit b/tests/qapi-schema/alternate-good.exit new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/qapi-schema/alternate-good.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/alternate-good.json b/tests/qapi-schema/alternate-good.json new file mode 100644 index 0000000000..33717704ce --- /dev/null +++ b/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/tests/qapi-schema/alternate-good.out b/tests/qapi-schema/alternate-good.out new file mode 100644 index 0000000000..99848eefbb --- /dev/null +++ b/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/tests/qapi-schema/alternate-nested.err b/tests/qapi-schema/alternate-nested.err new file mode 100644 index 0000000000..4d1187e60e --- /dev/null +++ b/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/tests/qapi-schema/alternate-nested.exit b/tests/qapi-schema/alternate-nested.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/alternate-nested.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/alternate-nested.json b/tests/qapi-schema/alternate-nested.json new file mode 100644 index 0000000000..c4233b9f33 --- /dev/null +++ b/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/tests/qapi-schema/alternate-nested.out b/tests/qapi-schema/alternate-nested.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-nested.out diff --git a/tests/qapi-schema/alternate-unknown.err b/tests/qapi-schema/alternate-unknown.err new file mode 100644 index 0000000000..dea45dc730 --- /dev/null +++ b/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/tests/qapi-schema/alternate-unknown.exit b/tests/qapi-schema/alternate-unknown.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/alternate-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/alternate-unknown.json b/tests/qapi-schema/alternate-unknown.json new file mode 100644 index 0000000000..ad5c103028 --- /dev/null +++ b/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/tests/qapi-schema/alternate-unknown.out b/tests/qapi-schema/alternate-unknown.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/alternate-unknown.out diff --git a/tests/qapi-schema/bad-base.err b/tests/qapi-schema/bad-base.err new file mode 100644 index 0000000000..154274bdd3 --- /dev/null +++ b/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/tests/qapi-schema/bad-base.exit b/tests/qapi-schema/bad-base.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/bad-base.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/bad-base.json b/tests/qapi-schema/bad-base.json new file mode 100644 index 0000000000..a634331cdd --- /dev/null +++ b/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/tests/qapi-schema/bad-base.out b/tests/qapi-schema/bad-base.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/bad-base.out diff --git a/tests/qapi-schema/bad-data.err b/tests/qapi-schema/bad-data.err new file mode 100644 index 0000000000..8523ac4f46 --- /dev/null +++ b/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/tests/qapi-schema/bad-data.exit b/tests/qapi-schema/bad-data.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/bad-data.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/bad-data.json b/tests/qapi-schema/bad-data.json new file mode 100644 index 0000000000..832eeb76f4 --- /dev/null +++ b/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/tests/qapi-schema/bad-data.out b/tests/qapi-schema/bad-data.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/bad-data.out diff --git a/tests/qapi-schema/bad-ident.err b/tests/qapi-schema/bad-ident.err new file mode 100644 index 0000000000..c4190602b5 --- /dev/null +++ b/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/tests/qapi-schema/bad-ident.exit b/tests/qapi-schema/bad-ident.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/bad-ident.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/bad-ident.json b/tests/qapi-schema/bad-ident.json new file mode 100644 index 0000000000..763627ad23 --- /dev/null +++ b/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/tests/qapi-schema/bad-ident.out b/tests/qapi-schema/bad-ident.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/bad-ident.out diff --git a/tests/qapi-schema/bad-type-bool.err b/tests/qapi-schema/bad-type-bool.err new file mode 100644 index 0000000000..62fd70baaf --- /dev/null +++ b/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/tests/qapi-schema/bad-type-bool.exit b/tests/qapi-schema/bad-type-bool.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/bad-type-bool.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/bad-type-bool.json b/tests/qapi-schema/bad-type-bool.json new file mode 100644 index 0000000000..bde17b56c4 --- /dev/null +++ b/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/tests/qapi-schema/bad-type-bool.out b/tests/qapi-schema/bad-type-bool.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/bad-type-bool.out diff --git a/tests/qapi-schema/bad-type-dict.err b/tests/qapi-schema/bad-type-dict.err new file mode 100644 index 0000000000..0b2a2aeac4 --- /dev/null +++ b/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/tests/qapi-schema/bad-type-dict.exit b/tests/qapi-schema/bad-type-dict.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/bad-type-dict.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/bad-type-dict.json b/tests/qapi-schema/bad-type-dict.json new file mode 100644 index 0000000000..2a91b241f8 --- /dev/null +++ b/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/tests/qapi-schema/bad-type-dict.out b/tests/qapi-schema/bad-type-dict.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/bad-type-dict.out diff --git a/tests/qapi-schema/bad-type-int.err b/tests/qapi-schema/bad-type-int.err new file mode 100644 index 0000000000..da89895404 --- /dev/null +++ b/tests/qapi-schema/bad-type-int.err @@ -0,0 +1 @@ +tests/qapi-schema/bad-type-int.json:3:13: Stray "1" diff --git a/tests/qapi-schema/bad-type-int.exit b/tests/qapi-schema/bad-type-int.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/bad-type-int.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/bad-type-int.json b/tests/qapi-schema/bad-type-int.json new file mode 100644 index 0000000000..56fc6f8126 --- /dev/null +++ b/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/tests/qapi-schema/bad-type-int.out b/tests/qapi-schema/bad-type-int.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/bad-type-int.out diff --git a/tests/qapi-schema/command-int.err b/tests/qapi-schema/command-int.err new file mode 100644 index 0000000000..0f9300679b --- /dev/null +++ b/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/tests/qapi-schema/command-int.exit b/tests/qapi-schema/command-int.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/command-int.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/command-int.json b/tests/qapi-schema/command-int.json new file mode 100644 index 0000000000..c90d408abe --- /dev/null +++ b/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/tests/qapi-schema/command-int.out b/tests/qapi-schema/command-int.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/command-int.out diff --git a/tests/qapi-schema/data-array-empty.err b/tests/qapi-schema/data-array-empty.err new file mode 100644 index 0000000000..f713f14893 --- /dev/null +++ b/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/tests/qapi-schema/data-array-empty.exit b/tests/qapi-schema/data-array-empty.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/data-array-empty.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/data-array-empty.json b/tests/qapi-schema/data-array-empty.json new file mode 100644 index 0000000000..652dcfb24a --- /dev/null +++ b/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/tests/qapi-schema/data-array-empty.out b/tests/qapi-schema/data-array-empty.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/data-array-empty.out diff --git a/tests/qapi-schema/data-array-unknown.err b/tests/qapi-schema/data-array-unknown.err new file mode 100644 index 0000000000..8b731bbcc8 --- /dev/null +++ b/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/tests/qapi-schema/data-array-unknown.exit b/tests/qapi-schema/data-array-unknown.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/data-array-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/data-array-unknown.json b/tests/qapi-schema/data-array-unknown.json new file mode 100644 index 0000000000..6f3e883315 --- /dev/null +++ b/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/tests/qapi-schema/data-array-unknown.out b/tests/qapi-schema/data-array-unknown.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/data-array-unknown.out diff --git a/tests/qapi-schema/data-int.err b/tests/qapi-schema/data-int.err new file mode 100644 index 0000000000..1a9b077c06 --- /dev/null +++ b/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/tests/qapi-schema/data-int.exit b/tests/qapi-schema/data-int.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/data-int.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/data-int.json b/tests/qapi-schema/data-int.json new file mode 100644 index 0000000000..a334d92e8c --- /dev/null +++ b/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/tests/qapi-schema/data-int.out b/tests/qapi-schema/data-int.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/data-int.out diff --git a/tests/qapi-schema/data-member-array-bad.err b/tests/qapi-schema/data-member-array-bad.err new file mode 100644 index 0000000000..2c072d5986 --- /dev/null +++ b/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/tests/qapi-schema/data-member-array-bad.exit b/tests/qapi-schema/data-member-array-bad.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/data-member-array-bad.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/data-member-array-bad.json b/tests/qapi-schema/data-member-array-bad.json new file mode 100644 index 0000000000..b2ff144ec6 --- /dev/null +++ b/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/tests/qapi-schema/data-member-array-bad.out b/tests/qapi-schema/data-member-array-bad.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/data-member-array-bad.out diff --git a/tests/qapi-schema/data-member-array.err b/tests/qapi-schema/data-member-array.err new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/data-member-array.err diff --git a/tests/qapi-schema/data-member-array.exit b/tests/qapi-schema/data-member-array.exit new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/qapi-schema/data-member-array.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/data-member-array.json b/tests/qapi-schema/data-member-array.json new file mode 100644 index 0000000000..e6f7f5da13 --- /dev/null +++ b/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/tests/qapi-schema/data-member-array.out b/tests/qapi-schema/data-member-array.out new file mode 100644 index 0000000000..c39fa25484 --- /dev/null +++ b/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/tests/qapi-schema/data-member-unknown.err b/tests/qapi-schema/data-member-unknown.err new file mode 100644 index 0000000000..ab905db802 --- /dev/null +++ b/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/tests/qapi-schema/data-member-unknown.exit b/tests/qapi-schema/data-member-unknown.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/data-member-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/data-member-unknown.json b/tests/qapi-schema/data-member-unknown.json new file mode 100644 index 0000000000..342a41ec90 --- /dev/null +++ b/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/tests/qapi-schema/data-member-unknown.out b/tests/qapi-schema/data-member-unknown.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/data-member-unknown.out diff --git a/tests/qapi-schema/data-unknown.err b/tests/qapi-schema/data-unknown.err new file mode 100644 index 0000000000..5b07277a95 --- /dev/null +++ b/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/tests/qapi-schema/data-unknown.exit b/tests/qapi-schema/data-unknown.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/data-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/data-unknown.json b/tests/qapi-schema/data-unknown.json new file mode 100644 index 0000000000..32aba43b3f --- /dev/null +++ b/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/tests/qapi-schema/data-unknown.out b/tests/qapi-schema/data-unknown.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/data-unknown.out diff --git a/tests/qapi-schema/double-data.err b/tests/qapi-schema/double-data.err new file mode 100644 index 0000000000..cc765c4ff2 --- /dev/null +++ b/tests/qapi-schema/double-data.err @@ -0,0 +1 @@ +tests/qapi-schema/double-data.json:2:41: Duplicate key "data" diff --git a/tests/qapi-schema/double-data.exit b/tests/qapi-schema/double-data.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/double-data.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/double-data.json b/tests/qapi-schema/double-data.json new file mode 100644 index 0000000000..e76b519538 --- /dev/null +++ b/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/tests/qapi-schema/double-data.out b/tests/qapi-schema/double-data.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/double-data.out diff --git a/tests/qapi-schema/double-type.err b/tests/qapi-schema/double-type.err new file mode 100644 index 0000000000..f9613c6d6b --- /dev/null +++ b/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/tests/qapi-schema/double-type.exit b/tests/qapi-schema/double-type.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/double-type.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/double-type.json b/tests/qapi-schema/double-type.json new file mode 100644 index 0000000000..911fa7af50 --- /dev/null +++ b/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/tests/qapi-schema/double-type.out b/tests/qapi-schema/double-type.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/double-type.out diff --git a/tests/qapi-schema/enum-bad-name.err b/tests/qapi-schema/enum-bad-name.err new file mode 100644 index 0000000000..9c3c1002b7 --- /dev/null +++ b/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/tests/qapi-schema/enum-bad-name.exit b/tests/qapi-schema/enum-bad-name.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-bad-name.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-bad-name.json b/tests/qapi-schema/enum-bad-name.json new file mode 100644 index 0000000000..8506562b31 --- /dev/null +++ b/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/tests/qapi-schema/enum-bad-name.out b/tests/qapi-schema/enum-bad-name.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-bad-name.out diff --git a/tests/qapi-schema/enum-clash-member.err b/tests/qapi-schema/enum-clash-member.err new file mode 100644 index 0000000000..48bd1360e7 --- /dev/null +++ b/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/tests/qapi-schema/enum-clash-member.exit b/tests/qapi-schema/enum-clash-member.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-clash-member.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-clash-member.json b/tests/qapi-schema/enum-clash-member.json new file mode 100644 index 0000000000..b7dc02a28d --- /dev/null +++ b/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/tests/qapi-schema/enum-clash-member.out b/tests/qapi-schema/enum-clash-member.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-clash-member.out diff --git a/tests/qapi-schema/enum-dict-member.err b/tests/qapi-schema/enum-dict-member.err new file mode 100644 index 0000000000..8ca146ea59 --- /dev/null +++ b/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/tests/qapi-schema/enum-dict-member.exit b/tests/qapi-schema/enum-dict-member.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-dict-member.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-dict-member.json b/tests/qapi-schema/enum-dict-member.json new file mode 100644 index 0000000000..79672e0f09 --- /dev/null +++ b/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/tests/qapi-schema/enum-dict-member.out b/tests/qapi-schema/enum-dict-member.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-dict-member.out diff --git a/tests/qapi-schema/enum-empty.err b/tests/qapi-schema/enum-empty.err new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-empty.err diff --git a/tests/qapi-schema/enum-empty.exit b/tests/qapi-schema/enum-empty.exit new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/qapi-schema/enum-empty.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/enum-empty.json b/tests/qapi-schema/enum-empty.json new file mode 100644 index 0000000000..40d4e85a2f --- /dev/null +++ b/tests/qapi-schema/enum-empty.json @@ -0,0 +1,2 @@ +# An empty enum, although unusual, is currently acceptable +{ 'enum': 'MyEnum', 'data': [ ] } diff --git a/tests/qapi-schema/enum-empty.out b/tests/qapi-schema/enum-empty.out new file mode 100644 index 0000000000..3b75c1613c --- /dev/null +++ b/tests/qapi-schema/enum-empty.out @@ -0,0 +1,3 @@ +[OrderedDict([('enum', 'MyEnum'), ('data', [])])] +[{'enum_name': 'MyEnum', 'enum_values': []}] +[] diff --git a/tests/qapi-schema/enum-int-member.err b/tests/qapi-schema/enum-int-member.err new file mode 100644 index 0000000000..071c5213d8 --- /dev/null +++ b/tests/qapi-schema/enum-int-member.err @@ -0,0 +1 @@ +tests/qapi-schema/enum-int-member.json:3:31: Stray "1" diff --git a/tests/qapi-schema/enum-int-member.exit b/tests/qapi-schema/enum-int-member.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-int-member.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-int-member.json b/tests/qapi-schema/enum-int-member.json new file mode 100644 index 0000000000..6c9c32e149 --- /dev/null +++ b/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/tests/qapi-schema/enum-int-member.out b/tests/qapi-schema/enum-int-member.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-int-member.out diff --git a/tests/qapi-schema/enum-max-member.err b/tests/qapi-schema/enum-max-member.err new file mode 100644 index 0000000000..f77837fb45 --- /dev/null +++ b/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/tests/qapi-schema/enum-max-member.exit b/tests/qapi-schema/enum-max-member.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-max-member.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-max-member.json b/tests/qapi-schema/enum-max-member.json new file mode 100644 index 0000000000..4bcda0bf07 --- /dev/null +++ b/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/tests/qapi-schema/enum-max-member.out b/tests/qapi-schema/enum-max-member.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-max-member.out diff --git a/tests/qapi-schema/enum-missing-data.err b/tests/qapi-schema/enum-missing-data.err new file mode 100644 index 0000000000..ba4873ae69 --- /dev/null +++ b/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/tests/qapi-schema/enum-missing-data.exit b/tests/qapi-schema/enum-missing-data.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-missing-data.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-missing-data.json b/tests/qapi-schema/enum-missing-data.json new file mode 100644 index 0000000000..558fd35e93 --- /dev/null +++ b/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/tests/qapi-schema/enum-missing-data.out b/tests/qapi-schema/enum-missing-data.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-missing-data.out diff --git a/tests/qapi-schema/enum-union-clash.err b/tests/qapi-schema/enum-union-clash.err new file mode 100644 index 0000000000..c04e1a8064 --- /dev/null +++ b/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/tests/qapi-schema/enum-union-clash.exit b/tests/qapi-schema/enum-union-clash.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-union-clash.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-union-clash.json b/tests/qapi-schema/enum-union-clash.json new file mode 100644 index 0000000000..593282b6cf --- /dev/null +++ b/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/tests/qapi-schema/enum-union-clash.out b/tests/qapi-schema/enum-union-clash.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-union-clash.out diff --git a/tests/qapi-schema/enum-wrong-data.err b/tests/qapi-schema/enum-wrong-data.err new file mode 100644 index 0000000000..11b43471cf --- /dev/null +++ b/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/tests/qapi-schema/enum-wrong-data.exit b/tests/qapi-schema/enum-wrong-data.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/enum-wrong-data.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/enum-wrong-data.json b/tests/qapi-schema/enum-wrong-data.json new file mode 100644 index 0000000000..7b3e255c14 --- /dev/null +++ b/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/tests/qapi-schema/enum-wrong-data.out b/tests/qapi-schema/enum-wrong-data.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/enum-wrong-data.out diff --git a/tests/qapi-schema/escape-outside-string.err b/tests/qapi-schema/escape-outside-string.err new file mode 100644 index 0000000000..b9b8837fd2 --- /dev/null +++ b/tests/qapi-schema/escape-outside-string.err @@ -0,0 +1 @@ +tests/qapi-schema/escape-outside-string.json:3:27: Stray "\" diff --git a/tests/qapi-schema/escape-outside-string.exit b/tests/qapi-schema/escape-outside-string.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/escape-outside-string.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/escape-outside-string.json b/tests/qapi-schema/escape-outside-string.json new file mode 100644 index 0000000000..482f79554b --- /dev/null +++ b/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/tests/qapi-schema/escape-outside-string.out b/tests/qapi-schema/escape-outside-string.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/escape-outside-string.out diff --git a/tests/qapi-schema/escape-too-big.err b/tests/qapi-schema/escape-too-big.err new file mode 100644 index 0000000000..d9aeb5dc38 --- /dev/null +++ b/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/tests/qapi-schema/escape-too-big.exit b/tests/qapi-schema/escape-too-big.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/escape-too-big.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/escape-too-big.json b/tests/qapi-schema/escape-too-big.json new file mode 100644 index 0000000000..62bcecd557 --- /dev/null +++ b/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/tests/qapi-schema/escape-too-big.out b/tests/qapi-schema/escape-too-big.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/escape-too-big.out diff --git a/tests/qapi-schema/escape-too-short.err b/tests/qapi-schema/escape-too-short.err new file mode 100644 index 0000000000..934de598ee --- /dev/null +++ b/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/tests/qapi-schema/escape-too-short.exit b/tests/qapi-schema/escape-too-short.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/escape-too-short.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/escape-too-short.json b/tests/qapi-schema/escape-too-short.json new file mode 100644 index 0000000000..6cb1dec8f7 --- /dev/null +++ b/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/tests/qapi-schema/escape-too-short.out b/tests/qapi-schema/escape-too-short.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/escape-too-short.out diff --git a/tests/qapi-schema/event-case.err b/tests/qapi-schema/event-case.err new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/event-case.err diff --git a/tests/qapi-schema/event-case.exit b/tests/qapi-schema/event-case.exit new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/qapi-schema/event-case.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/event-case.json b/tests/qapi-schema/event-case.json new file mode 100644 index 0000000000..3a92d8b610 --- /dev/null +++ b/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/tests/qapi-schema/event-case.out b/tests/qapi-schema/event-case.out new file mode 100644 index 0000000000..3764bc781d --- /dev/null +++ b/tests/qapi-schema/event-case.out @@ -0,0 +1,3 @@ +[OrderedDict([('event', 'oops')])] +[] +[] diff --git a/tests/qapi-schema/event-max.err b/tests/qapi-schema/event-max.err new file mode 100644 index 0000000000..c856534379 --- /dev/null +++ b/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/tests/qapi-schema/event-max.exit b/tests/qapi-schema/event-max.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/event-max.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/event-max.json b/tests/qapi-schema/event-max.json new file mode 100644 index 0000000000..f3d7de2a30 --- /dev/null +++ b/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/tests/qapi-schema/event-max.out b/tests/qapi-schema/event-max.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/event-max.out diff --git a/tests/qapi-schema/event-nest-struct.err b/tests/qapi-schema/event-nest-struct.err index 91bde1c967..5a42701b8f 100644 --- a/tests/qapi-schema/event-nest-struct.err +++ b/tests/qapi-schema/event-nest-struct.err @@ -1 +1 @@ -tests/qapi-schema/event-nest-struct.json:1: Nested structure define in event is not supported, event 'EVENT_A', argname 'a' +tests/qapi-schema/event-nest-struct.json:1: Member 'a' of 'data' for event 'EVENT_A' should be a type name diff --git a/tests/qapi-schema/flat-union-bad-base.err b/tests/qapi-schema/flat-union-bad-base.err new file mode 100644 index 0000000000..f9c31b2bf5 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-bad-base.exit b/tests/qapi-schema/flat-union-bad-base.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-bad-base.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-bad-base.json b/tests/qapi-schema/flat-union-bad-base.json new file mode 100644 index 0000000000..e2e622bb6e --- /dev/null +++ b/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/tests/qapi-schema/flat-union-bad-base.out b/tests/qapi-schema/flat-union-bad-base.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-bad-base.out diff --git a/tests/qapi-schema/flat-union-bad-discriminator.err b/tests/qapi-schema/flat-union-bad-discriminator.err new file mode 100644 index 0000000000..c38cc8e4df --- /dev/null +++ b/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/tests/qapi-schema/flat-union-bad-discriminator.exit b/tests/qapi-schema/flat-union-bad-discriminator.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-bad-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-bad-discriminator.json b/tests/qapi-schema/flat-union-bad-discriminator.json new file mode 100644 index 0000000000..cd10b9d901 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-bad-discriminator.out b/tests/qapi-schema/flat-union-bad-discriminator.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-bad-discriminator.out diff --git a/tests/qapi-schema/flat-union-base-star.err b/tests/qapi-schema/flat-union-base-star.err new file mode 100644 index 0000000000..b7748f08bf --- /dev/null +++ b/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/tests/qapi-schema/flat-union-base-star.exit b/tests/qapi-schema/flat-union-base-star.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-base-star.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-base-star.json b/tests/qapi-schema/flat-union-base-star.json new file mode 100644 index 0000000000..5099439a9d --- /dev/null +++ b/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/tests/qapi-schema/flat-union-base-star.out b/tests/qapi-schema/flat-union-base-star.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-base-star.out diff --git a/tests/qapi-schema/flat-union-base-union.err b/tests/qapi-schema/flat-union-base-union.err new file mode 100644 index 0000000000..ede9859a39 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-base-union.exit b/tests/qapi-schema/flat-union-base-union.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-base-union.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-base-union.json b/tests/qapi-schema/flat-union-base-union.json new file mode 100644 index 0000000000..6a8ea687a9 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-base-union.out b/tests/qapi-schema/flat-union-base-union.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-base-union.out diff --git a/tests/qapi-schema/flat-union-branch-clash.err b/tests/qapi-schema/flat-union-branch-clash.err new file mode 100644 index 0000000000..f11276688c --- /dev/null +++ b/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/tests/qapi-schema/flat-union-branch-clash.exit b/tests/qapi-schema/flat-union-branch-clash.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-branch-clash.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-branch-clash.json b/tests/qapi-schema/flat-union-branch-clash.json new file mode 100644 index 0000000000..8fb054f004 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-branch-clash.out b/tests/qapi-schema/flat-union-branch-clash.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-branch-clash.out diff --git a/tests/qapi-schema/flat-union-inline.err b/tests/qapi-schema/flat-union-inline.err new file mode 100644 index 0000000000..ec586277b7 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-inline.exit b/tests/qapi-schema/flat-union-inline.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-inline.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-inline.json b/tests/qapi-schema/flat-union-inline.json new file mode 100644 index 0000000000..6bfdd65811 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-inline.out b/tests/qapi-schema/flat-union-inline.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-inline.out diff --git a/tests/qapi-schema/flat-union-int-branch.err b/tests/qapi-schema/flat-union-int-branch.err new file mode 100644 index 0000000000..faf01573b7 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-int-branch.exit b/tests/qapi-schema/flat-union-int-branch.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-int-branch.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-int-branch.json b/tests/qapi-schema/flat-union-int-branch.json new file mode 100644 index 0000000000..9370c349e8 --- /dev/null +++ b/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/tests/qapi-schema/flat-union-int-branch.out b/tests/qapi-schema/flat-union-int-branch.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-int-branch.out diff --git a/tests/qapi-schema/flat-union-invalid-branch-key.json b/tests/qapi-schema/flat-union-invalid-branch-key.json index a6242823ed..95ff7746bf 100644 --- a/tests/qapi-schema/flat-union-invalid-branch-key.json +++ b/tests/qapi-schema/flat-union-invalid-branch-key.json @@ -1,13 +1,13 @@ { 'enum': 'TestEnum', 'data': [ 'value1', 'value2' ] } -{ 'type': 'TestBase', +{ 'struct': 'TestBase', 'data': { 'enum1': 'TestEnum' } } -{ 'type': 'TestTypeA', +{ 'struct': 'TestTypeA', 'data': { 'string': 'str' } } -{ 'type': 'TestTypeB', +{ 'struct': 'TestTypeB', 'data': { 'integer': 'int' } } { 'union': 'TestUnion', diff --git a/tests/qapi-schema/flat-union-invalid-discriminator.err b/tests/qapi-schema/flat-union-invalid-discriminator.err index 790b6759b8..5f4055614e 100644 --- a/tests/qapi-schema/flat-union-invalid-discriminator.err +++ b/tests/qapi-schema/flat-union-invalid-discriminator.err @@ -1 +1 @@ -tests/qapi-schema/flat-union-invalid-discriminator.json:13: Discriminator 'enum_wrong' is not a member of base type 'TestBase' +tests/qapi-schema/flat-union-invalid-discriminator.json:13: Discriminator 'enum_wrong' is not a member of base struct 'TestBase' diff --git a/tests/qapi-schema/flat-union-invalid-discriminator.json b/tests/qapi-schema/flat-union-invalid-discriminator.json index 887157e173..48b94c3a4d 100644 --- a/tests/qapi-schema/flat-union-invalid-discriminator.json +++ b/tests/qapi-schema/flat-union-invalid-discriminator.json @@ -1,13 +1,13 @@ { 'enum': 'TestEnum', 'data': [ 'value1', 'value2' ] } -{ 'type': 'TestBase', +{ 'struct': 'TestBase', 'data': { 'enum1': 'TestEnum' } } -{ 'type': 'TestTypeA', +{ 'struct': 'TestTypeA', 'data': { 'string': 'str' } } -{ 'type': 'TestTypeB', +{ 'struct': 'TestTypeB', 'data': { 'integer': 'int' } } { 'union': 'TestUnion', diff --git a/tests/qapi-schema/flat-union-no-base.err b/tests/qapi-schema/flat-union-no-base.err index a59749eb84..bb3f708747 100644 --- a/tests/qapi-schema/flat-union-no-base.err +++ b/tests/qapi-schema/flat-union-no-base.err @@ -1 +1 @@ -tests/qapi-schema/flat-union-no-base.json:7: Flat union 'TestUnion' must have a base field +tests/qapi-schema/flat-union-no-base.json:9: Flat union 'TestUnion' must have a string base field diff --git a/tests/qapi-schema/flat-union-no-base.json b/tests/qapi-schema/flat-union-no-base.json index 50f267323b..ffc4c6f0e6 100644 --- a/tests/qapi-schema/flat-union-no-base.json +++ b/tests/qapi-schema/flat-union-no-base.json @@ -1,10 +1,12 @@ -{ 'type': 'TestTypeA', +# flat unions require a base +# TODO: simple unions should be able to use an enum discriminator +{ 'struct': 'TestTypeA', 'data': { 'string': 'str' } } - -{ 'type': 'TestTypeB', +{ 'struct': 'TestTypeB', 'data': { 'integer': 'int' } } - +{ 'enum': 'Enum', + 'data': [ 'value1', 'value2' ] } { 'union': 'TestUnion', - 'discriminator': 'enum1', + 'discriminator': 'Enum', 'data': { 'value1': 'TestTypeA', 'value2': 'TestTypeB' } } diff --git a/tests/qapi-schema/flat-union-optional-discriminator.err b/tests/qapi-schema/flat-union-optional-discriminator.err new file mode 100644 index 0000000000..aaabedb3bd --- /dev/null +++ b/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/tests/qapi-schema/flat-union-optional-discriminator.exit b/tests/qapi-schema/flat-union-optional-discriminator.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/flat-union-optional-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/flat-union-optional-discriminator.json b/tests/qapi-schema/flat-union-optional-discriminator.json new file mode 100644 index 0000000000..08a8f7ef8b --- /dev/null +++ b/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/tests/qapi-schema/flat-union-optional-discriminator.out b/tests/qapi-schema/flat-union-optional-discriminator.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/flat-union-optional-discriminator.out diff --git a/tests/qapi-schema/flat-union-reverse-define.json b/tests/qapi-schema/flat-union-reverse-define.json index 9ea7e72201..648bbfe2b7 100644 --- a/tests/qapi-schema/flat-union-reverse-define.json +++ b/tests/qapi-schema/flat-union-reverse-define.json @@ -4,14 +4,14 @@ 'data': { 'value1': 'TestTypeA', 'value2': 'TestTypeB' } } -{ 'type': 'TestBase', +{ 'struct': 'TestBase', 'data': { 'enum1': 'TestEnum' } } { 'enum': 'TestEnum', 'data': [ 'value1', 'value2' ] } -{ 'type': 'TestTypeA', +{ 'struct': 'TestTypeA', 'data': { 'string': 'str' } } -{ 'type': 'TestTypeB', +{ 'struct': 'TestTypeB', 'data': { 'integer': 'int' } } diff --git a/tests/qapi-schema/flat-union-reverse-define.out b/tests/qapi-schema/flat-union-reverse-define.out index 03c952e28a..1ed7b8a519 100644 --- a/tests/qapi-schema/flat-union-reverse-define.out +++ b/tests/qapi-schema/flat-union-reverse-define.out @@ -1,9 +1,9 @@ [OrderedDict([('union', 'TestUnion'), ('base', 'TestBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'TestTypeA'), ('value2', 'TestTypeB')]))]), - OrderedDict([('type', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum')]))]), + OrderedDict([('struct', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum')]))]), OrderedDict([('enum', 'TestEnum'), ('data', ['value1', 'value2'])]), - OrderedDict([('type', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), - OrderedDict([('type', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))])] + OrderedDict([('struct', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), + OrderedDict([('struct', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))])] [{'enum_name': 'TestEnum', 'enum_values': ['value1', 'value2']}] -[OrderedDict([('type', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum')]))]), - OrderedDict([('type', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), - OrderedDict([('type', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))])] +[OrderedDict([('struct', 'TestBase'), ('data', OrderedDict([('enum1', 'TestEnum')]))]), + OrderedDict([('struct', 'TestTypeA'), ('data', OrderedDict([('string', 'str')]))]), + OrderedDict([('struct', 'TestTypeB'), ('data', OrderedDict([('integer', 'int')]))])] diff --git a/tests/qapi-schema/flat-union-string-discriminator.json b/tests/qapi-schema/flat-union-string-discriminator.json index e966aeb395..8af60333b6 100644 --- a/tests/qapi-schema/flat-union-string-discriminator.json +++ b/tests/qapi-schema/flat-union-string-discriminator.json @@ -1,13 +1,13 @@ { 'enum': 'TestEnum', 'data': [ 'value1', 'value2' ] } -{ 'type': 'TestBase', +{ 'struct': 'TestBase', 'data': { 'enum1': 'TestEnum', 'kind': 'str' } } -{ 'type': 'TestTypeA', +{ 'struct': 'TestTypeA', 'data': { 'string': 'str' } } -{ 'type': 'TestTypeB', +{ 'struct': 'TestTypeB', 'data': { 'integer': 'int' } } { 'union': 'TestUnion', diff --git a/tests/qapi-schema/ident-with-escape.err b/tests/qapi-schema/ident-with-escape.err new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/ident-with-escape.err diff --git a/tests/qapi-schema/ident-with-escape.exit b/tests/qapi-schema/ident-with-escape.exit new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/qapi-schema/ident-with-escape.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/ident-with-escape.json b/tests/qapi-schema/ident-with-escape.json new file mode 100644 index 0000000000..56617501e7 --- /dev/null +++ b/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/tests/qapi-schema/ident-with-escape.out b/tests/qapi-schema/ident-with-escape.out new file mode 100644 index 0000000000..402843081b --- /dev/null +++ b/tests/qapi-schema/ident-with-escape.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'fooA'), ('data', OrderedDict([('bar1', 'str')]))])] +[] +[] diff --git a/tests/qapi-schema/indented-expr.json b/tests/qapi-schema/indented-expr.json index d80af60564..7115d3131e 100644 --- a/tests/qapi-schema/indented-expr.json +++ b/tests/qapi-schema/indented-expr.json @@ -1,2 +1,2 @@ -{ 'id' : 'eins' } - { 'id' : 'zwei' } +{ 'command' : 'eins' } + { 'command' : 'zwei' } diff --git a/tests/qapi-schema/indented-expr.out b/tests/qapi-schema/indented-expr.out index 98af89aa1d..b5ce9151bc 100644 --- a/tests/qapi-schema/indented-expr.out +++ b/tests/qapi-schema/indented-expr.out @@ -1,3 +1,3 @@ -[OrderedDict([('id', 'eins')]), OrderedDict([('id', 'zwei')])] +[OrderedDict([('command', 'eins')]), OrderedDict([('command', 'zwei')])] [] [] diff --git a/tests/qapi-schema/missing-type.err b/tests/qapi-schema/missing-type.err new file mode 100644 index 0000000000..b3e7b14e42 --- /dev/null +++ b/tests/qapi-schema/missing-type.err @@ -0,0 +1 @@ +tests/qapi-schema/missing-type.json:2: Expression is missing metatype diff --git a/tests/qapi-schema/missing-type.exit b/tests/qapi-schema/missing-type.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/missing-type.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/missing-type.json b/tests/qapi-schema/missing-type.json new file mode 100644 index 0000000000..ff5349d3fe --- /dev/null +++ b/tests/qapi-schema/missing-type.json @@ -0,0 +1,2 @@ +# we reject an expression with missing metatype +{ 'data': { } } diff --git a/tests/qapi-schema/missing-type.out b/tests/qapi-schema/missing-type.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/missing-type.out diff --git a/tests/qapi-schema/nested-struct-data.err b/tests/qapi-schema/nested-struct-data.err new file mode 100644 index 0000000000..da767bade2 --- /dev/null +++ b/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/tests/qapi-schema/nested-struct-data.exit b/tests/qapi-schema/nested-struct-data.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/nested-struct-data.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/nested-struct-data.json b/tests/qapi-schema/nested-struct-data.json new file mode 100644 index 0000000000..3d52d2b398 --- /dev/null +++ b/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/tests/qapi-schema/nested-struct-data.out b/tests/qapi-schema/nested-struct-data.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/nested-struct-data.out diff --git a/tests/qapi-schema/nested-struct-returns.err b/tests/qapi-schema/nested-struct-returns.err new file mode 100644 index 0000000000..5238d075b7 --- /dev/null +++ b/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/tests/qapi-schema/nested-struct-returns.exit b/tests/qapi-schema/nested-struct-returns.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/nested-struct-returns.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/nested-struct-returns.json b/tests/qapi-schema/nested-struct-returns.json new file mode 100644 index 0000000000..d2cd047f0d --- /dev/null +++ b/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/tests/qapi-schema/nested-struct-returns.out b/tests/qapi-schema/nested-struct-returns.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/nested-struct-returns.out diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index d43b5fd2e9..8193dc13a9 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -3,44 +3,40 @@ # for testing enums { 'enum': 'EnumOne', 'data': [ 'value1', 'value2', 'value3' ] } -{ 'type': 'NestedEnumsOne', +{ 'struct': 'NestedEnumsOne', 'data': { 'enum1': 'EnumOne', '*enum2': 'EnumOne', 'enum3': 'EnumOne', '*enum4': 'EnumOne' } } # for testing nested structs -{ 'type': 'UserDefZero', +{ 'struct': 'UserDefZero', 'data': { 'integer': 'int' } } -{ 'type': 'UserDefOne', +{ 'struct': 'UserDefOne', 'base': 'UserDefZero', 'data': { 'string': 'str', '*enum1': 'EnumOne' } } -{ 'type': 'UserDefTwo', - 'data': { 'string': 'str', - 'dict': { 'string': 'str', - 'dict': { 'userdef': 'UserDefOne', 'string': 'str' }, - '*dict2': { 'userdef': 'UserDefOne', 'string': 'str' } } } } +{ 'struct': 'UserDefTwoDictDict', + 'data': { 'userdef': 'UserDefOne', 'string': 'str' } } -{ 'type': 'UserDefNested', +{ 'struct': 'UserDefTwoDict', + 'data': { 'string1': 'str', + 'dict2': 'UserDefTwoDictDict', + '*dict3': 'UserDefTwoDictDict' } } + +{ 'struct': 'UserDefTwo', 'data': { 'string0': 'str', - 'dict1': { 'string1': 'str', - 'dict2': { 'userdef1': 'UserDefOne', 'string2': 'str' }, - '*dict3': { 'userdef2': 'UserDefOne', 'string3': 'str' } } } } + 'dict1': 'UserDefTwoDict' } } # for testing unions -{ 'type': 'UserDefA', +{ 'struct': 'UserDefA', 'data': { 'boolean': 'bool' } } -{ 'type': 'UserDefB', +{ 'struct': 'UserDefB', 'data': { 'integer': 'int' } } -{ 'type': 'UserDefC', +{ 'struct': 'UserDefC', 'data': { 'string1': 'str', 'string2': 'str' } } -{ 'union': 'UserDefUnion', - 'base': 'UserDefZero', - 'data': { 'a' : 'UserDefA', 'b' : 'UserDefB' } } - -{ 'type': 'UserDefUnionBase', +{ 'struct': 'UserDefUnionBase', 'data': { 'string': 'str', 'enum1': 'EnumOne' } } { 'union': 'UserDefFlatUnion', @@ -57,8 +53,7 @@ 'discriminator': 'enum1', 'data': { 'value1' : 'UserDefC', 'value2' : 'UserDefB', 'value3' : 'UserDefA' } } -{ 'union': 'UserDefAnonUnion', - 'discriminator': {}, +{ 'alternate': 'UserDefAlternate', 'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } } # for testing native lists @@ -74,7 +69,8 @@ 'u64': ['uint64'], 'number': ['number'], 'boolean': ['bool'], - 'string': ['str'] } } + 'string': ['str'], + 'sizes': ['size'] } } # testing commands { 'command': 'user_def_cmd', 'data': {} } @@ -92,7 +88,7 @@ # # For simplicity, this example doesn't use [type=]discriminator nor optargs # specific to discriminator values. -{ 'type': 'UserDefOptions', +{ 'struct': 'UserDefOptions', 'data': { '*i64' : [ 'int' ], '*u64' : [ 'uint64' ], @@ -101,7 +97,7 @@ '*u64x': 'uint64' } } # testing event -{ 'type': 'EventStructOne', +{ 'struct': 'EventStructOne', 'data': { 'struct1': 'UserDefOne', 'string': 'str', '*enum2': 'EnumOne' } } { 'event': 'EVENT_A' } diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out index 08d7304dfa..93c49635eb 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -1,40 +1,40 @@ [OrderedDict([('enum', 'EnumOne'), ('data', ['value1', 'value2', 'value3'])]), - OrderedDict([('type', 'NestedEnumsOne'), ('data', OrderedDict([('enum1', 'EnumOne'), ('*enum2', 'EnumOne'), ('enum3', 'EnumOne'), ('*enum4', 'EnumOne')]))]), - OrderedDict([('type', 'UserDefZero'), ('data', OrderedDict([('integer', 'int')]))]), - OrderedDict([('type', 'UserDefOne'), ('base', 'UserDefZero'), ('data', OrderedDict([('string', 'str'), ('*enum1', 'EnumOne')]))]), - OrderedDict([('type', 'UserDefTwo'), ('data', OrderedDict([('string', 'str'), ('dict', OrderedDict([('string', 'str'), ('dict', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')])), ('*dict2', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')]))]))]))]), - OrderedDict([('type', 'UserDefNested'), ('data', OrderedDict([('string0', 'str'), ('dict1', OrderedDict([('string1', 'str'), ('dict2', OrderedDict([('userdef1', 'UserDefOne'), ('string2', 'str')])), ('*dict3', OrderedDict([('userdef2', 'UserDefOne'), ('string3', 'str')]))]))]))]), - OrderedDict([('type', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]), - OrderedDict([('type', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]), - OrderedDict([('type', 'UserDefC'), ('data', OrderedDict([('string1', 'str'), ('string2', 'str')]))]), - OrderedDict([('union', 'UserDefUnion'), ('base', 'UserDefZero'), ('data', OrderedDict([('a', 'UserDefA'), ('b', 'UserDefB')]))]), - OrderedDict([('type', 'UserDefUnionBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]), + 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([('union', 'UserDefAnonUnion'), ('discriminator', OrderedDict()), ('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'])]))]), + 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([('type', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))]), - OrderedDict([('type', 'EventStructOne'), ('data', OrderedDict([('struct1', 'UserDefOne'), ('string', 'str'), ('*enum2', '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([('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')]))])] [{'enum_name': 'EnumOne', 'enum_values': ['value1', 'value2', 'value3']}, - {'enum_name': 'UserDefUnionKind', 'enum_values': None}, - {'enum_name': 'UserDefAnonUnionKind', 'enum_values': None}, + {'enum_name': 'UserDefAlternateKind', 'enum_values': None}, {'enum_name': 'UserDefNativeListUnionKind', 'enum_values': None}] -[OrderedDict([('type', 'NestedEnumsOne'), ('data', OrderedDict([('enum1', 'EnumOne'), ('*enum2', 'EnumOne'), ('enum3', 'EnumOne'), ('*enum4', 'EnumOne')]))]), - OrderedDict([('type', 'UserDefZero'), ('data', OrderedDict([('integer', 'int')]))]), - OrderedDict([('type', 'UserDefOne'), ('base', 'UserDefZero'), ('data', OrderedDict([('string', 'str'), ('*enum1', 'EnumOne')]))]), - OrderedDict([('type', 'UserDefTwo'), ('data', OrderedDict([('string', 'str'), ('dict', OrderedDict([('string', 'str'), ('dict', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')])), ('*dict2', OrderedDict([('userdef', 'UserDefOne'), ('string', 'str')]))]))]))]), - OrderedDict([('type', 'UserDefNested'), ('data', OrderedDict([('string0', 'str'), ('dict1', OrderedDict([('string1', 'str'), ('dict2', OrderedDict([('userdef1', 'UserDefOne'), ('string2', 'str')])), ('*dict3', OrderedDict([('userdef2', 'UserDefOne'), ('string3', 'str')]))]))]))]), - OrderedDict([('type', 'UserDefA'), ('data', OrderedDict([('boolean', 'bool')]))]), - OrderedDict([('type', 'UserDefB'), ('data', OrderedDict([('integer', 'int')]))]), - OrderedDict([('type', 'UserDefC'), ('data', OrderedDict([('string1', 'str'), ('string2', 'str')]))]), - OrderedDict([('type', 'UserDefUnionBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]), - OrderedDict([('type', 'UserDefOptions'), ('data', OrderedDict([('*i64', ['int']), ('*u64', ['uint64']), ('*u16', ['uint16']), ('*i64x', 'int'), ('*u64x', 'uint64')]))]), - OrderedDict([('type', 'EventStructOne'), ('data', OrderedDict([('struct1', 'UserDefOne'), ('string', 'str'), ('*enum2', 'EnumOne')]))])] +[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')]))])] diff --git a/tests/qapi-schema/redefined-builtin.err b/tests/qapi-schema/redefined-builtin.err new file mode 100644 index 0000000000..b2757225c4 --- /dev/null +++ b/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/tests/qapi-schema/redefined-builtin.exit b/tests/qapi-schema/redefined-builtin.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/redefined-builtin.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/redefined-builtin.json b/tests/qapi-schema/redefined-builtin.json new file mode 100644 index 0000000000..45b8a550ad --- /dev/null +++ b/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/tests/qapi-schema/redefined-builtin.out b/tests/qapi-schema/redefined-builtin.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/redefined-builtin.out diff --git a/tests/qapi-schema/redefined-command.err b/tests/qapi-schema/redefined-command.err new file mode 100644 index 0000000000..82ae256e63 --- /dev/null +++ b/tests/qapi-schema/redefined-command.err @@ -0,0 +1 @@ +tests/qapi-schema/redefined-command.json:3: command 'foo' is already defined diff --git a/tests/qapi-schema/redefined-command.exit b/tests/qapi-schema/redefined-command.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/redefined-command.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/redefined-command.json b/tests/qapi-schema/redefined-command.json new file mode 100644 index 0000000000..247e401948 --- /dev/null +++ b/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/tests/qapi-schema/redefined-command.out b/tests/qapi-schema/redefined-command.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/redefined-command.out diff --git a/tests/qapi-schema/redefined-event.err b/tests/qapi-schema/redefined-event.err new file mode 100644 index 0000000000..35429cb481 --- /dev/null +++ b/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/tests/qapi-schema/redefined-event.exit b/tests/qapi-schema/redefined-event.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/redefined-event.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/redefined-event.json b/tests/qapi-schema/redefined-event.json new file mode 100644 index 0000000000..7717e91c18 --- /dev/null +++ b/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/tests/qapi-schema/redefined-event.out b/tests/qapi-schema/redefined-event.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/redefined-event.out diff --git a/tests/qapi-schema/redefined-type.err b/tests/qapi-schema/redefined-type.err new file mode 100644 index 0000000000..06ea78c478 --- /dev/null +++ b/tests/qapi-schema/redefined-type.err @@ -0,0 +1 @@ +tests/qapi-schema/redefined-type.json:3: struct 'foo' is already defined diff --git a/tests/qapi-schema/redefined-type.exit b/tests/qapi-schema/redefined-type.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/redefined-type.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/redefined-type.json b/tests/qapi-schema/redefined-type.json new file mode 100644 index 0000000000..a09e768bae --- /dev/null +++ b/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/tests/qapi-schema/redefined-type.out b/tests/qapi-schema/redefined-type.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/redefined-type.out diff --git a/tests/qapi-schema/returns-alternate.err b/tests/qapi-schema/returns-alternate.err new file mode 100644 index 0000000000..dfbb419cac --- /dev/null +++ b/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/tests/qapi-schema/returns-alternate.exit b/tests/qapi-schema/returns-alternate.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/returns-alternate.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/returns-alternate.json b/tests/qapi-schema/returns-alternate.json new file mode 100644 index 0000000000..972390c06b --- /dev/null +++ b/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/tests/qapi-schema/returns-alternate.out b/tests/qapi-schema/returns-alternate.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/returns-alternate.out diff --git a/tests/qapi-schema/returns-array-bad.err b/tests/qapi-schema/returns-array-bad.err new file mode 100644 index 0000000000..138095ccde --- /dev/null +++ b/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/tests/qapi-schema/returns-array-bad.exit b/tests/qapi-schema/returns-array-bad.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/returns-array-bad.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/returns-array-bad.json b/tests/qapi-schema/returns-array-bad.json new file mode 100644 index 0000000000..09b0b1f182 --- /dev/null +++ b/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/tests/qapi-schema/returns-array-bad.out b/tests/qapi-schema/returns-array-bad.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/returns-array-bad.out diff --git a/tests/qapi-schema/returns-int.err b/tests/qapi-schema/returns-int.err new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/returns-int.err diff --git a/tests/qapi-schema/returns-int.exit b/tests/qapi-schema/returns-int.exit new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/qapi-schema/returns-int.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/returns-int.json b/tests/qapi-schema/returns-int.json new file mode 100644 index 0000000000..870ec6366b --- /dev/null +++ b/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/tests/qapi-schema/returns-int.out b/tests/qapi-schema/returns-int.out new file mode 100644 index 0000000000..70b3ac5e6f --- /dev/null +++ b/tests/qapi-schema/returns-int.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'guest-get-time'), ('returns', 'int')])] +[] +[] diff --git a/tests/qapi-schema/returns-unknown.err b/tests/qapi-schema/returns-unknown.err new file mode 100644 index 0000000000..1f43e3ac9f --- /dev/null +++ b/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/tests/qapi-schema/returns-unknown.exit b/tests/qapi-schema/returns-unknown.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/returns-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/returns-unknown.json b/tests/qapi-schema/returns-unknown.json new file mode 100644 index 0000000000..25bd498bff --- /dev/null +++ b/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/tests/qapi-schema/returns-unknown.out b/tests/qapi-schema/returns-unknown.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/returns-unknown.out diff --git a/tests/qapi-schema/returns-whitelist.err b/tests/qapi-schema/returns-whitelist.err new file mode 100644 index 0000000000..a41f019a52 --- /dev/null +++ b/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/tests/qapi-schema/returns-whitelist.exit b/tests/qapi-schema/returns-whitelist.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/returns-whitelist.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/returns-whitelist.json b/tests/qapi-schema/returns-whitelist.json new file mode 100644 index 0000000000..e8b3cea396 --- /dev/null +++ b/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/tests/qapi-schema/returns-whitelist.out b/tests/qapi-schema/returns-whitelist.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/returns-whitelist.out diff --git a/tests/qapi-schema/struct-base-clash-deep.err b/tests/qapi-schema/struct-base-clash-deep.err new file mode 100644 index 0000000000..e3e9f8d289 --- /dev/null +++ b/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/tests/qapi-schema/struct-base-clash-deep.exit b/tests/qapi-schema/struct-base-clash-deep.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/struct-base-clash-deep.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/struct-base-clash-deep.json b/tests/qapi-schema/struct-base-clash-deep.json new file mode 100644 index 0000000000..552fe94317 --- /dev/null +++ b/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/tests/qapi-schema/struct-base-clash-deep.out b/tests/qapi-schema/struct-base-clash-deep.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/struct-base-clash-deep.out diff --git a/tests/qapi-schema/struct-base-clash.err b/tests/qapi-schema/struct-base-clash.err new file mode 100644 index 0000000000..3ac37fb26a --- /dev/null +++ b/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/tests/qapi-schema/struct-base-clash.exit b/tests/qapi-schema/struct-base-clash.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/struct-base-clash.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/struct-base-clash.json b/tests/qapi-schema/struct-base-clash.json new file mode 100644 index 0000000000..f2afc9b6f6 --- /dev/null +++ b/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/tests/qapi-schema/struct-base-clash.out b/tests/qapi-schema/struct-base-clash.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/struct-base-clash.out diff --git a/tests/qapi-schema/type-bypass-bad-gen.err b/tests/qapi-schema/type-bypass-bad-gen.err new file mode 100644 index 0000000000..a83c3c655d --- /dev/null +++ b/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/tests/qapi-schema/type-bypass-bad-gen.exit b/tests/qapi-schema/type-bypass-bad-gen.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/type-bypass-bad-gen.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/type-bypass-bad-gen.json b/tests/qapi-schema/type-bypass-bad-gen.json new file mode 100644 index 0000000000..e8dec34249 --- /dev/null +++ b/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/tests/qapi-schema/type-bypass-bad-gen.out b/tests/qapi-schema/type-bypass-bad-gen.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/type-bypass-bad-gen.out diff --git a/tests/qapi-schema/type-bypass-no-gen.err b/tests/qapi-schema/type-bypass-no-gen.err new file mode 100644 index 0000000000..20cef0a8a7 --- /dev/null +++ b/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/tests/qapi-schema/type-bypass-no-gen.exit b/tests/qapi-schema/type-bypass-no-gen.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/type-bypass-no-gen.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/type-bypass-no-gen.json b/tests/qapi-schema/type-bypass-no-gen.json new file mode 100644 index 0000000000..4feae3719c --- /dev/null +++ b/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/tests/qapi-schema/type-bypass-no-gen.out b/tests/qapi-schema/type-bypass-no-gen.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/type-bypass-no-gen.out diff --git a/tests/qapi-schema/type-bypass.err b/tests/qapi-schema/type-bypass.err new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/type-bypass.err diff --git a/tests/qapi-schema/type-bypass.exit b/tests/qapi-schema/type-bypass.exit new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/qapi-schema/type-bypass.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/type-bypass.json b/tests/qapi-schema/type-bypass.json new file mode 100644 index 0000000000..48b2137833 --- /dev/null +++ b/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/tests/qapi-schema/type-bypass.out b/tests/qapi-schema/type-bypass.out new file mode 100644 index 0000000000..eaf20f8344 --- /dev/null +++ b/tests/qapi-schema/type-bypass.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'unsafe'), ('data', OrderedDict([('arg', '**')])), ('returns', '**'), ('gen', False)])] +[] +[] diff --git a/tests/qapi-schema/unicode-str.err b/tests/qapi-schema/unicode-str.err new file mode 100644 index 0000000000..f621cd6448 --- /dev/null +++ b/tests/qapi-schema/unicode-str.err @@ -0,0 +1 @@ +tests/qapi-schema/unicode-str.json:2: 'command' uses invalid name 'é' diff --git a/tests/qapi-schema/unicode-str.exit b/tests/qapi-schema/unicode-str.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/unicode-str.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/unicode-str.json b/tests/qapi-schema/unicode-str.json new file mode 100644 index 0000000000..5253a1b9f3 --- /dev/null +++ b/tests/qapi-schema/unicode-str.json @@ -0,0 +1,2 @@ +# we don't support full Unicode strings, yet +{ 'command': 'é' } diff --git a/tests/qapi-schema/unicode-str.out b/tests/qapi-schema/unicode-str.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/unicode-str.out diff --git a/tests/qapi-schema/union-bad-branch.err b/tests/qapi-schema/union-bad-branch.err new file mode 100644 index 0000000000..8822735561 --- /dev/null +++ b/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/tests/qapi-schema/union-bad-branch.exit b/tests/qapi-schema/union-bad-branch.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/union-bad-branch.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/union-bad-branch.json b/tests/qapi-schema/union-bad-branch.json new file mode 100644 index 0000000000..913aa38bc8 --- /dev/null +++ b/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/tests/qapi-schema/union-bad-branch.out b/tests/qapi-schema/union-bad-branch.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/union-bad-branch.out diff --git a/tests/qapi-schema/union-base-no-discriminator.err b/tests/qapi-schema/union-base-no-discriminator.err new file mode 100644 index 0000000000..fc8b79c459 --- /dev/null +++ b/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/tests/qapi-schema/union-base-no-discriminator.exit b/tests/qapi-schema/union-base-no-discriminator.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/union-base-no-discriminator.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/union-base-no-discriminator.json b/tests/qapi-schema/union-base-no-discriminator.json new file mode 100644 index 0000000000..1409cf5c9e --- /dev/null +++ b/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/tests/qapi-schema/union-base-no-discriminator.out b/tests/qapi-schema/union-base-no-discriminator.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/union-base-no-discriminator.out diff --git a/tests/qapi-schema/union-invalid-base.err b/tests/qapi-schema/union-invalid-base.err index 938f96962b..9f637963e8 100644 --- a/tests/qapi-schema/union-invalid-base.err +++ b/tests/qapi-schema/union-invalid-base.err @@ -1 +1 @@ -tests/qapi-schema/union-invalid-base.json:7: Base 'TestBaseWrong' is not a valid type +tests/qapi-schema/union-invalid-base.json:8: Base 'int' is not a valid struct diff --git a/tests/qapi-schema/union-invalid-base.json b/tests/qapi-schema/union-invalid-base.json index 1fa4930010..92be39df69 100644 --- a/tests/qapi-schema/union-invalid-base.json +++ b/tests/qapi-schema/union-invalid-base.json @@ -1,10 +1,12 @@ -{ 'type': 'TestTypeA', +# a union base type must be a struct +{ 'struct': 'TestTypeA', 'data': { 'string': 'str' } } -{ 'type': 'TestTypeB', +{ 'struct': 'TestTypeB', 'data': { 'integer': 'int' } } { 'union': 'TestUnion', - 'base': 'TestBaseWrong', + 'base': 'int', + 'discriminator': 'int', 'data': { 'value1': 'TestTypeA', 'value2': 'TestTypeB' } } diff --git a/tests/qapi-schema/union-max.err b/tests/qapi-schema/union-max.err new file mode 100644 index 0000000000..55ce4399d6 --- /dev/null +++ b/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/tests/qapi-schema/union-max.exit b/tests/qapi-schema/union-max.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/union-max.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/union-max.json b/tests/qapi-schema/union-max.json new file mode 100644 index 0000000000..d6ad986999 --- /dev/null +++ b/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/tests/qapi-schema/union-max.out b/tests/qapi-schema/union-max.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/union-max.out diff --git a/tests/qapi-schema/union-optional-branch.err b/tests/qapi-schema/union-optional-branch.err new file mode 100644 index 0000000000..3ada1334dc --- /dev/null +++ b/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/tests/qapi-schema/union-optional-branch.exit b/tests/qapi-schema/union-optional-branch.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/union-optional-branch.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/union-optional-branch.json b/tests/qapi-schema/union-optional-branch.json new file mode 100644 index 0000000000..591615fc68 --- /dev/null +++ b/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/tests/qapi-schema/union-optional-branch.out b/tests/qapi-schema/union-optional-branch.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/union-optional-branch.out diff --git a/tests/qapi-schema/union-unknown.err b/tests/qapi-schema/union-unknown.err new file mode 100644 index 0000000000..54fe456f9c --- /dev/null +++ b/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/tests/qapi-schema/union-unknown.exit b/tests/qapi-schema/union-unknown.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/union-unknown.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/union-unknown.json b/tests/qapi-schema/union-unknown.json new file mode 100644 index 0000000000..aa7e8143d8 --- /dev/null +++ b/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/tests/qapi-schema/union-unknown.out b/tests/qapi-schema/union-unknown.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/union-unknown.out diff --git a/tests/qapi-schema/unknown-escape.err b/tests/qapi-schema/unknown-escape.err new file mode 100644 index 0000000000..000e30ddf3 --- /dev/null +++ b/tests/qapi-schema/unknown-escape.err @@ -0,0 +1 @@ +tests/qapi-schema/unknown-escape.json:3:21: Unknown escape \x diff --git a/tests/qapi-schema/unknown-escape.exit b/tests/qapi-schema/unknown-escape.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/unknown-escape.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/unknown-escape.json b/tests/qapi-schema/unknown-escape.json new file mode 100644 index 0000000000..8e6891e52a --- /dev/null +++ b/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/tests/qapi-schema/unknown-escape.out b/tests/qapi-schema/unknown-escape.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/unknown-escape.out diff --git a/tests/qapi-schema/unknown-expr-key.err b/tests/qapi-schema/unknown-expr-key.err new file mode 100644 index 0000000000..12f5ed5b43 --- /dev/null +++ b/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/tests/qapi-schema/unknown-expr-key.exit b/tests/qapi-schema/unknown-expr-key.exit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/qapi-schema/unknown-expr-key.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/unknown-expr-key.json b/tests/qapi-schema/unknown-expr-key.json new file mode 100644 index 0000000000..3b2be00cc4 --- /dev/null +++ b/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/tests/qapi-schema/unknown-expr-key.out b/tests/qapi-schema/unknown-expr-key.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/unknown-expr-key.out |