From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNVAZ-0007iU-2w for qemu-devel@nongnu.org; Thu, 06 Aug 2015 20:05:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNVAU-0000Cv-CJ for qemu-devel@nongnu.org; Thu, 06 Aug 2015 20:05:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNVAU-0000Cm-2A for qemu-devel@nongnu.org; Thu, 06 Aug 2015 20:05:50 -0400 References: <1438703896-12553-1-git-send-email-armbru@redhat.com> <1438703896-12553-12-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55C3E553.8060208@redhat.com> Date: Thu, 6 Aug 2015 16:53:07 -0600 MIME-Version: 1.0 In-Reply-To: <1438703896-12553-12-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uqoDSDnwI4qPjQiCw3QnCqO6G6aXWLWkp" Subject: Re: [Qemu-devel] [PATCH RFC v3 11/32] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --uqoDSDnwI4qPjQiCw3QnCqO6G6aXWLWkp Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/04/2015 09:57 AM, Markus Armbruster wrote: > Fixes flat unions to visit the base's base members (the previous > commit merely added them to the struct). Same test case. >=20 > Patch's effect on visit_type_UserDefFlatUnion(): >=20 > static void visit_type_UserDefFlatUnion_fields(Visitor *m, UserDef= FlatUnion **obj, Error **errp) > { > Error *err =3D NULL; >=20 > + visit_type_int(m, &(*obj)->integer, "integer", &err); > + if (err) { > + goto out; > + } > visit_type_str(m, &(*obj)->string, "string", &err); > if (err) { > goto out; >=20 > Test cases updated for the bug fix. Not quite right. >=20 > Fixes alternates to generate a visitor for their implicit enumeration > type. None of them are currently used, obviously. Example: > block-core.json's BlockdevRef now generates > visit_type_BlockdevRefKind(). >=20 > Signed-off-by: Markus Armbruster > --- > scripts/qapi-visit.py | 260 +++++++++++++-----------= -------- > tests/qapi-schema/qapi-schema-test.json | 3 - > tests/test-qmp-input-strict.c | 2 +- > tests/test-qmp-input-visitor.c | 4 +- > 4 files changed, 106 insertions(+), 163 deletions(-) > +++ b/tests/test-qmp-input-strict.c > @@ -167,9 +167,9 @@ static void test_validate_union_flat(TestInputVisit= orData *data, > =20 > v =3D validate_test_init(data, > "{ 'enum1': 'value1', " > + "'integer': 41, " > "'string': 'str', " > "'boolean': true }"); > - /* TODO when generator bug is fixed, add 'integer': 41 */ > =20 > visit_type_UserDefFlatUnion(v, &tmp, NULL, &err); > g_assert(!err); Incomplete fix; you need to squash this in to test that cleanup of a partial struct is still correct (otherwise, the test sets err for the wrong reason of "missing 'integer'" rather than the intended reason of "missing 'enum1'"): diff --git i/tests/test-qmp-input-strict.c w/tests/test-qmp-input-strict.= c index bfd9d04..4c18096 100644 --- i/tests/test-qmp-input-strict.c +++ w/tests/test-qmp-input-strict.c @@ -299,7 +299,7 @@ static void test_validate_fail_union_flat_no_discrim(TestInputVisitorData *data, Visitor *v; /* test situation where discriminator field ('enum1' here) is missing */ - v =3D validate_test_init(data, "{ 'string': 'c', 'string1': 'd', 'string2': 'e' }"); + v =3D validate_test_init(data, "{ 'integer': 42, 'string': 'c', 'string1': 'd', 'string2': 'e' }"); visit_type_UserDefFlatUnion2(v, &tmp, NULL, &err); g_assert(err); --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --uqoDSDnwI4qPjQiCw3QnCqO6G6aXWLWkp 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/ iQEcBAEBCAAGBQJVw+VXAAoJEKeha0olJ0NqI+IIAKmAaU9FDs9lB73YqoxWKE9p 2pr0LcZigDb/pyHRvEILUvytPnsJOyNKbha9fsql2B/766r4rffTyu6+YeAlI4vv iyibXb7NvPX3V+rRIFp/dGs3rEXf7+/J6HCQSTbSOste8dNx86lpzDbHMiMpSnXC E1zuwANdA1sfVbqZbxafgefya0PPAPfauqEsULa+3SNNQeDS93cxc53o/AEfQjCb CrpE5Nwqa3myQA7WcHA5Nmj4wwEpMfW5/cKGzvv2Rx4bavKJq9qVcFgFuhD8Cl7B qKaAKNyec5F+8aVWxkqfwzID3ynLhPf6uclrtPNFlax6R9tfogBNE74jtdze1nY= =myPQ -----END PGP SIGNATURE----- --uqoDSDnwI4qPjQiCw3QnCqO6G6aXWLWkp--