From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEnOD-0001pF-T2 for qemu-devel@nongnu.org; Tue, 05 Aug 2014 18:39:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEnO2-0004sQ-4Y for qemu-devel@nongnu.org; Tue, 05 Aug 2014 18:39:29 -0400 Received: from qmta15.emeryville.ca.mail.comcast.net ([2001:558:fe2d:44:76:96:27:228]:41554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEnO1-0004p8-QY for qemu-devel@nongnu.org; Tue, 05 Aug 2014 18:39:18 -0400 From: Eric Blake Date: Tue, 5 Aug 2014 16:38:59 -0600 Message-Id: <1407278346-17427-8-git-send-email-eblake@redhat.com> In-Reply-To: <1407278346-17427-1-git-send-email-eblake@redhat.com> References: <1407278346-17427-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH v2 07/14] qapi: add some type check tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Fam Zheng , Markus Armbruster , wenchaoqemu@gmail.com, Luiz Capitulino Demonstrate that the qapi generator silently parses confusing types, which may cause other errors later on. Later patches will update the expected results as the generator is made stricter. * tests/qapi-schema/data-array-empty.*: New files. * tests/qapi-schema/data-array-unknown.*: Likewise. * tests/qapi-schema/data-unknown.*: Likewise. * tests/qapi-schema/data-int.*: Likewise. * tests/qapi-schema/returns-unknown.*: Likewise. * tests/qapi-schema/returns-int.*: Likewise. * tests/qapi-schema/returns-array-bad.*: Likewise. * tests/Makefile (check-qapi-schema-y): Run them. Signed-off-by: Eric Blake --- tests/Makefile | 4 +++- tests/qapi-schema/data-array-empty.err | 0 tests/qapi-schema/data-array-empty.exit | 1 + tests/qapi-schema/data-array-empty.json | 1 + tests/qapi-schema/data-array-empty.out | 3 +++ tests/qapi-schema/data-array-unknown.err | 0 tests/qapi-schema/data-array-unknown.exit | 1 + tests/qapi-schema/data-array-unknown.json | 1 + tests/qapi-schema/data-array-unknown.out | 3 +++ tests/qapi-schema/data-int.err | 0 tests/qapi-schema/data-int.exit | 1 + tests/qapi-schema/data-int.json | 1 + tests/qapi-schema/data-int.out | 3 +++ tests/qapi-schema/data-unknown.err | 0 tests/qapi-schema/data-unknown.exit | 1 + tests/qapi-schema/data-unknown.json | 1 + tests/qapi-schema/data-unknown.out | 3 +++ tests/qapi-schema/returns-array-bad.err | 0 tests/qapi-schema/returns-array-bad.exit | 1 + tests/qapi-schema/returns-array-bad.json | 1 + tests/qapi-schema/returns-array-bad.out | 3 +++ tests/qapi-schema/returns-int.err | 0 tests/qapi-schema/returns-int.exit | 1 + tests/qapi-schema/returns-int.json | 1 + tests/qapi-schema/returns-int.out | 3 +++ tests/qapi-schema/returns-unknown.err | 0 tests/qapi-schema/returns-unknown.exit | 1 + tests/qapi-schema/returns-unknown.json | 1 + tests/qapi-schema/returns-unknown.out | 3 +++ 29 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 tests/qapi-schema/data-array-empty.err create mode 100644 tests/qapi-schema/data-array-empty.exit create mode 100644 tests/qapi-schema/data-array-empty.json create mode 100644 tests/qapi-schema/data-array-empty.out create mode 100644 tests/qapi-schema/data-array-unknown.err create mode 100644 tests/qapi-schema/data-array-unknown.exit create mode 100644 tests/qapi-schema/data-array-unknown.json create mode 100644 tests/qapi-schema/data-array-unknown.out create mode 100644 tests/qapi-schema/data-int.err create mode 100644 tests/qapi-schema/data-int.exit create mode 100644 tests/qapi-schema/data-int.json create mode 100644 tests/qapi-schema/data-int.out create mode 100644 tests/qapi-schema/data-unknown.err create mode 100644 tests/qapi-schema/data-unknown.exit create mode 100644 tests/qapi-schema/data-unknown.json create mode 100644 tests/qapi-schema/data-unknown.out create mode 100644 tests/qapi-schema/returns-array-bad.err create mode 100644 tests/qapi-schema/returns-array-bad.exit create mode 100644 tests/qapi-schema/returns-array-bad.json create mode 100644 tests/qapi-schema/returns-array-bad.out create mode 100644 tests/qapi-schema/returns-int.err create mode 100644 tests/qapi-schema/returns-int.exit create mode 100644 tests/qapi-schema/returns-int.json create mode 100644 tests/qapi-schema/returns-int.out create mode 100644 tests/qapi-schema/returns-unknown.err create mode 100644 tests/qapi-schema/returns-unknown.exit create mode 100644 tests/qapi-schema/returns-unknown.json create mode 100644 tests/qapi-schema/returns-unknown.out diff --git a/tests/Makefile b/tests/Makefile index 1b0c96f..c36faca 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -192,7 +192,9 @@ $(foreach target,$(SYSEMU_TARGET_LIST), \ check-qapi-schema-y := $(addprefix tests/qapi-schema/, \ comments.json empty.json enum-empty.json enum-missing-data.json \ enum-wrong-data.json funny-char.json indented-expr.json \ - missing-type.json double-type.json \ + missing-type.json double-type.json data-array-empty.json \ + data-array-unknown.json data-unknown.json data-int.json \ + returns-unknown.json returns-int.json returns-array-bad.json \ missing-colon.json missing-comma-list.json \ missing-comma-object.json non-objects.json \ qapi-schema-test.json quoted-structural-chars.json \ diff --git a/tests/qapi-schema/data-array-empty.err b/tests/qapi-schema/data-array-empty.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/data-array-empty.exit b/tests/qapi-schema/data-array-empty.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/data-array-empty.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/data-array-empty.json b/tests/qapi-schema/data-array-empty.json new file mode 100644 index 0000000..00352ac --- /dev/null +++ b/tests/qapi-schema/data-array-empty.json @@ -0,0 +1 @@ +{ 'command': 'oops', 'data': [ ] } diff --git a/tests/qapi-schema/data-array-empty.out b/tests/qapi-schema/data-array-empty.out new file mode 100644 index 0000000..67802be --- /dev/null +++ b/tests/qapi-schema/data-array-empty.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'oops'), ('data', [])])] +[] +[] diff --git a/tests/qapi-schema/data-array-unknown.err b/tests/qapi-schema/data-array-unknown.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/data-array-unknown.exit b/tests/qapi-schema/data-array-unknown.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/data-array-unknown.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/data-array-unknown.json b/tests/qapi-schema/data-array-unknown.json new file mode 100644 index 0000000..03ef321 --- /dev/null +++ b/tests/qapi-schema/data-array-unknown.json @@ -0,0 +1 @@ +{ 'command': 'oops', 'data': [ 'NoSuchType' ] } diff --git a/tests/qapi-schema/data-array-unknown.out b/tests/qapi-schema/data-array-unknown.out new file mode 100644 index 0000000..c3bc05e --- /dev/null +++ b/tests/qapi-schema/data-array-unknown.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'oops'), ('data', ['NoSuchType'])])] +[] +[] diff --git a/tests/qapi-schema/data-int.err b/tests/qapi-schema/data-int.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/data-int.exit b/tests/qapi-schema/data-int.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/data-int.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/data-int.json b/tests/qapi-schema/data-int.json new file mode 100644 index 0000000..926c75e --- /dev/null +++ b/tests/qapi-schema/data-int.json @@ -0,0 +1 @@ +{ 'command': 'oops', 'data': 'int' } diff --git a/tests/qapi-schema/data-int.out b/tests/qapi-schema/data-int.out new file mode 100644 index 0000000..e589a4f --- /dev/null +++ b/tests/qapi-schema/data-int.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'oops'), ('data', 'int')])] +[] +[] diff --git a/tests/qapi-schema/data-unknown.err b/tests/qapi-schema/data-unknown.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/data-unknown.exit b/tests/qapi-schema/data-unknown.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/data-unknown.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/data-unknown.json b/tests/qapi-schema/data-unknown.json new file mode 100644 index 0000000..4415584 --- /dev/null +++ b/tests/qapi-schema/data-unknown.json @@ -0,0 +1 @@ +{ 'command': 'oops', 'data': 'NoSuchType' } diff --git a/tests/qapi-schema/data-unknown.out b/tests/qapi-schema/data-unknown.out new file mode 100644 index 0000000..2c60726 --- /dev/null +++ b/tests/qapi-schema/data-unknown.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'oops'), ('data', 'NoSuchType')])] +[] +[] diff --git a/tests/qapi-schema/returns-array-bad.err b/tests/qapi-schema/returns-array-bad.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/returns-array-bad.exit b/tests/qapi-schema/returns-array-bad.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/returns-array-bad.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/returns-array-bad.json b/tests/qapi-schema/returns-array-bad.json new file mode 100644 index 0000000..76bf6df --- /dev/null +++ b/tests/qapi-schema/returns-array-bad.json @@ -0,0 +1 @@ +{ 'command': 'oops', 'data': [ 'str', 'str' ] } diff --git a/tests/qapi-schema/returns-array-bad.out b/tests/qapi-schema/returns-array-bad.out new file mode 100644 index 0000000..cfc474e --- /dev/null +++ b/tests/qapi-schema/returns-array-bad.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'oops'), ('data', ['str', 'str'])])] +[] +[] diff --git a/tests/qapi-schema/returns-int.err b/tests/qapi-schema/returns-int.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/returns-int.exit b/tests/qapi-schema/returns-int.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/returns-int.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/returns-int.json b/tests/qapi-schema/returns-int.json new file mode 100644 index 0000000..0884968 --- /dev/null +++ b/tests/qapi-schema/returns-int.json @@ -0,0 +1 @@ +{ 'command': 'okay', 'returns': 'int' } diff --git a/tests/qapi-schema/returns-int.out b/tests/qapi-schema/returns-int.out new file mode 100644 index 0000000..36b00a9 --- /dev/null +++ b/tests/qapi-schema/returns-int.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'okay'), ('returns', 'int')])] +[] +[] diff --git a/tests/qapi-schema/returns-unknown.err b/tests/qapi-schema/returns-unknown.err new file mode 100644 index 0000000..e69de29 diff --git a/tests/qapi-schema/returns-unknown.exit b/tests/qapi-schema/returns-unknown.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/returns-unknown.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/returns-unknown.json b/tests/qapi-schema/returns-unknown.json new file mode 100644 index 0000000..508df3e --- /dev/null +++ b/tests/qapi-schema/returns-unknown.json @@ -0,0 +1 @@ +{ 'command': 'oops', 'returns': 'NoSuchType' } diff --git a/tests/qapi-schema/returns-unknown.out b/tests/qapi-schema/returns-unknown.out new file mode 100644 index 0000000..a482c83 --- /dev/null +++ b/tests/qapi-schema/returns-unknown.out @@ -0,0 +1,3 @@ +[OrderedDict([('command', 'oops'), ('returns', 'NoSuchType')])] +[] +[] -- 1.9.3