From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjEVW-0000ed-T2 for qemu-devel@nongnu.org; Mon, 05 Oct 2015 18:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjEVT-0006c0-JM for qemu-devel@nongnu.org; Mon, 05 Oct 2015 18:45:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjEVT-0006ac-CL for qemu-devel@nongnu.org; Mon, 05 Oct 2015 18:45:19 -0400 References: <1443565276-4535-1-git-send-email-eblake@redhat.com> <1443565276-4535-9-git-send-email-eblake@redhat.com> From: Eric Blake Message-ID: <5612FD74.5000403@redhat.com> Date: Mon, 5 Oct 2015 16:45:08 -0600 MIME-Version: 1.0 In-Reply-To: <1443565276-4535-9-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6OF3eQ9m7qN0J54UB65RPwXA52X0Wlbxi" Subject: Re: [Qemu-devel] [PATCH v7 08/18] qapi: Test use of 'number' within alternates 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) --6OF3eQ9m7qN0J54UB65RPwXA52X0Wlbxi Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/29/2015 04:21 PM, Eric Blake wrote: > Add some testsuite exposure for use of a 'number' as part of > an alternate. The current state of the tree has a few bugs > exposed by this: our input parser depends on the ordering of > how the qapi schema declared the alternate, and the parser > does not accept integers for a 'number' in an alternate even > though it does for numbers outside of an alternate. >=20 > Mixing 'int' and 'number' in the same alternate is unusual, > since both are supplied by json-numbers, but there does not > seem to be a technical reason to forbid it given that our > json lexer distinguishes between json-numbers that can be > represented as an int vs. those that cannot. >=20 > Improve the existing test_visitor_in_alternate() to match the > style of the new test_visitor_in_alternate_number(), and to > ensure full coverage of all possible qtype parsing. >=20 > Signed-off-by: Eric Blake >=20 > --- > +static void test_visitor_in_alternate_number(TestInputVisitorData *dat= a, > + const void *unused) > +{ > + Visitor *v; > + Error *err =3D NULL; > + AltStrBool *asb; > + AltStrNum *asn; > + AltNumStr *ans; > + AltStrInt *asi; > + AltIntNum *ain; > + AltNumInt *ani; > + > + /* Parsing an int */ > + > + v =3D visitor_input_test_init(data, "42"); > + visit_type_AltStrBool(v, &asb, NULL, &err); > + g_assert(err); > + qapi_free_AltStrBool(asb); > + visitor_input_teardown(data, NULL); This fails to reset err =3D NULL... > + > + /* FIXME: Order of alternate should not affect semantics; asn shou= ld > + * parse the same as ans */ > + v =3D visitor_input_test_init(data, "42"); > + visit_type_AltStrNum(v, &asn, NULL, &err); > + /* FIXME g_assert_cmpint(asn->kind, =3D=3D ALT_STR_NUM_KIND_N); */= > + /* FIXME g_assert_cmpfloat(asn->n, =3D=3D, 42); */ > + g_assert(err); > + error_free(err); > + err =3D NULL; =2E..which means that this test is not reliable. Do you need a v8, or ca= n you squash this in? diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visito= r.c index 1b5a369..6104ac6 100644 --- a/tests/test-qmp-input-visitor.c +++ b/tests/test-qmp-input-visitor.c @@ -395,6 +395,8 @@ static void test_visitor_in_alternate_number(TestInputVisitorData *data, v =3D visitor_input_test_init(data, "42"); visit_type_AltStrBool(v, &asb, NULL, &err); g_assert(err); + error_free(err); + err =3D NULL; qapi_free_AltStrBool(asb); v =3D visitor_input_test_init(data, "42"); --=20 2.4.3 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --6OF3eQ9m7qN0J54UB65RPwXA52X0Wlbxi 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/ iQEcBAEBCAAGBQJWEv11AAoJEKeha0olJ0NqAfwIAKjf7ou2WU3+/KUWCelFOU9b rf5kSA7Su3bSPY9zZI5GY4s+qzNQxCKnTq3DqPZlBoQIVzWkHuQcXrXMlI66BOrP eA4Tm1yndol8oycGKcLTadhFxMszW61u4jo57ZffXS/5LnMi55ganXPK23v0aE5W 8k2HBvZ0SS3+6LkrOkDdnZLKZGdttQ9k/O2wKzrcwzfkEZuQtaZAQ3XVeilr/RSQ ciCmfA6kpJNmm6dDomxWnT5aGIpk/eU/xwKtHjpTyquYjkmYzt6hbbmob3jaclzv f+H0dmU3NTZ+ZZcly6ulkHBz9pUHjblK/u1f42yVRYnUAW7Rcc4GsmuHVnvY1jw= =E492 -----END PGP SIGNATURE----- --6OF3eQ9m7qN0J54UB65RPwXA52X0Wlbxi--