qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] 答复: Re: [PATCH v3 2/3] qapi: auto generate enum value


From: Eric Blake
Subject: Re: [Qemu-devel] 答复: Re: [PATCH v3 2/3] qapi: auto generate enum value strings
Date: Mon, 10 Oct 2016 14:00:59 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

On 10/10/2016 10:09 AM, Lin Ma wrote:
> 
> 
>>>> Eric Blake <address@hidden> 2016/9/27 星期二 上午 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 acceptable 
>>>> 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 <address@hidden>
>>>> ---
>>>>  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.
>>
> 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? 

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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]