From patchwork Wed Aug 6 01:14:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 376828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A7CC5140082 for ; Wed, 6 Aug 2014 11:17:45 +1000 (EST) Received: from localhost ([::1]:35426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEprL-00008v-LE for incoming@patchwork.ozlabs.org; Tue, 05 Aug 2014 21:17:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEpoW-0003q8-2j for qemu-devel@nongnu.org; Tue, 05 Aug 2014 21:14:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEpoP-0004dT-8G for qemu-devel@nongnu.org; Tue, 05 Aug 2014 21:14:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEpoP-0004dI-1J for qemu-devel@nongnu.org; Tue, 05 Aug 2014 21:14:41 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s761EdlE026031 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Aug 2014 21:14:39 -0400 Received: from red.redhat.com (ovpn-113-88.phx2.redhat.com [10.3.113.88]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s761EZ4n022160; Tue, 5 Aug 2014 21:14:39 -0400 From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 5 Aug 2014 19:14:26 -0600 Message-Id: <1407287673-20308-8-git-send-email-eblake@redhat.com> In-Reply-To: <1407287673-20308-1-git-send-email-eblake@redhat.com> References: <1407287673-20308-1-git-send-email-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Fam Zheng , Markus Armbruster , wenchaoqemu@gmail.com, Luiz Capitulino Subject: [Qemu-devel] [PATCH v3 07/14] qapi: add some type check tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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')])] +[] +[]