Skip to content

qapi: Test coverage & clean up generated code

Markus Armbruster qemu-devel 3 versions – Applied

Status from this message: Applied to the qmp branch, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest13 patches 2 repliesApplied
  2. v213 patches 7 repliesSuperseded
  3. v110 patches 18 repliesSuperseded

Changes in v3 from the cover letter

* Trivially rebased

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/13tests/qapi-schema: Actually check successful QMP command responsetests/test-qmp-commands.c+35 -80 replies
2/13tests/qapi-schema: Cover optional command argumentstests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out tests/test-qmp-commands.c+9 -50 replies
3/13tests/qapi-schema: Cover simple argument typestests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out tests/test-qmp-commands.c+19 -00 replies
4/13tests/qapi-schema: Cover anonymous union typestests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out tests/test-qmp-input-strict.c +2 more+81 -10 replies
5/13tests/qapi-schema: Cover complex types with basetests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out tests/test-qmp-commands.c +3 more+37 -200 replies
6/13tests/qapi-schema: Cover union types with basetests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out tests/test-qmp-input-strict.c +2 more+8 -40 replies
7/13tests/qapi-schema: Cover flat union typestests/qapi-schema/qapi-schema-test.json tests/qapi-schema/qapi-schema-test.out tests/test-qmp-input-strict.c +2 more+93 -00 replies
8/13qapi: Fix licensing of scriptsscripts/qapi-commands.py scripts/qapi-types.py scripts/qapi-visit.py +1 more+8 -80 replies
9/13qapi: Drop nonsensical header guard in generated qapi-visit.cscripts/qapi-visit.py+0 -20 replies
10/13qapi: Drop unused code in qapi-commands.pyscripts/qapi-commands.py+0 -200 replies
11/13qapi: Clean up null checking in generated visitorsscripts/qapi-visit.py+7 -71 reply
12/13qapi: Clean up superfluous null check in qapi_dealloc_type_str()qapi/qapi-dealloc-visitor.c+1 -30 replies
13/13qapi: Add missing null check to opts_start_struct()qapi/opts-visitor.c+3 -10 replies

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchEric Blake
1/13R-b
2/13R-b
3/13R-b
4/13R-b
5/13R-b
6/13R-b
7/13R-b
8/13R-b
9/13R-b
10/13R-b
11/13R-b
12/13R-b
13/13R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 00/13] qapi: Test coverage & clean up generated code

Coverity is unhappy with the generated code. Nothing serious, just heaps of valid DEADCODE defects topped off with a few bogus FORWARD_NULL defects.

I had a look at the generator, and decided I don't want to mess with it without decent test coverage. Unfortunately, a few features have been added without tests. My first seven patches make the tests catch up. tests/qapi-schema/qapi-schema-test.json now covers all mcgen() in scripts/qapi*.py, except for a few in qapi-commands.py that are conditional on -m.

The next four patches clean up the generated code.

I also reviewed null checks in visitor implementations. The final two patches address the issues I found there.

v3:
* Trivially rebased

v2:
* Previously separate patch "qapi: Fix licensing of scripts" revised and included as "[PATCH v2 08/13] qapi: Fix licensing of scripts"
* Style cleanups
* New PATCH 12/13 and 13/13

Markus Armbruster (13):
tests/qapi-schema: Actually check successful QMP command response tests/qapi-schema: Cover optional command arguments tests/qapi-schema: Cover simple argument types tests/qapi-schema: Cover anonymous union types tests/qapi-schema: Cover complex types with base tests/qapi-schema: Cover union types with base tests/qapi-schema: Cover flat union types
qapi: Fix licensing of scripts
qapi: Drop nonsensical header guard in generated qapi-visit.c
qapi: Drop unused code in qapi-commands.py
qapi: Clean up null checking in generated visitors
qapi: Clean up superfluous null check in qapi_dealloc_type_str()
qapi: Add missing null check to opts_start_struct()

 qapi/opts-visitor.c                     |  4 +-
 qapi/qapi-dealloc-visitor.c             |  4 +-
 scripts/qapi-commands.py                | 24 +---------
 scripts/qapi-types.py                   |  4 +-
 scripts/qapi-visit.py                   | 20 ++++-----
 scripts/qapi.py                         |  4 +-
 tests/qapi-schema/qapi-schema-test.json | 24 +++++++++-
 tests/qapi-schema/qapi-schema-test.out  | 19 +++++---
 tests/test-qmp-commands.c               | 78 +++++++++++++++++++++++++++------
 tests/test-qmp-input-strict.c           | 69 ++++++++++++++++++++++++++++-
 tests/test-qmp-input-visitor.c          | 45 +++++++++++++++++--
 tests/test-qmp-output-visitor.c         | 67 ++++++++++++++++++++++++++--
 tests/test-visitor-serialization.c      | 14 +++---
 13 files changed, 299 insertions(+), 77 deletions(-)
Signature · 1 line
1.8.1.4