From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btqzf-0002l0-CA for qemu-devel@nongnu.org; Tue, 11 Oct 2016 02:56:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btqzb-0005pb-75 for qemu-devel@nongnu.org; Tue, 11 Oct 2016 02:56:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btqzb-0005pF-1V for qemu-devel@nongnu.org; Tue, 11 Oct 2016 02:56:51 -0400 From: Markus Armbruster 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> Date: Tue, 11 Oct 2016 08:56:47 +0200 In-Reply-To: (Eric Blake's message of "Mon, 10 Oct 2016 14:00:59 -0500") Message-ID: <87twcjqspc.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Eric Blake Cc: Lin Ma , berrange@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, afaerber@suse.de Eric Blake writes: > 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 accepta= ble 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 advise >>> >>> tests/test-qmp-commands.c is the first one that comes to mind, for >>> adding another test case to an existing program. Yes, that's the closest we got. >> 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. I think tests/test-qmp-commands.c should be split. See Message-ID: <8760p7yv8n.fsf@dusky.pond.sub.org> http://lists.gnu.org/archive/html/qemu-devel/2016-10/msg00664.html However, splitting it out of scope of Lin Ma's work. Go ahead and add to tests/test-qmp-commands.c.