On 10/10/2016 10:09 AM, Lin Ma wrote: > > >>>> Eric Blake <ebl...@redhat.com> 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 <l...@suse.com> >>>> --- >>>> 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
signature.asc
Description: OpenPGP digital signature