aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-04-30 16:02:00 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-04-30 16:02:00 +0100
commit8f860d2633baf9c2b6261f703f86e394c6bc22ca (patch)
treec030a1573785ee9ba9e5860aaca87ecb3e83e07d /tests
parentf38d1ea49711232651a817ec9d04c9d9e4816c44 (diff)
parentb54626e0b8f423e91b2e31fa7741e4954cebd2d6 (diff)
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-04-30' into staging
QAPI patches patches for 2021-04-30 # gpg: Signature made Fri 30 Apr 2021 12:42:32 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2021-04-30: (25 commits) qapi/error.py: enable mypy checks qapi/error: Add type hints qapi/error.py: enable pylint checks qapi/error.py: move QAPIParseError to parser.py qapi/error: assert QAPISourceInfo is not None qapi/error: Make QAPISourceError 'col' parameter optional qapi/error: Use Python3-style super() qapi/error: Repurpose QAPIError as an abstract base exception class qapi/expr: Update authorship and copyright information qapi/expr.py: Use tuples instead of lists for static data qapi/expr.py: Add docstrings qapi/expr: Only explicitly prohibit 'Kind' nor 'List' for type names qapi/expr.py: enable pylint checks qapi/expr.py: Remove single-letter variable qapi/expr.py: Consolidate check_if_str calls in check_if qapi/expr.py: add type hint annotations qapi/expr.py: Modify check_keys to accept any Collection qapi/expr.py: Add casts in a few select cases qapi/expr.py: Check type of union and alternate 'data' member qapi/expr.py: move string check upwards in check_type ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qapi-schema/alternate-data-invalid.err2
-rw-r--r--tests/qapi-schema/alternate-data-invalid.json4
-rw-r--r--tests/qapi-schema/alternate-data-invalid.out0
-rw-r--r--tests/qapi-schema/meson.build2
-rw-r--r--tests/qapi-schema/union-invalid-data.err2
-rw-r--r--tests/qapi-schema/union-invalid-data.json6
-rw-r--r--tests/qapi-schema/union-invalid-data.out0
7 files changed, 16 insertions, 0 deletions
diff --git a/tests/qapi-schema/alternate-data-invalid.err b/tests/qapi-schema/alternate-data-invalid.err
new file mode 100644
index 0000000000..55f1033aef
--- /dev/null
+++ b/tests/qapi-schema/alternate-data-invalid.err
@@ -0,0 +1,2 @@
+alternate-data-invalid.json: In alternate 'Alt':
+alternate-data-invalid.json:2: 'data' must be an object
diff --git a/tests/qapi-schema/alternate-data-invalid.json b/tests/qapi-schema/alternate-data-invalid.json
new file mode 100644
index 0000000000..7d5d905581
--- /dev/null
+++ b/tests/qapi-schema/alternate-data-invalid.json
@@ -0,0 +1,4 @@
+# Alternate type requires an object for 'data'
+{ 'alternate': 'Alt',
+ 'data': ['rubbish', 'nonsense']
+}
diff --git a/tests/qapi-schema/alternate-data-invalid.out b/tests/qapi-schema/alternate-data-invalid.out
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/qapi-schema/alternate-data-invalid.out
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
index 8ba6917132..d7163e6601 100644
--- a/tests/qapi-schema/meson.build
+++ b/tests/qapi-schema/meson.build
@@ -14,6 +14,7 @@ schemas = [
'alternate-conflict-string.json',
'alternate-conflict-bool-string.json',
'alternate-conflict-num-string.json',
+ 'alternate-data-invalid.json',
'alternate-empty.json',
'alternate-invalid-dict.json',
'alternate-nested.json',
@@ -192,6 +193,7 @@ schemas = [
'union-clash-branches.json',
'union-empty.json',
'union-invalid-base.json',
+ 'union-invalid-data.json',
'union-optional-branch.json',
'union-unknown.json',
'unknown-escape.json',
diff --git a/tests/qapi-schema/union-invalid-data.err b/tests/qapi-schema/union-invalid-data.err
new file mode 100644
index 0000000000..e26cf769a3
--- /dev/null
+++ b/tests/qapi-schema/union-invalid-data.err
@@ -0,0 +1,2 @@
+union-invalid-data.json: In union 'TestUnion':
+union-invalid-data.json:2: 'data' must be an object
diff --git a/tests/qapi-schema/union-invalid-data.json b/tests/qapi-schema/union-invalid-data.json
new file mode 100644
index 0000000000..395ba24d39
--- /dev/null
+++ b/tests/qapi-schema/union-invalid-data.json
@@ -0,0 +1,6 @@
+# the union data type must be an object.
+{ 'union': 'TestUnion',
+ 'base': 'int',
+ 'discriminator': 'int',
+ 'data': ['rubbish', 'nonsense']
+}
diff --git a/tests/qapi-schema/union-invalid-data.out b/tests/qapi-schema/union-invalid-data.out
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/qapi-schema/union-invalid-data.out