From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhUZr-0006Eq-6T for qemu-devel@nongnu.org; Wed, 30 Sep 2015 23:30:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhUZn-0004Hy-Sk for qemu-devel@nongnu.org; Wed, 30 Sep 2015 23:30:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhUZn-0004F9-HJ for qemu-devel@nongnu.org; Wed, 30 Sep 2015 23:30:35 -0400 References: <1443565276-4535-1-git-send-email-eblake@redhat.com> <1443565276-4535-6-git-send-email-eblake@redhat.com> From: Eric Blake Message-ID: <560CA8D4.8030002@redhat.com> Date: Wed, 30 Sep 2015 21:30:28 -0600 MIME-Version: 1.0 In-Reply-To: <1443565276-4535-6-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AoUOTqB63i9FQJdFlHTI5LAGGvreIFW9P" Subject: Re: [Qemu-devel] [PATCH v7 05/18] qapi: Test for various name collisions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, Michael Roth , ehabkost@redhat.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AoUOTqB63i9FQJdFlHTI5LAGGvreIFW9P Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/29/2015 04:21 PM, Eric Blake wrote: > Expose some weaknesses in the generator: we don't always forbid > the generation of structs that contain multiple members that map > to the same C or QMP name. This has already been marked FIXME in > qapi.py in commit d90675f, but having more tests will make sure > future patches produce desired behavior; and updating existing > patches to better document things doesn't hurt, either. Some of > these collisions are already caught in the old-style parser > checks, but ultimately we want all collisions to be caught in the > new-style QAPISchema*.check() methods. >=20 > diff --git a/tests/qapi-schema/union-clash-branches.err b/tests/qapi-sc= hema/union-clash-branches.err > new file mode 100644 > index 0000000..005c48d > --- /dev/null > +++ b/tests/qapi-schema/union-clash-branches.err > @@ -0,0 +1 @@ > +tests/qapi-schema/union-clash-branches.json:4: Union 'TestUnion' membe= r 'a_b' clashes with 'a-b' > diff --git a/tests/qapi-schema/union-clash-branches.exit b/tests/qapi-s= chema/union-clash-branches.exit > new file mode 100644 > index 0000000..d00491f > --- /dev/null > +++ b/tests/qapi-schema/union-clash-branches.exit > @@ -0,0 +1 @@ > +1 > diff --git a/tests/qapi-schema/union-clash-branches.json b/tests/qapi-s= chema/union-clash-branches.json > new file mode 100644 > index 0000000..31d135f > --- /dev/null > +++ b/tests/qapi-schema/union-clash-branches.json > @@ -0,0 +1,5 @@ > +# Union branch name collision > +# Reject a union that would result in a collision in generated C names= (this > +# would try to generate two enum values 'TEST_UNION_KIND_A_B'). > +{ 'union': 'TestUnion', > + 'data': { 'a-b': 'int', 'a_b': 'str' } } Hmm. This test is very similar to the existing union-bad-branch (I guess it's poor name is why I didn't notice it before). But that test only covered 'one' vs. 'ONE' (no clash in the C struct, just in the generated MyUnionKind enum type); while this test also clashes in the C struct. Don't know if it is worth a v8 to clean up the duplication, or if we just save it for a followup patch (namely, where I try to move errors into the QAPISchema.check() methods); I found the issue while playing with v5 15/46. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --AoUOTqB63i9FQJdFlHTI5LAGGvreIFW9P 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/ iQEcBAEBCAAGBQJWDKjYAAoJEKeha0olJ0NqR78H/Ar46nrIkikIOqXGTIAPgPFE IzCismntDfrSuzhGlj8J1IHjsfDazNxZGo5uF72l4IMk9/26vzA2V1TPvf9vS+fN A/j2mQkBpEHfpXbWslTlGxSG8ZZhrb9QSRgzOIVFOgZzjg3lWE0arD5OmV8YxK4d O8GdO5BRGyaMzyG4REqfWpQwh/YsDaOpFkRAf4R4/QaxY5P2svsuog/rNkL3lUNW 8PYIHN5X6OoldMkNP/ZbpGlEGM9Kf1Qt1eBwhjYKa22CZVdzrP2AzdQThjG5pY9D Q/SgKcWoheUQCIvf3B0X8pRVLYPbYymorLq0chz+s1SID3ENhhslKMO/RUjDGvo= =jaKA -----END PGP SIGNATURE----- --AoUOTqB63i9FQJdFlHTI5LAGGvreIFW9P--