qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v7 01/14] qapi: Use generated TestStruct machine


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v7 01/14] qapi: Use generated TestStruct machinery in tests
Date: Thu, 22 Oct 2015 17:58:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

> Commit d88f5fd and friends first introduced the various test-qmp-*
> tests in 2011, with duplicated hand-rolled TestStruct machinery,
> to make sure the qapi visitor interface was tested.  Later, commit
> 4f193e3 in 2013 added a .json file for further testing use by the
> files, but without consolidating any of the existing hand-rolled
> visitors.  And with four copies, subtle differences have crept in.

The only one between the hand-rolled copies I can see apart from
whitespace is tests/test-visitor-serialization.c passing NULL rather
than "TestStruct" to visit_start_struct().

Compared to the generated version, the hand-rolled copies neglect to
skip visiting members when !*obj.  If I remember correctly, we do that
so we can use the visitor to deallocate partly allocated stuff (worth a
comment, by the way), and that's not necessary in these tests.

> Of course, just because the visitor interface is tested does not
> mean it is a sane interface; and future patches will be changing
> some of the visitor contracts.  Rather than having to duplicate
> the cleanup work in each copy of the TestStruct visitor, and keep
> each hand-rolled copy in sync with what the generator supplies, we
> might as well just test what the generator should give us in the
> first place.
>
> Signed-off-by: Eric Blake <address@hidden>

Patch looks good.



reply via email to

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