[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.
- [Qemu-devel] [PATCH v7 00/14] alternate layout (post-introspection cleanups, subset C), Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 04/14] qapi-introspect: Guarantee particular sorting, Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 01/14] qapi: Use generated TestStruct machinery in tests, Eric Blake, 2015/10/17
- Re: [Qemu-devel] [PATCH v7 01/14] qapi: Use generated TestStruct machinery in tests,
Markus Armbruster <=
- [Qemu-devel] [PATCH v7 03/14] qapi: Provide nicer array names in introspection, Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 06/14] qapi: Update tests related to QMP/branch collisions, Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 08/14] qapi: Fix alternates that accept 'number' but not 'int', Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 09/14] qapi: Remove dead visitor code, Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 14/14] qapi: Simplify visits of optional fields, Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 05/14] qapi: Rework collision assertions, Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 12/14] qapi: Test failure in middle of array parse, Eric Blake, 2015/10/17
- [Qemu-devel] [PATCH v7 10/14] qapi: Plug leaks in test-qmp-*, Eric Blake, 2015/10/17