aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-05-19 14:39:38 -0400
committerMarkus Armbruster <armbru@redhat.com>2021-05-20 11:28:27 +0200
commit334c3cd58a202d082703a1ae175b4230f4157f65 (patch)
tree92b0f44b9e88e91ac31f2e66c1231e745d3e1aa3 /tests/qapi-schema
parent3404e57410b80734e6961b6574d6683d9c3d9c14 (diff)
downloadqemu-334c3cd58a202d082703a1ae175b4230f4157f65.zip
qemu-334c3cd58a202d082703a1ae175b4230f4157f65.tar.gz
qemu-334c3cd58a202d082703a1ae175b4230f4157f65.tar.bz2
qapi: Add test for nonexistent schema file
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> Message-Id: <20210519183951.3946870-3-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema')
-rw-r--r--tests/qapi-schema/meson.build7
-rw-r--r--tests/qapi-schema/missing-schema.err1
-rw-r--r--tests/qapi-schema/missing-schema.out0
3 files changed, 7 insertions, 1 deletions
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
index d7163e6..dc448e8 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 0000000..b4d9ff1
--- /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 0000000..e69de29
--- /dev/null
+++ b/tests/qapi-schema/missing-schema.out