From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwITs-00074p-Sh for qemu-devel@nongnu.org; Tue, 10 Nov 2015 18:37:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwITn-0007t5-TB for qemu-devel@nongnu.org; Tue, 10 Nov 2015 18:37:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwITn-0007t1-Nk for qemu-devel@nongnu.org; Tue, 10 Nov 2015 18:37:35 -0500 References: <1446791754-23823-1-git-send-email-eblake@redhat.com> <1446791754-23823-24-git-send-email-eblake@redhat.com> <87vb9bgwlj.fsf@blackfin.pond.sub.org> <56417DB2.4090601@redhat.com> From: Eric Blake Message-ID: <56427FB9.5040409@redhat.com> Date: Tue, 10 Nov 2015 16:37:29 -0700 MIME-Version: 1.0 In-Reply-To: <56417DB2.4090601@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="p2OJ2sNVrO8bhfgmvkcS1P3RCbVScEQs4" Subject: Re: [Qemu-devel] [PATCH v10 23/30] qapi: Check for qapi collisions of flat union branches List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --p2OJ2sNVrO8bhfgmvkcS1P3RCbVScEQs4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/09/2015 10:16 PM, Eric Blake wrote: >> We have tests covering attempts to do the former >> (struct-cycle-direct.json, struct-cycle-indirect.json). As far as I c= an >> see, we don't have tests covering the latter. Do we catch it? >=20 > Yes, at least by virtue of the ad hoc tests: attempting to reuse a base= > type of the flat union as a variant member will cause the qapi members > of the base type to appear more than once in the JSON object (that is, > the checks that reject flat-union-clash-member.json would also reject > this scenario). To test: >=20 > diff --git i/tests/qapi-schema/qapi-schema-test.json > w/tests/qapi-schema/qapi-schema-test.json > index 44638da..16b2ffb 100644 > --- i/tests/qapi-schema/qapi-schema-test.json > +++ w/tests/qapi-schema/qapi-schema-test.json > @@ -67,7 +67,7 @@ > 'discriminator': 'enum1', > 'data': { 'value1' : 'UserDefA', > 'value2' : 'UserDefB', > - 'value3' : 'UserDefB' } } > + 'value3' : 'UserDefUnionBase' } } Another test I just tried is creating a flat union with: empty -> base -> union then use empty as one of the union branches. In that case, there is no conflict (although base is included twice, neither inclusion adds members to the JSON object; and the inclusion is not circular so things compile just fine). So probably not worth adding a test for it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --p2OJ2sNVrO8bhfgmvkcS1P3RCbVScEQs4 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/ iQEcBAEBCAAGBQJWQn+5AAoJEKeha0olJ0NqB1IH/j1o/vnNIbw+sbRrzddK6KMw SQGufX2Oih4spEJhhfuC2aoXiYQulv/VdnetPi0CBiYAsfGTAM4iRvmp1hV9sXAz Xy2tVVmwWd/gjq4IrdRk3k63TPm6D34XovW15/+OYoHVNDc2PdNvQ6GW/VpOKT5G TaoUw7vQcbO/iSzgaLKrn5QmSGmqCNaM2v1oUtlL1uCRmtiwNyj+Fasr/M+APnWE 9WWGAHMKVyoK0YgcfiQdFM5aarNlgr/xuIRPr6sukIc0f2g+49bVOnxeUMs6ojko yMlLYPBJfkrO0U40Ja+LdGOuwdPAkGTnUlEWcqYZ9LZAVEV6S1DIXJSF/2T4ESs= =Kf3v -----END PGP SIGNATURE----- --p2OJ2sNVrO8bhfgmvkcS1P3RCbVScEQs4--