Received: from eggs.gnu.org ([2001:4830:134:3::10]:42462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btfow-0004B2-Vy for qemu-devel@nongnu.org; Mon, 10 Oct 2016 15:01:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btfos-0004fL-MU for qemu-devel@nongnu.org; Mon, 10 Oct 2016 15:01:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btfos-0004fC-Cv for qemu-devel@nongnu.org; Mon, 10 Oct 2016 15:01:02 -0400 References: <20160926101627.14296-1-lma@suse.com> <20160926101627.14296-3-lma@suse.com> <20160926103856.GG18393@redhat.com> <6240d947-e8cb-29d9-038c-db990f4e6298@redhat.com> <57FC1FAB02000062000A2691@prv-mh.provo.novell.com> From: Eric Blake Message-ID: Date: Mon, 10 Oct 2016 14:00:59 -0500 MIME-Version: 1.0 In-Reply-To: <57FC1FAB02000062000A2691@prv-mh.provo.novell.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1nd2ghcn23Eplo8nqbtDjfb9BNTLWuVx9" Subject: Re: [Qemu-devel] =?utf-8?b?562U5aSN77yaIFJlOiAgW1BBVENIIHYzIDIvM10g?= =?utf-8?q?qapi=3A_auto_generate_enum_value_strings?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lin Ma , berrange@redhat.com Cc: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, afaerber@suse.de This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1nd2ghcn23Eplo8nqbtDjfb9BNTLWuVx9 From: Eric Blake To: Lin Ma , berrange@redhat.com Cc: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, afaerber@suse.de Message-ID: Subject: =?UTF-8?B?UmU6IOetlOWkje+8miBSZTogW1FlbXUtZGV2ZWxdIFtQQVRDSCB2MyAy?= =?UTF-8?Q?/3]_qapi:_auto_generate_enum_value_strings?= References: <20160926101627.14296-1-lma@suse.com> <20160926101627.14296-3-lma@suse.com> <20160926103856.GG18393@redhat.com> <6240d947-e8cb-29d9-038c-db990f4e6298@redhat.com> <57FC1FAB02000062000A2691@prv-mh.provo.novell.com> In-Reply-To: <57FC1FAB02000062000A2691@prv-mh.provo.novell.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/10/2016 10:09 AM, Lin Ma wrote: >=20 >=20 >>>> Eric Blake 2016/9/27 =E6=98=9F=E6=9C=9F=E4=BA=8C= =E4=B8=8A=E5=8D=88 4:17 >>> >> On 09/26/2016 05:38 AM, Daniel P. Berrange wrote: >>> On Mon, Sep 26, 2016 at 06:16:26PM +0800, Lin Ma wrote: >>>> Automatically generate enum value strings that containing the accept= able values. >>>> (Borrowwed Daniel's code.) >> >> s/Borrowwed/Borrowed/ > Sorry for the late reply, I was on vacation. > Thanks for the review. >> >>>> >>>> Signed-off-by: Lin Ma >>>> --- >>>> scripts/qapi-types.py | 2 ++ >>>> scripts/qapi.py | 9 +++++++++ >>>> 2 files changed, 11 insertions(+) >>> >>> This will need some test case coverage in tests/ somewhere, but I'm >>> not sure exactly which place is best - Eric/Markus can probably advis= e >> >> tests/test-qmp-commands.c is the first one that comes to mind, for >> adding another test case to an existing program. >> > I'm not familiar with how to write qapi generator code and related test= > code at all. I'll start to dig, Any guidance is appreciated. > For adding test case, Only this tests/test-qmp-commands.c needs to be > modified, right?=20 Yes, I think the easiest approach is to add a new line in the main() file that calls out to a new function, and the new function tests that an existing QAPI enum (from tests/qapi-schema/qapi-schema-test.json) has a sane conversion to a string listing all its members. Markus may have better ideas on where to place a new test, though. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --1nd2ghcn23Eplo8nqbtDjfb9BNTLWuVx9 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/ iQEcBAEBCAAGBQJX++VrAAoJEKeha0olJ0NqBO8H/RREEpQ2aNQq+o/Z7AfeptsW rAeJ/Wa3IOd+5RX/PB7iUly3w1kKwINyXtdFORd30v2INodKOZlK65Okhx0fD74R uyGd0A4iYyDPYdp9djHBqTlu4O6kwu2BFe3M1H/kOuoH2jVBYnm0UX42wtNICHO8 zFzxnHfivHaTx/uxqG2Pb8iVesaJS2cTpd61BpUPuFa88u//Q1k95RiNsdq8xZVn 6g6XSHHV5EE095mVHHZsTxQE48Znfkb2u3PbikbXvDPPkXx6AuQqJ6Syb0BB8YjW XeZYFKIQeqSOV79C9CNlaPjlMTyhKp2+/WLW65sR+Sm5rGAxJYg5S1Mx2d2cd0s= =FCvj -----END PGP SIGNATURE----- --1nd2ghcn23Eplo8nqbtDjfb9BNTLWuVx9--