From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHrFy-0000zP-Gp for qemu-devel@nongnu.org; Thu, 14 Aug 2014 05:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHrFt-0003mI-Fp for qemu-devel@nongnu.org; Thu, 14 Aug 2014 05:23:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHrFt-0003mC-81 for qemu-devel@nongnu.org; Thu, 14 Aug 2014 05:23:33 -0400 From: Markus Armbruster References: <1407287673-20308-1-git-send-email-eblake@redhat.com> <1407287673-20308-4-git-send-email-eblake@redhat.com> Date: Thu, 14 Aug 2014 11:23:27 +0200 In-Reply-To: <1407287673-20308-4-git-send-email-eblake@redhat.com> (Eric Blake's message of "Tue, 5 Aug 2014 19:14:22 -0600") Message-ID: <87vbpvjugg.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 03/14] qapi: add some enum tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Luiz Capitulino , Fam Zheng , qemu-devel@nongnu.org, wenchaoqemu@gmail.com Eric Blake writes: > Demonstrate that the qapi generator doesn't deal well with enums > that aren't up to par. Later patches will update the expected > results as the generator is made stricter. > > * tests/qapi-schema/enum-empty.*: New files. > * tests/qapi-schema/enum-missing-data.*: Likewise. > * tests/qapi-schema/enum-wrong-data.*: Likewise. > * tests/Makefile (check-qapi-schema-y): Run them. > > Signed-off-by: Eric Blake [...] > diff --git a/tests/qapi-schema/enum-missing-data.err b/tests/qapi-schema/enum-missing-data.err > new file mode 100644 > index 0000000..1fec213 > --- /dev/null > +++ b/tests/qapi-schema/enum-missing-data.err > @@ -0,0 +1,6 @@ > +Traceback (most recent call last): > + File "tests/qapi-schema/test-qapi.py", line 19, in > + exprs = parse_schema(sys.argv[1]) > + File "scripts/qapi.py", line 339, in parse_schema > + add_enum(expr['enum'], expr['data']) > +KeyError: 'data' > diff --git a/tests/qapi-schema/enum-missing-data.exit b/tests/qapi-schema/enum-missing-data.exit > new file mode 100644 > index 0000000..d00491f > --- /dev/null > +++ b/tests/qapi-schema/enum-missing-data.exit > @@ -0,0 +1 @@ > +1 > diff --git a/tests/qapi-schema/enum-missing-data.json b/tests/qapi-schema/enum-missing-data.json > new file mode 100644 > index 0000000..6e2acd8 > --- /dev/null > +++ b/tests/qapi-schema/enum-missing-data.json > @@ -0,0 +1 @@ > +{ 'enum': 'MyEnum' } > diff --git a/tests/qapi-schema/enum-missing-data.out b/tests/qapi-schema/enum-missing-data.out > new file mode 100644 > index 0000000..e69de29 > diff --git a/tests/qapi-schema/enum-wrong-data.err b/tests/qapi-schema/enum-wrong-data.err > new file mode 100644 > index 0000000..e69de29 > diff --git a/tests/qapi-schema/enum-wrong-data.exit b/tests/qapi-schema/enum-wrong-data.exit > new file mode 100644 > index 0000000..573541a > --- /dev/null > +++ b/tests/qapi-schema/enum-wrong-data.exit > @@ -0,0 +1 @@ > +0 > diff --git a/tests/qapi-schema/enum-wrong-data.json b/tests/qapi-schema/enum-wrong-data.json > new file mode 100644 > index 0000000..4b7e90c > --- /dev/null > +++ b/tests/qapi-schema/enum-wrong-data.json > @@ -0,0 +1 @@ > +{ 'enum': 'MyEnum', 'data': { 'value': 'str' } } > diff --git a/tests/qapi-schema/enum-wrong-data.out b/tests/qapi-schema/enum-wrong-data.out > new file mode 100644 > index 0000000..28d2211 > --- /dev/null > +++ b/tests/qapi-schema/enum-wrong-data.out > @@ -0,0 +1,3 @@ > +[OrderedDict([('enum', 'MyEnum'), ('data', OrderedDict([('value', 'str')]))])] > +[{'enum_name': 'MyEnum', 'enum_values': OrderedDict([('value', 'str')])}] > +[] For tests demonstrating incorrect behavior, a comment describing the expected behavior is always welcome.