[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/11] tests/qapi-schema: Error case tests for featur
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 07/11] tests/qapi-schema: Error case tests for features in structs |
Date: |
Wed, 12 Jun 2019 18:52:25 +0200 |
From: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/Makefile.include | 6 ++++++
tests/qapi-schema/features-bad-type.err | 1 +
tests/qapi-schema/features-bad-type.exit | 1 +
tests/qapi-schema/features-bad-type.json | 3 +++
tests/qapi-schema/features-bad-type.out | 0
tests/qapi-schema/features-duplicate-name.err | 1 +
tests/qapi-schema/features-duplicate-name.exit | 1 +
tests/qapi-schema/features-duplicate-name.json | 3 +++
tests/qapi-schema/features-duplicate-name.out | 0
tests/qapi-schema/features-missing-name.err | 1 +
tests/qapi-schema/features-missing-name.exit | 1 +
tests/qapi-schema/features-missing-name.json | 3 +++
tests/qapi-schema/features-missing-name.out | 0
tests/qapi-schema/features-name-bad-type.err | 1 +
tests/qapi-schema/features-name-bad-type.exit | 1 +
tests/qapi-schema/features-name-bad-type.json | 3 +++
tests/qapi-schema/features-name-bad-type.out | 0
tests/qapi-schema/features-no-list.err | 1 +
tests/qapi-schema/features-no-list.exit | 1 +
tests/qapi-schema/features-no-list.json | 3 +++
tests/qapi-schema/features-no-list.out | 0
tests/qapi-schema/features-unknown-key.err | 2 ++
tests/qapi-schema/features-unknown-key.exit | 1 +
tests/qapi-schema/features-unknown-key.json | 3 +++
tests/qapi-schema/features-unknown-key.out | 0
25 files changed, 37 insertions(+)
create mode 100644 tests/qapi-schema/features-bad-type.err
create mode 100644 tests/qapi-schema/features-bad-type.exit
create mode 100644 tests/qapi-schema/features-bad-type.json
create mode 100644 tests/qapi-schema/features-bad-type.out
create mode 100644 tests/qapi-schema/features-duplicate-name.err
create mode 100644 tests/qapi-schema/features-duplicate-name.exit
create mode 100644 tests/qapi-schema/features-duplicate-name.json
create mode 100644 tests/qapi-schema/features-duplicate-name.out
create mode 100644 tests/qapi-schema/features-missing-name.err
create mode 100644 tests/qapi-schema/features-missing-name.exit
create mode 100644 tests/qapi-schema/features-missing-name.json
create mode 100644 tests/qapi-schema/features-missing-name.out
create mode 100644 tests/qapi-schema/features-name-bad-type.err
create mode 100644 tests/qapi-schema/features-name-bad-type.exit
create mode 100644 tests/qapi-schema/features-name-bad-type.json
create mode 100644 tests/qapi-schema/features-name-bad-type.out
create mode 100644 tests/qapi-schema/features-no-list.err
create mode 100644 tests/qapi-schema/features-no-list.exit
create mode 100644 tests/qapi-schema/features-no-list.json
create mode 100644 tests/qapi-schema/features-no-list.out
create mode 100644 tests/qapi-schema/features-unknown-key.err
create mode 100644 tests/qapi-schema/features-unknown-key.exit
create mode 100644 tests/qapi-schema/features-unknown-key.json
create mode 100644 tests/qapi-schema/features-unknown-key.out
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 0cd5f465b7..db750dd6d0 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -378,6 +378,12 @@ qapi-schema += event-boxed-empty.json
qapi-schema += event-case.json
qapi-schema += event-member-invalid-dict.json
qapi-schema += event-nest-struct.json
+qapi-schema += features-bad-type.json
+qapi-schema += features-duplicate-name.json
+qapi-schema += features-missing-name.json
+qapi-schema += features-name-bad-type.json
+qapi-schema += features-no-list.json
+qapi-schema += features-unknown-key.json
qapi-schema += flat-union-array-branch.json
qapi-schema += flat-union-bad-base.json
qapi-schema += flat-union-bad-discriminator.json
diff --git a/tests/qapi-schema/features-bad-type.err
b/tests/qapi-schema/features-bad-type.err
new file mode 100644
index 0000000000..5fb95c2f90
--- /dev/null
+++ b/tests/qapi-schema/features-bad-type.err
@@ -0,0 +1 @@
+tests/qapi-schema/features-bad-type.json:1: Feature of struct FeatureStruct0
requires a string name
diff --git a/tests/qapi-schema/features-bad-type.exit
b/tests/qapi-schema/features-bad-type.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/features-bad-type.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/features-bad-type.json
b/tests/qapi-schema/features-bad-type.json
new file mode 100644
index 0000000000..57db5540e7
--- /dev/null
+++ b/tests/qapi-schema/features-bad-type.json
@@ -0,0 +1,3 @@
+{ 'struct': 'FeatureStruct0',
+ 'data': { 'foo': 'int' },
+ 'features': [ [ 'a feature cannot be an array' ] ] }
diff --git a/tests/qapi-schema/features-bad-type.out
b/tests/qapi-schema/features-bad-type.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/features-duplicate-name.err
b/tests/qapi-schema/features-duplicate-name.err
new file mode 100644
index 0000000000..c0a4cccae6
--- /dev/null
+++ b/tests/qapi-schema/features-duplicate-name.err
@@ -0,0 +1 @@
+tests/qapi-schema/features-duplicate-name.json:1: 'foo' (feature of
FeatureStruct0) collides with 'foo' (feature of FeatureStruct0)
diff --git a/tests/qapi-schema/features-duplicate-name.exit
b/tests/qapi-schema/features-duplicate-name.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/features-duplicate-name.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/features-duplicate-name.json
b/tests/qapi-schema/features-duplicate-name.json
new file mode 100644
index 0000000000..29358e6220
--- /dev/null
+++ b/tests/qapi-schema/features-duplicate-name.json
@@ -0,0 +1,3 @@
+{ 'struct': 'FeatureStruct0',
+ 'data': { 'foo': 'int' },
+ 'features': [ 'foo', 'bar', 'foo' ] }
diff --git a/tests/qapi-schema/features-duplicate-name.out
b/tests/qapi-schema/features-duplicate-name.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/features-missing-name.err
b/tests/qapi-schema/features-missing-name.err
new file mode 100644
index 0000000000..4f1d2715aa
--- /dev/null
+++ b/tests/qapi-schema/features-missing-name.err
@@ -0,0 +1 @@
+tests/qapi-schema/features-missing-name.json:1: Key 'name' is missing from
feature of struct FeatureStruct0
diff --git a/tests/qapi-schema/features-missing-name.exit
b/tests/qapi-schema/features-missing-name.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/features-missing-name.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/features-missing-name.json
b/tests/qapi-schema/features-missing-name.json
new file mode 100644
index 0000000000..2314f97c00
--- /dev/null
+++ b/tests/qapi-schema/features-missing-name.json
@@ -0,0 +1,3 @@
+{ 'struct': 'FeatureStruct0',
+ 'data': { 'foo': 'int' },
+ 'features': [ { 'if': 'defined(NAMELESS_FEATURES)' } ] }
diff --git a/tests/qapi-schema/features-missing-name.out
b/tests/qapi-schema/features-missing-name.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/features-name-bad-type.err
b/tests/qapi-schema/features-name-bad-type.err
new file mode 100644
index 0000000000..8a3eecb972
--- /dev/null
+++ b/tests/qapi-schema/features-name-bad-type.err
@@ -0,0 +1 @@
+tests/qapi-schema/features-name-bad-type.json:1: Feature of struct
FeatureStruct0 requires a string name
diff --git a/tests/qapi-schema/features-name-bad-type.exit
b/tests/qapi-schema/features-name-bad-type.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/features-name-bad-type.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/features-name-bad-type.json
b/tests/qapi-schema/features-name-bad-type.json
new file mode 100644
index 0000000000..b07139978a
--- /dev/null
+++ b/tests/qapi-schema/features-name-bad-type.json
@@ -0,0 +1,3 @@
+{ 'struct': 'FeatureStruct0',
+ 'data': { 'foo': 'int' },
+ 'features': [ { 'name': { 'feature-type': 'object' } } ] }
diff --git a/tests/qapi-schema/features-name-bad-type.out
b/tests/qapi-schema/features-name-bad-type.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/features-no-list.err
b/tests/qapi-schema/features-no-list.err
new file mode 100644
index 0000000000..61ed68612b
--- /dev/null
+++ b/tests/qapi-schema/features-no-list.err
@@ -0,0 +1 @@
+tests/qapi-schema/features-no-list.json:1: Struct 'FeatureStruct0' requires an
array for 'features'
diff --git a/tests/qapi-schema/features-no-list.exit
b/tests/qapi-schema/features-no-list.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/features-no-list.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/features-no-list.json
b/tests/qapi-schema/features-no-list.json
new file mode 100644
index 0000000000..9484fd94fc
--- /dev/null
+++ b/tests/qapi-schema/features-no-list.json
@@ -0,0 +1,3 @@
+{ 'struct': 'FeatureStruct0',
+ 'data': { 'foo': 'int' },
+ 'features': 'bar' }
diff --git a/tests/qapi-schema/features-no-list.out
b/tests/qapi-schema/features-no-list.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/features-unknown-key.err
b/tests/qapi-schema/features-unknown-key.err
new file mode 100644
index 0000000000..a1d693030d
--- /dev/null
+++ b/tests/qapi-schema/features-unknown-key.err
@@ -0,0 +1,2 @@
+tests/qapi-schema/features-unknown-key.json:1: Unknown key 'colour' in feature
of struct FeatureStruct0
+Valid keys are 'if', 'name'.
diff --git a/tests/qapi-schema/features-unknown-key.exit
b/tests/qapi-schema/features-unknown-key.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/features-unknown-key.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/features-unknown-key.json
b/tests/qapi-schema/features-unknown-key.json
new file mode 100644
index 0000000000..134df3b503
--- /dev/null
+++ b/tests/qapi-schema/features-unknown-key.json
@@ -0,0 +1,3 @@
+{ 'struct': 'FeatureStruct0',
+ 'data': { 'foo': 'int' },
+ 'features': [ { 'name': 'bar', 'colour': 'red' } ] }
diff --git a/tests/qapi-schema/features-unknown-key.out
b/tests/qapi-schema/features-unknown-key.out
new file mode 100644
index 0000000000..e69de29bb2
--
2.21.0
- [Qemu-devel] [PULL 00/11] QAPI patches for 2019-06-12, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 01/11] qdev: Delete unused LostTickPolicy "merge", Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 02/11] qapi/block-core: update documentation of preallocation parameter, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 08/11] qapi: Disentangle QAPIDoc code, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 06/11] tests/qapi-schema: Test for good feature lists in structs, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 04/11] block/gluster: update .help of BLOCK_OPT_PREALLOC option, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 10/11] file-posix: Add dynamic-auto-read-only QAPI feature, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 11/11] qapi: Simplify how QAPIDoc implements its state machine, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 07/11] tests/qapi-schema: Error case tests for features in structs,
Markus Armbruster <=
- [Qemu-devel] [PULL 09/11] qapi: Allow documentation for features, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 03/11] block/file-posix: update .help of BLOCK_OPT_PREALLOC option, Markus Armbruster, 2019/06/12
- [Qemu-devel] [PULL 05/11] qapi: Add feature flags to struct types, Markus Armbruster, 2019/06/12
- Re: [Qemu-devel] [PULL 00/11] QAPI patches for 2019-06-12, Peter Maydell, 2019/06/13