summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWenchao Xia <wenchaoqemu@gmail.com>2014-03-04 18:44:32 -0800
committerLuiz Capitulino <lcapitulino@redhat.com>2014-03-11 09:07:41 -0400
commit4b35991a3bd5f9e03333d5b1bd4a7bcf9941aac5 (patch)
tree5b41a70e6d38c54dbc357b60dfef9b643114208a /tests
parentdad1fcab91bf101a02151069036d416367b59c5c (diff)
downloadqemu-4b35991a3bd5f9e03333d5b1bd4a7bcf9941aac5.tar.gz
qapi script: add check for duplicated key
It is bad that same key was specified twice, especially when a union has two branches with same condition. This patch can prevent it. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile3
-rw-r--r--tests/qapi-schema/duplicate-key.err1
-rw-r--r--tests/qapi-schema/duplicate-key.exit1
-rw-r--r--tests/qapi-schema/duplicate-key.json2
-rw-r--r--tests/qapi-schema/duplicate-key.out0
5 files changed, 6 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index b17d41e4e2..dfe06eb1f4 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -142,7 +142,8 @@ check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
missing-comma-object.json non-objects.json \
qapi-schema-test.json quoted-structural-chars.json \
trailing-comma-list.json trailing-comma-object.json \
- unclosed-list.json unclosed-object.json unclosed-string.json)
+ unclosed-list.json unclosed-object.json unclosed-string.json \
+ duplicate-key.json)
GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
diff --git a/tests/qapi-schema/duplicate-key.err b/tests/qapi-schema/duplicate-key.err
new file mode 100644
index 0000000000..0801c6a9bb
--- /dev/null
+++ b/tests/qapi-schema/duplicate-key.err
@@ -0,0 +1 @@
+<stdin>:2:10: Duplicate key "key"
diff --git a/tests/qapi-schema/duplicate-key.exit b/tests/qapi-schema/duplicate-key.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/duplicate-key.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/duplicate-key.json b/tests/qapi-schema/duplicate-key.json
new file mode 100644
index 0000000000..1b55d88107
--- /dev/null
+++ b/tests/qapi-schema/duplicate-key.json
@@ -0,0 +1,2 @@
+{ 'key': 'value',
+ 'key': 'value' }
diff --git a/tests/qapi-schema/duplicate-key.out b/tests/qapi-schema/duplicate-key.out
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/qapi-schema/duplicate-key.out