From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcEcn-0000VA-1J for qemu-devel@nongnu.org; Wed, 16 Sep 2015 11:27:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcEci-0006UL-CB for qemu-devel@nongnu.org; Wed, 16 Sep 2015 11:27:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcEci-0006UB-4c for qemu-devel@nongnu.org; Wed, 16 Sep 2015 11:27:52 -0400 References: <1442401589-24189-1-git-send-email-armbru@redhat.com> <1442401589-24189-6-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55F98A76.9020106@redhat.com> Date: Wed, 16 Sep 2015 09:27:50 -0600 MIME-Version: 1.0 In-Reply-To: <1442401589-24189-6-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="st6IpVsotPnB3h197n6Hh56dnrKBs1MdH" Subject: Re: [Qemu-devel] [PATCH v8 05/26] tests/qapi-schema: Convert test harness to QAPISchemaVisitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --st6IpVsotPnB3h197n6Hh56dnrKBs1MdH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/16/2015 05:06 AM, Markus Armbruster wrote: > The old code prints the result of parsing (list of expression > dictionaries), and partial results of semantic analysis (list of enum > dictionaries, list of struct dictionaries). >=20 > The new code prints a trace of a schema visit, i.e. what the back-ends > are going to use. Built-in and array types are omitted, because > they're boring. >=20 > Signed-off-by: Markus Armbruster > --- > +class QAPISchemaTestVisitor(QAPISchemaVisitor): > + def visit_enum_type(self, name, info, values, prefix): > + print 'enum %s %s prefix=3D%s' % (name, values, prefix) > + > + def visit_object_type(self, name, info, base, members, variants): > + print 'object %s' % name > + if base: > + print ' base %s' % base.name For consistency with other visitors, I might have done: if prefix: print ' prefix %s' % prefix instead of printing prefix=3DNone for most enums. In particular, > +enum EnumOne ['value1', 'value2', 'value3'] prefix=3DNone > +object EventStructOne > + member struct1: UserDefOne optional=3DFalse > + member string: str optional=3DFalse > + member enum2: EnumOne optional=3DTrue > +object NestedEnumsOne > + member enum1: EnumOne optional=3DFalse > + member enum2: EnumOne optional=3DTrue > + member enum3: EnumOne optional=3DFalse > + member enum4: EnumOne optional=3DTrue > +enum QEnumTwo ['value1', 'value2'] prefix=3DQENUM_TWO the fact that prefix=3DNone and prefix=3DQENUM_TWO doesn't offer any visu= al clues on whether the string was user-supplied, means that the following would result in ambiguous output: { 'enum':'Foo', 'prefix':'None', 'data':[] } But it's not necessarily a strong enough reason for a respin. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --st6IpVsotPnB3h197n6Hh56dnrKBs1MdH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV+Yp2AAoJEKeha0olJ0Nqt+QH/1bJRg7iIXGr1uzrV/Ntk2BA lfWVilY8ECJV7+QcO7Cp+zZktlAq0vcnrrBvtWyXYZEbXKqGmVOMDvxEdPTlKTFN njoI30M60tQK8v4OtoB7ZtXFUc7DMK0vfH3UA4KbF71j1PikoczIEz3hBlDmwVSM pNxvCbPhvH1qBWEZ9q1Z9p2bGSDytg2dYxsF0MCVFxPmQD1bJOA2Uw/Z5e1A7iDR ryIRgORbll9Tmz49raxLHCokUnpZ3czJdP256HOief4jfIYrwyM7USGGKDLlyJdf 1tvXvRyG9e5jLKi6KzMHSe2PbYHrU8Xd4McyE3Pgqb92Plaw6d4dy0NW+h+uy4Q= =aNxr -----END PGP SIGNATURE----- --st6IpVsotPnB3h197n6Hh56dnrKBs1MdH--