[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: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] 答复: Re: [PATCH v3 2/3] qapi: auto generate enum value strings |
Date: |
Tue, 11 Oct 2016 08:56:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> 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.
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?
>
> 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: <address@hidden>
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.