diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-05-20 20:17:55 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-05-20 20:17:55 +0100 |
commit | 0b5acf89c1b197fc8f36db0896f652a4c577352f (patch) | |
tree | 6d2404d7a8f30c97f44d44c031c4793f06535758 /tests | |
parent | 972e848b53970d12cb2ca64687ef8ff797fb6236 (diff) | |
parent | d4092ffa2604e07b2e1bb5b1f7b2651bc1edda80 (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-05-20' into staging
QAPI patches patches for 2021-05-20
# gpg: Signature made Thu 20 May 2021 16:10:21 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-05-20:
qapi/parser: add docstrings
qapi/parser: allow 'ch' variable name
qapi/parser: Remove superfluous list comprehension
qapi/parser: add type hint annotations
qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard
qapi/parser: Fix token membership tests when token can be None
qapi: add must_match helper
qapi/parser: Use @staticmethod where appropriate
qapi/parser: assert object keys are strings
qapi/parser: enforce all top-level expressions must be dict in _parse()
qapi/parser: Assert lexer value is a string
qapi/parser: factor parsing routine into method
qapi/source: Remove line number from QAPISourceInfo initializer
qapi: Add test for nonexistent schema file
qapi/parser: Don't try to handle file errors
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qapi-schema/meson.build | 9 | ||||
-rw-r--r-- | tests/qapi-schema/missing-array-rsqb.err | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-array-rsqb.json | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-array-rsqb.out | 0 | ||||
-rw-r--r-- | tests/qapi-schema/missing-object-member-element.err | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-object-member-element.json | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-object-member-element.out | 0 | ||||
-rw-r--r-- | tests/qapi-schema/missing-schema.err | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-schema.out | 0 | ||||
-rw-r--r-- | tests/qapi-schema/non-objects.err | 2 | ||||
-rw-r--r-- | tests/qapi-schema/quoted-structural-chars.err | 2 | ||||
-rwxr-xr-x | tests/qapi-schema/test-qapi.py | 3 |
12 files changed, 15 insertions, 6 deletions
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build index d7163e6601..9e8f658ce3 100644 --- a/tests/qapi-schema/meson.build +++ b/tests/qapi-schema/meson.build @@ -134,9 +134,11 @@ schemas = [ 'indented-expr.json', 'leading-comma-list.json', 'leading-comma-object.json', + 'missing-array-rsqb.json', 'missing-colon.json', 'missing-comma-list.json', 'missing-comma-object.json', + 'missing-object-member-element.json', 'missing-type.json', 'nested-struct-data.json', 'nested-struct-data-invalid-dict.json', @@ -199,11 +201,16 @@ schemas = [ 'unknown-escape.json', 'unknown-expr-key.json', ] +schemas = files(schemas) + +# Intentionally missing schema file test -- not passed through files(): +schemas += [meson.current_source_dir() / 'missing-schema.json'] # Because people may want to use test-qapi.py from the command line, we # are not using the "#! /usr/bin/env python3" trick here. See # docs/devel/build-system.txt -test('QAPI schema regression tests', python, args: files('test-qapi.py', schemas), +test('QAPI schema regression tests', python, + args: files('test-qapi.py') + schemas, env: test_env, suite: ['qapi-schema', 'qapi-frontend']) diff = find_program('diff') diff --git a/tests/qapi-schema/missing-array-rsqb.err b/tests/qapi-schema/missing-array-rsqb.err new file mode 100644 index 0000000000..b5f58b8c12 --- /dev/null +++ b/tests/qapi-schema/missing-array-rsqb.err @@ -0,0 +1 @@ +missing-array-rsqb.json:1:44: expected '{', '[', string, or boolean diff --git a/tests/qapi-schema/missing-array-rsqb.json b/tests/qapi-schema/missing-array-rsqb.json new file mode 100644 index 0000000000..7fca1df923 --- /dev/null +++ b/tests/qapi-schema/missing-array-rsqb.json @@ -0,0 +1 @@ +['Daisy,', 'Daisy,', 'Give me your answer', diff --git a/tests/qapi-schema/missing-array-rsqb.out b/tests/qapi-schema/missing-array-rsqb.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/missing-array-rsqb.out diff --git a/tests/qapi-schema/missing-object-member-element.err b/tests/qapi-schema/missing-object-member-element.err new file mode 100644 index 0000000000..c08a3dc307 --- /dev/null +++ b/tests/qapi-schema/missing-object-member-element.err @@ -0,0 +1 @@ +missing-object-member-element.json:1:8: expected '{', '[', string, or boolean diff --git a/tests/qapi-schema/missing-object-member-element.json b/tests/qapi-schema/missing-object-member-element.json new file mode 100644 index 0000000000..f52d0106f3 --- /dev/null +++ b/tests/qapi-schema/missing-object-member-element.json @@ -0,0 +1 @@ +{'key': diff --git a/tests/qapi-schema/missing-object-member-element.out b/tests/qapi-schema/missing-object-member-element.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/missing-object-member-element.out diff --git a/tests/qapi-schema/missing-schema.err b/tests/qapi-schema/missing-schema.err new file mode 100644 index 0000000000..b4d9ff1fb2 --- /dev/null +++ b/tests/qapi-schema/missing-schema.err @@ -0,0 +1 @@ +can't read schema file 'missing-schema.json': No such file or directory diff --git a/tests/qapi-schema/missing-schema.out b/tests/qapi-schema/missing-schema.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/missing-schema.out diff --git a/tests/qapi-schema/non-objects.err b/tests/qapi-schema/non-objects.err index 3a4ea36966..23bdb69c71 100644 --- a/tests/qapi-schema/non-objects.err +++ b/tests/qapi-schema/non-objects.err @@ -1 +1 @@ -non-objects.json:1:1: expected '{' +non-objects.json:1: top-level expression must be an object diff --git a/tests/qapi-schema/quoted-structural-chars.err b/tests/qapi-schema/quoted-structural-chars.err index 07d1561d1f..af6c1e173d 100644 --- a/tests/qapi-schema/quoted-structural-chars.err +++ b/tests/qapi-schema/quoted-structural-chars.err @@ -1 +1 @@ -quoted-structural-chars.json:1:1: expected '{' +quoted-structural-chars.json:1: top-level expression must be an object diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py index e8db9d09d9..f1c4deb9a5 100755 --- a/tests/qapi-schema/test-qapi.py +++ b/tests/qapi-schema/test-qapi.py @@ -128,9 +128,6 @@ def test_and_diff(test_name, dir_name, update): try: test_frontend(os.path.join(dir_name, test_name + '.json')) except QAPIError as err: - if err.info.fname is None: - print("%s" % err, file=sys.stderr) - return 2 errstr = str(err) + '\n' if dir_name: errstr = errstr.replace(dir_name + '/', '') |