aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-09-14 17:34:59 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-09-24 14:07:23 +0200
commitdec0012ef8d644b5dde1b68ee8dab3f8c12e0b6b (patch)
tree61c6ab6e7f0576311d94783c99045f117c73e14f /tests/qapi-schema
parentc2c7065e1752a3be1b437d1ea359cde35d28ee3b (diff)
downloadqemu-dec0012ef8d644b5dde1b68ee8dab3f8c12e0b6b.zip
qemu-dec0012ef8d644b5dde1b68ee8dab3f8c12e0b6b.tar.gz
qemu-dec0012ef8d644b5dde1b68ee8dab3f8c12e0b6b.tar.bz2
qapi: Fix missing 'if' checks in struct, union, alternate 'data'
Commit 87adbbffd4..3e270dcacc "qapi: Add 'if' to (implicit struct|union|alternate) members" (v4.0.0) neglected test coverage, and promptly failed to check the conditions. Review fail. Recent commit "tests/qapi-schema: Demonstrate insufficient 'if' checking" added test coverage, demonstrating the bug. Fix it by add the missing check_if(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190914153506.2151-13-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qapi-schema')
-rw-r--r--tests/qapi-schema/alternate-branch-if-invalid.err1
-rw-r--r--tests/qapi-schema/alternate-branch-if-invalid.exit2
-rw-r--r--tests/qapi-schema/alternate-branch-if-invalid.json1
-rw-r--r--tests/qapi-schema/alternate-branch-if-invalid.out16
-rw-r--r--tests/qapi-schema/struct-member-if-invalid.err1
-rw-r--r--tests/qapi-schema/struct-member-if-invalid.exit2
-rw-r--r--tests/qapi-schema/struct-member-if-invalid.json1
-rw-r--r--tests/qapi-schema/struct-member-if-invalid.out15
-rw-r--r--tests/qapi-schema/union-branch-if-invalid.err1
-rw-r--r--tests/qapi-schema/union-branch-if-invalid.exit2
-rw-r--r--tests/qapi-schema/union-branch-if-invalid.json1
-rw-r--r--tests/qapi-schema/union-branch-if-invalid.out23
12 files changed, 6 insertions, 60 deletions
diff --git a/tests/qapi-schema/alternate-branch-if-invalid.err b/tests/qapi-schema/alternate-branch-if-invalid.err
index e69de29..f1d6c10 100644
--- a/tests/qapi-schema/alternate-branch-if-invalid.err
+++ b/tests/qapi-schema/alternate-branch-if-invalid.err
@@ -0,0 +1 @@
+tests/qapi-schema/alternate-branch-if-invalid.json:2: 'if' condition ' ' makes no sense
diff --git a/tests/qapi-schema/alternate-branch-if-invalid.exit b/tests/qapi-schema/alternate-branch-if-invalid.exit
index 573541a..d00491f 100644
--- a/tests/qapi-schema/alternate-branch-if-invalid.exit
+++ b/tests/qapi-schema/alternate-branch-if-invalid.exit
@@ -1 +1 @@
-0
+1
diff --git a/tests/qapi-schema/alternate-branch-if-invalid.json b/tests/qapi-schema/alternate-branch-if-invalid.json
index 6497f53..fea6d90 100644
--- a/tests/qapi-schema/alternate-branch-if-invalid.json
+++ b/tests/qapi-schema/alternate-branch-if-invalid.json
@@ -1,4 +1,3 @@
# Cover alternative with invalid 'if'
-# FIXME not rejected, would generate '#if \n'
{ 'alternate': 'Alt',
'data': { 'branch': { 'type': 'int', 'if': ' ' } } }
diff --git a/tests/qapi-schema/alternate-branch-if-invalid.out b/tests/qapi-schema/alternate-branch-if-invalid.out
index 89305d7..e69de29 100644
--- a/tests/qapi-schema/alternate-branch-if-invalid.out
+++ b/tests/qapi-schema/alternate-branch-if-invalid.out
@@ -1,16 +0,0 @@
-module None
-object q_empty
-enum QType
- prefix QTYPE
- member none
- member qnull
- member qnum
- member qstring
- member qdict
- member qlist
- member qbool
-module alternate-branch-if-invalid.json
-alternate Alt
- tag type
- case branch: int
- if [' ']
diff --git a/tests/qapi-schema/struct-member-if-invalid.err b/tests/qapi-schema/struct-member-if-invalid.err
index e69de29..bfd65db 100644
--- a/tests/qapi-schema/struct-member-if-invalid.err
+++ b/tests/qapi-schema/struct-member-if-invalid.err
@@ -0,0 +1 @@
+tests/qapi-schema/struct-member-if-invalid.json:2: 'if' condition must be a string or a list of strings
diff --git a/tests/qapi-schema/struct-member-if-invalid.exit b/tests/qapi-schema/struct-member-if-invalid.exit
index 573541a..d00491f 100644
--- a/tests/qapi-schema/struct-member-if-invalid.exit
+++ b/tests/qapi-schema/struct-member-if-invalid.exit
@@ -1 +1 @@
-0
+1
diff --git a/tests/qapi-schema/struct-member-if-invalid.json b/tests/qapi-schema/struct-member-if-invalid.json
index 73987e0..35078bd 100644
--- a/tests/qapi-schema/struct-member-if-invalid.json
+++ b/tests/qapi-schema/struct-member-if-invalid.json
@@ -1,4 +1,3 @@
# Cover member with invalid 'if'
-# FIXME not rejected, would generate '#if True\n'
{ 'struct': 'Stru',
'data': { 'member': { 'type': 'int', 'if': true } } }
diff --git a/tests/qapi-schema/struct-member-if-invalid.out b/tests/qapi-schema/struct-member-if-invalid.out
index 8fbb979..e69de29 100644
--- a/tests/qapi-schema/struct-member-if-invalid.out
+++ b/tests/qapi-schema/struct-member-if-invalid.out
@@ -1,15 +0,0 @@
-module None
-object q_empty
-enum QType
- prefix QTYPE
- member none
- member qnull
- member qnum
- member qstring
- member qdict
- member qlist
- member qbool
-module struct-member-if-invalid.json
-object Stru
- member member: int optional=False
- if [True]
diff --git a/tests/qapi-schema/union-branch-if-invalid.err b/tests/qapi-schema/union-branch-if-invalid.err
index e69de29..607edee 100644
--- a/tests/qapi-schema/union-branch-if-invalid.err
+++ b/tests/qapi-schema/union-branch-if-invalid.err
@@ -0,0 +1 @@
+tests/qapi-schema/union-branch-if-invalid.json:4: 'if' condition '' makes no sense
diff --git a/tests/qapi-schema/union-branch-if-invalid.exit b/tests/qapi-schema/union-branch-if-invalid.exit
index 573541a..d00491f 100644
--- a/tests/qapi-schema/union-branch-if-invalid.exit
+++ b/tests/qapi-schema/union-branch-if-invalid.exit
@@ -1 +1 @@
-0
+1
diff --git a/tests/qapi-schema/union-branch-if-invalid.json b/tests/qapi-schema/union-branch-if-invalid.json
index 859b63b..46d4239 100644
--- a/tests/qapi-schema/union-branch-if-invalid.json
+++ b/tests/qapi-schema/union-branch-if-invalid.json
@@ -1,5 +1,4 @@
# Cover branch with invalid 'if'
-# FIXME not rejected, would generate '#if \n'
{ 'enum': 'Branches', 'data': ['branch1'] }
{ 'struct': 'Stru', 'data': { 'member': 'str' } }
{ 'union': 'Uni',
diff --git a/tests/qapi-schema/union-branch-if-invalid.out b/tests/qapi-schema/union-branch-if-invalid.out
index 2ed4321..e69de29 100644
--- a/tests/qapi-schema/union-branch-if-invalid.out
+++ b/tests/qapi-schema/union-branch-if-invalid.out
@@ -1,23 +0,0 @@
-module None
-object q_empty
-enum QType
- prefix QTYPE
- member none
- member qnull
- member qnum
- member qstring
- member qdict
- member qlist
- member qbool
-module union-branch-if-invalid.json
-enum Branches
- member branch1
-object Stru
- member member: str optional=False
-object q_obj_Uni-base
- member tag: Branches optional=False
-object Uni
- base q_obj_Uni-base
- tag tag
- case branch1: Stru
- if ['']