[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 02/15] qapi: Add test for nonexistent schema file
From: |
John Snow |
Subject: |
[PATCH v3 02/15] qapi: Add test for nonexistent schema file |
Date: |
Wed, 19 May 2021 14:39:38 -0400 |
This tests the error-return pathway introduced in the previous commit.
(Thanks to Paolo for the help with the Meson magic.)
Signed-off-by: John Snow <jsnow@redhat.com>
---
This went after the previous patch instead of before because prior to
removing the sys.argv[0] bit from QAPISourceInfo, I can't filter the
test to pass the diff. Instead of writing something new to get a better
patch ordering, just add the test after.
Signed-off-by: John Snow <jsnow@redhat.com>
---
tests/qapi-schema/meson.build | 7 ++++++-
tests/qapi-schema/missing-schema.err | 1 +
tests/qapi-schema/missing-schema.out | 0
3 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 tests/qapi-schema/missing-schema.err
create mode 100644 tests/qapi-schema/missing-schema.out
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
index d7163e6601c..dc448e8f74d 100644
--- a/tests/qapi-schema/meson.build
+++ b/tests/qapi-schema/meson.build
@@ -199,11 +199,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-schema.err
b/tests/qapi-schema/missing-schema.err
new file mode 100644
index 00000000000..b4d9ff1fb2b
--- /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 00000000000..e69de29bb2d
--
2.30.2
- [PATCH v3 00/15] qapi: static typing conversion, pt5a, John Snow, 2021/05/19
- [PATCH v3 05/15] qapi/parser: Assert lexer value is a string, John Snow, 2021/05/19
- [PATCH v3 01/15] qapi/parser: Don't try to handle file errors, John Snow, 2021/05/19
- [PATCH v3 07/15] qapi/parser: assert object keys are strings, John Snow, 2021/05/19
- [PATCH v3 15/15] qapi/parser: add docstrings, John Snow, 2021/05/19
- [PATCH v3 02/15] qapi: Add test for nonexistent schema file,
John Snow <=
- [PATCH v3 04/15] qapi/parser: factor parsing routine into method, John Snow, 2021/05/19
- [PATCH v3 03/15] qapi/source: Remove line number from QAPISourceInfo initializer, John Snow, 2021/05/19
- [PATCH v3 11/15] qapi/parser: Rework _check_pragma_list_of_str as a TypeGuard, John Snow, 2021/05/19
- [PATCH v3 10/15] qapi/parser: Fix token membership tests when token can be None, John Snow, 2021/05/19
- [PATCH v3 14/15] qapi/parser: allow 'ch' variable name, John Snow, 2021/05/19
- [PATCH v3 09/15] qapi: add must_match helper, John Snow, 2021/05/19
- [PATCH v3 08/15] qapi/parser: Use @staticmethod where appropriate, John Snow, 2021/05/19
- [PATCH v3 06/15] qapi/parser: enforce all top-level expressions must be dict in _parse(), John Snow, 2021/05/19