[Qemu-devel] [PATCH v3 00/50] Hi,

Marc-André Lureau posted 50 patches 6 years, 7 months ago
Failed in applying to current master (apply log)
Test checkpatch passed
Test docker failed
Test s390x passed
There is a newer version of this series
qapi-schema.json                                   | 212 +-----------
qapi/block-core.json                               |  15 +-
qapi/char.json                                     |  10 +-
qapi/crypto.json                                   |   3 +-
qapi/migration.json                                |  12 +-
qapi/target.json                                   | 228 +++++++++++++
qapi/ui.json                                       |  75 +++--
scripts/qapi.py                                    | 372 +++++++++++++++------
scripts/qapi-commands.py                           |  13 +-
scripts/qapi-event.py                              |  12 +-
scripts/qapi-introspect.py                         | 121 ++++---
scripts/qapi-types.py                              |  71 ++--
scripts/qapi-visit.py                              |  24 +-
scripts/qapi2texi.py                               |  52 +--
include/qapi/qmp/qlit.h                            |   2 +
include/sysemu/arch_init.h                         |  11 -
ui/vnc.h                                           |   2 +
crypto/cipher-builtin.c                            |   9 +
crypto/cipher-gcrypt.c                             |  10 +-
crypto/cipher-nettle.c                             |  14 +-
crypto/cipher.c                                    |  13 +-
hmp.c                                              |   9 +-
hw/s390x/s390-skeys.c                              |   2 +-
hw/timer/mc146818rtc.c                             |   2 +-
migration/colo.c                                   |  16 +-
monitor.c                                          |  73 +---
qga/main.c                                         |   1 +
qmp.c                                              |  72 +---
qobject/qlit.c                                     |  36 ++
stubs/arch-query-cpu-def.c                         |  10 -
stubs/arch-query-cpu-model-baseline.c              |  12 -
stubs/arch-query-cpu-model-comparison.c            |  12 -
stubs/arch-query-cpu-model-expansion.c             |  12 -
target/arm/helper.c                                |   3 +-
target/arm/monitor.c                               |   2 +-
target/i386/cpu.c                                  |   5 +-
target/ppc/translate_init.c                        |   3 +-
target/s390x/cpu_models.c                          |   9 +-
tests/check-qlit.c                                 |  26 ++
tests/test-crypto-cipher.c                         |   2 +
tests/test-qmp-commands.c                          |   7 +
tests/test-qobject-input-visitor.c                 |  10 +-
Makefile                                           |  29 +-
Makefile.objs                                      |   3 +-
Makefile.target                                    |   4 +
docs/devel/qapi-code-gen.txt                       |  69 +++-
hmp-commands-info.hx                               |   2 +
stubs/Makefile.objs                                |   4 -
tests/Makefile.include                             |  10 +-
tests/qapi-schema/alternate-dict-invalid.err       |   1 +
...ict-member.exit => alternate-dict-invalid.exit} |   0
tests/qapi-schema/alternate-dict-invalid.json      |   4 +
...-dict-member.out => alternate-dict-invalid.out} |   0
tests/qapi-schema/bad-if-empty-list.err            |   1 +
tests/qapi-schema/bad-if-empty-list.exit           |   1 +
tests/qapi-schema/bad-if-empty-list.json           |   3 +
tests/qapi-schema/bad-if-empty-list.out            |   0
tests/qapi-schema/bad-if-empty.err                 |   1 +
tests/qapi-schema/bad-if-empty.exit                |   1 +
tests/qapi-schema/bad-if-empty.json                |   3 +
tests/qapi-schema/bad-if-empty.out                 |   0
tests/qapi-schema/bad-if.err                       |   1 +
tests/qapi-schema/bad-if.exit                      |   1 +
tests/qapi-schema/bad-if.json                      |   3 +
tests/qapi-schema/bad-if.out                       |   0
tests/qapi-schema/comments.out                     |  14 +-
tests/qapi-schema/doc-good.out                     |  17 +-
tests/qapi-schema/empty.out                        |   9 +-
tests/qapi-schema/enum-dict-member-invalid.err     |   1 +
tests/qapi-schema/enum-dict-member-invalid.exit    |   1 +
tests/qapi-schema/enum-dict-member-invalid.json    |   2 +
tests/qapi-schema/enum-dict-member-invalid.out     |   0
tests/qapi-schema/enum-dict-member-invalid2.err    |   1 +
tests/qapi-schema/enum-dict-member-invalid2.exit   |   1 +
tests/qapi-schema/enum-dict-member-invalid2.json   |   2 +
tests/qapi-schema/enum-dict-member-invalid2.out    |   0
tests/qapi-schema/enum-dict-member.err             |   1 -
tests/qapi-schema/enum-dict-member.json            |   2 -
tests/qapi-schema/enum-if-invalid.err              |   1 +
tests/qapi-schema/enum-if-invalid.exit             |   1 +
tests/qapi-schema/enum-if-invalid.json             |   3 +
tests/qapi-schema/enum-if-invalid.out              |   0
tests/qapi-schema/event-case.out                   |   9 +-
tests/qapi-schema/ident-with-escape.out            |   9 +-
tests/qapi-schema/include-relpath.out              |  14 +-
tests/qapi-schema/include-repetition.out           |  14 +-
tests/qapi-schema/include-simple.out               |  14 +-
tests/qapi-schema/indented-expr.out                |   9 +-
tests/qapi-schema/qapi-schema-test.json            |  36 ++
tests/qapi-schema/qapi-schema-test.out             |  93 +++++-
tests/qapi-schema/struct-if-invalid.err            |   1 +
tests/qapi-schema/struct-if-invalid.exit           |   1 +
tests/qapi-schema/struct-if-invalid.json           |   3 +
tests/qapi-schema/struct-if-invalid.out            |   0
tests/qapi-schema/struct-member-type.err           |   0
tests/qapi-schema/struct-member-type.exit          |   1 +
tests/qapi-schema/struct-member-type.json          |   2 +
tests/qapi-schema/struct-member-type.out           |  12 +
tests/qapi-schema/test-qapi.py                     |  43 ++-
99 files changed, 1328 insertions(+), 735 deletions(-)
create mode 100644 qapi/target.json
delete mode 100644 stubs/arch-query-cpu-def.c
delete mode 100644 stubs/arch-query-cpu-model-baseline.c
delete mode 100644 stubs/arch-query-cpu-model-comparison.c
delete mode 100644 stubs/arch-query-cpu-model-expansion.c
create mode 100644 tests/qapi-schema/alternate-dict-invalid.err
rename tests/qapi-schema/{enum-dict-member.exit => alternate-dict-invalid.exit} (100%)
create mode 100644 tests/qapi-schema/alternate-dict-invalid.json
rename tests/qapi-schema/{enum-dict-member.out => alternate-dict-invalid.out} (100%)
create mode 100644 tests/qapi-schema/bad-if-empty-list.err
create mode 100644 tests/qapi-schema/bad-if-empty-list.exit
create mode 100644 tests/qapi-schema/bad-if-empty-list.json
create mode 100644 tests/qapi-schema/bad-if-empty-list.out
create mode 100644 tests/qapi-schema/bad-if-empty.err
create mode 100644 tests/qapi-schema/bad-if-empty.exit
create mode 100644 tests/qapi-schema/bad-if-empty.json
create mode 100644 tests/qapi-schema/bad-if-empty.out
create mode 100644 tests/qapi-schema/bad-if.err
create mode 100644 tests/qapi-schema/bad-if.exit
create mode 100644 tests/qapi-schema/bad-if.json
create mode 100644 tests/qapi-schema/bad-if.out
create mode 100644 tests/qapi-schema/enum-dict-member-invalid.err
create mode 100644 tests/qapi-schema/enum-dict-member-invalid.exit
create mode 100644 tests/qapi-schema/enum-dict-member-invalid.json
create mode 100644 tests/qapi-schema/enum-dict-member-invalid.out
create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.err
create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.exit
create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.json
create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.out
delete mode 100644 tests/qapi-schema/enum-dict-member.err
delete mode 100644 tests/qapi-schema/enum-dict-member.json
create mode 100644 tests/qapi-schema/enum-if-invalid.err
create mode 100644 tests/qapi-schema/enum-if-invalid.exit
create mode 100644 tests/qapi-schema/enum-if-invalid.json
create mode 100644 tests/qapi-schema/enum-if-invalid.out
create mode 100644 tests/qapi-schema/struct-if-invalid.err
create mode 100644 tests/qapi-schema/struct-if-invalid.exit
create mode 100644 tests/qapi-schema/struct-if-invalid.json
create mode 100644 tests/qapi-schema/struct-if-invalid.out
create mode 100644 tests/qapi-schema/struct-member-type.err
create mode 100644 tests/qapi-schema/struct-member-type.exit
create mode 100644 tests/qapi-schema/struct-member-type.json
create mode 100644 tests/qapi-schema/struct-member-type.out
[Qemu-devel] [PATCH v3 00/50] Hi,
Posted by Marc-André Lureau 6 years, 7 months ago
In order to clean-up some hacks in qapi (having to unregister commands
at runtime), I proposed a "[PATCH v5 02/20] qapi.py: add a simple #ifdef condition"

(see http://lists.gnu.org/archive/html/qemu-devel/2016-08/msg03106.html).

However, we decided to drop that patch from the series and solve the
problem later. The main issues were:
- the syntax was awkward to the JSON schema and documentation
- the evaluation of the condition was done in the qapi scripts, with
  very limited capability
- each target/config would need different generated files.

Instead, it could defer the #if evaluation to the C-preprocessor.

With this series, top-level qapi JSON entity can take 'if' keys:

{ 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
  'if': 'defined(TEST_IF_STRUCT)' }

Members can be exploded as dictionnary with 'type'/'if' keys:

{ 'struct': 'TestIfStruct', 'data':
  { 'foo': 'int',
    'bar': { 'type': 'int', 'if': 'defined(TEST_IF_STRUCT_BAR)'} } }

Enum values can be exploded as dictionnary with 'type'/'if' keys:

{ 'enum': 'TestIfEnum', 'data':
  [ 'foo',
    { 'name' : 'bar', 'if': 'defined(TEST_IF_ENUM_BAR)' } ] }

A good benefit from having conditional schema is that introspection
will reflect more accurately the capability of the server. Another
benefit is that it may help to remove some dead code when disabling a
functionality.

Starting from patch "qapi: add conditions to VNC type/commands/events
on the schema", the series demonstrate adding conditions, in order to
remove qmp_unregister_commands_hack(). The main difference with v2, is
the addition of a per-target schema in "build-sys: add a target
schema". This removes the NEED_CPU_H hack, and keep most of the qapi
files in common build.

There are a lot more things we could make conditional in the QAPI
schema, like pci/kvm/xen/numa/vde/slirp/posix/win32/vsock/lzo etc etc,
however I am still evaluating the implication of such changes both
externally and internally, for those interested, I can share my wip
branch.

Comments welcome,

v3:
- rebased (qlit is now merged upstream)
- solve the per-target #ifdef problem by using a target.json
  and new qapi generated target files
- update some commit messages based on Markus review
- more schema error reporting
- move the ifcond argument closer to info/doc
- use mcgen() in gen_if()/gen_endif()
- simplify "modify to_qlit() to take an optional suffix"
- fix generated qlit indentation
- fix temporary build break by merging #if types & visitors patch
- fix some redundant condtionals generation
- change enum visitor to take QAPISchemaMember
- reject unknown dictionnary keys in { .., 'if': ..}
- split qapi test visitor print() with trailing ',' trick

Marc-André Lureau (50):
  qlit: add qobject_from_qlit()
  qapi: generate a literal qobject for introspection
  qapi2texi: minor python code simplification
  qapi: add 'if' to top-level expressions
  qapi: add tests for invalid 'if'
  qapi: pass 'if' condition into QAPISchemaEntity objects
  qapi: add 'ifcond' to visitor methods
  qapi: mcgen() shouldn't indent # lines
  qapi: add #if/#endif helpers
  qapi-introspect: modify to_qlit() to append ',' on level > 0
  qapi-introspect: modify to_qlit() to generate #if code
  qapi-introspect: add preprocessor conditions to generated QLit
  qapi-commands: add #if conditions to commands
  qapi-event: add #if conditions to events
  qapi-types: refactor variants handling
  qapi-types: add #if conditions to types & visitors
  qapi: do not define enumeration value explicitely
  qapi: change enum visitor to take QAPISchemaMember
  qapi: add 'if' to enum members
  qapi-event: add 'if' condition to generated enum
  qapi: add #if conditions on generated enum members
  tests: add some enum members tests
  qapi: add 'if' to struct members and implicit objects members
  qapi: add some struct member tests
  qapi: add #if conditions to generated struct members
  qapi: add 'if' on union variants
  qapi: add #if conditions to generated variants
  qapi: add 'if' to alternate variant
  qapi: add tests for invalid alternate
  qapi: add #if conditions to generated alternate variants
  docs: document schema configuration
  qapi2texi: add 'If:' section to generated documentation
  qapi2texi: add 'If:' condition to enum values
  qapi2texi: add 'If:' condition to struct members
  qapi2texi: add condition to variants
  qapi: add conditions to VNC type/commands/events on the schema
  qapi: add conditions to SPICE type/commands/events on the schema
  qapi: add conditions to REPLICATION type/commands on the schema
  qapi-commands: don't initialize command list in qmp_init_marshall()
  qapi: add -i/--include filename.h
  qapi: add a 'unit' pragma
  qapi: add a -u/--unit option to specify which unit to visit
  build-sys: move qmp-introspect per target
  build-sys: add a target schema
  qapi: make rtc-reset-reinjection depend on TARGET_I386
  qapi: make s390 commands depend on TARGET_S390X
  target.json: add a note about query-cpu* not being s390x-specific
  qapi: make query-gic-capabilities depend on TARGET_ARM
  qapi: make query-cpu-model-expansion depend on s390 or x86
  qapi: make query-cpu-definitions depend on specific targets

 qapi-schema.json                                   | 212 +-----------
 qapi/block-core.json                               |  15 +-
 qapi/char.json                                     |  10 +-
 qapi/crypto.json                                   |   3 +-
 qapi/migration.json                                |  12 +-
 qapi/target.json                                   | 228 +++++++++++++
 qapi/ui.json                                       |  75 +++--
 scripts/qapi.py                                    | 372 +++++++++++++++------
 scripts/qapi-commands.py                           |  13 +-
 scripts/qapi-event.py                              |  12 +-
 scripts/qapi-introspect.py                         | 121 ++++---
 scripts/qapi-types.py                              |  71 ++--
 scripts/qapi-visit.py                              |  24 +-
 scripts/qapi2texi.py                               |  52 +--
 include/qapi/qmp/qlit.h                            |   2 +
 include/sysemu/arch_init.h                         |  11 -
 ui/vnc.h                                           |   2 +
 crypto/cipher-builtin.c                            |   9 +
 crypto/cipher-gcrypt.c                             |  10 +-
 crypto/cipher-nettle.c                             |  14 +-
 crypto/cipher.c                                    |  13 +-
 hmp.c                                              |   9 +-
 hw/s390x/s390-skeys.c                              |   2 +-
 hw/timer/mc146818rtc.c                             |   2 +-
 migration/colo.c                                   |  16 +-
 monitor.c                                          |  73 +---
 qga/main.c                                         |   1 +
 qmp.c                                              |  72 +---
 qobject/qlit.c                                     |  36 ++
 stubs/arch-query-cpu-def.c                         |  10 -
 stubs/arch-query-cpu-model-baseline.c              |  12 -
 stubs/arch-query-cpu-model-comparison.c            |  12 -
 stubs/arch-query-cpu-model-expansion.c             |  12 -
 target/arm/helper.c                                |   3 +-
 target/arm/monitor.c                               |   2 +-
 target/i386/cpu.c                                  |   5 +-
 target/ppc/translate_init.c                        |   3 +-
 target/s390x/cpu_models.c                          |   9 +-
 tests/check-qlit.c                                 |  26 ++
 tests/test-crypto-cipher.c                         |   2 +
 tests/test-qmp-commands.c                          |   7 +
 tests/test-qobject-input-visitor.c                 |  10 +-
 Makefile                                           |  29 +-
 Makefile.objs                                      |   3 +-
 Makefile.target                                    |   4 +
 docs/devel/qapi-code-gen.txt                       |  69 +++-
 hmp-commands-info.hx                               |   2 +
 stubs/Makefile.objs                                |   4 -
 tests/Makefile.include                             |  10 +-
 tests/qapi-schema/alternate-dict-invalid.err       |   1 +
 ...ict-member.exit => alternate-dict-invalid.exit} |   0
 tests/qapi-schema/alternate-dict-invalid.json      |   4 +
 ...-dict-member.out => alternate-dict-invalid.out} |   0
 tests/qapi-schema/bad-if-empty-list.err            |   1 +
 tests/qapi-schema/bad-if-empty-list.exit           |   1 +
 tests/qapi-schema/bad-if-empty-list.json           |   3 +
 tests/qapi-schema/bad-if-empty-list.out            |   0
 tests/qapi-schema/bad-if-empty.err                 |   1 +
 tests/qapi-schema/bad-if-empty.exit                |   1 +
 tests/qapi-schema/bad-if-empty.json                |   3 +
 tests/qapi-schema/bad-if-empty.out                 |   0
 tests/qapi-schema/bad-if.err                       |   1 +
 tests/qapi-schema/bad-if.exit                      |   1 +
 tests/qapi-schema/bad-if.json                      |   3 +
 tests/qapi-schema/bad-if.out                       |   0
 tests/qapi-schema/comments.out                     |  14 +-
 tests/qapi-schema/doc-good.out                     |  17 +-
 tests/qapi-schema/empty.out                        |   9 +-
 tests/qapi-schema/enum-dict-member-invalid.err     |   1 +
 tests/qapi-schema/enum-dict-member-invalid.exit    |   1 +
 tests/qapi-schema/enum-dict-member-invalid.json    |   2 +
 tests/qapi-schema/enum-dict-member-invalid.out     |   0
 tests/qapi-schema/enum-dict-member-invalid2.err    |   1 +
 tests/qapi-schema/enum-dict-member-invalid2.exit   |   1 +
 tests/qapi-schema/enum-dict-member-invalid2.json   |   2 +
 tests/qapi-schema/enum-dict-member-invalid2.out    |   0
 tests/qapi-schema/enum-dict-member.err             |   1 -
 tests/qapi-schema/enum-dict-member.json            |   2 -
 tests/qapi-schema/enum-if-invalid.err              |   1 +
 tests/qapi-schema/enum-if-invalid.exit             |   1 +
 tests/qapi-schema/enum-if-invalid.json             |   3 +
 tests/qapi-schema/enum-if-invalid.out              |   0
 tests/qapi-schema/event-case.out                   |   9 +-
 tests/qapi-schema/ident-with-escape.out            |   9 +-
 tests/qapi-schema/include-relpath.out              |  14 +-
 tests/qapi-schema/include-repetition.out           |  14 +-
 tests/qapi-schema/include-simple.out               |  14 +-
 tests/qapi-schema/indented-expr.out                |   9 +-
 tests/qapi-schema/qapi-schema-test.json            |  36 ++
 tests/qapi-schema/qapi-schema-test.out             |  93 +++++-
 tests/qapi-schema/struct-if-invalid.err            |   1 +
 tests/qapi-schema/struct-if-invalid.exit           |   1 +
 tests/qapi-schema/struct-if-invalid.json           |   3 +
 tests/qapi-schema/struct-if-invalid.out            |   0
 tests/qapi-schema/struct-member-type.err           |   0
 tests/qapi-schema/struct-member-type.exit          |   1 +
 tests/qapi-schema/struct-member-type.json          |   2 +
 tests/qapi-schema/struct-member-type.out           |  12 +
 tests/qapi-schema/test-qapi.py                     |  43 ++-
 99 files changed, 1328 insertions(+), 735 deletions(-)
 create mode 100644 qapi/target.json
 delete mode 100644 stubs/arch-query-cpu-def.c
 delete mode 100644 stubs/arch-query-cpu-model-baseline.c
 delete mode 100644 stubs/arch-query-cpu-model-comparison.c
 delete mode 100644 stubs/arch-query-cpu-model-expansion.c
 create mode 100644 tests/qapi-schema/alternate-dict-invalid.err
 rename tests/qapi-schema/{enum-dict-member.exit => alternate-dict-invalid.exit} (100%)
 create mode 100644 tests/qapi-schema/alternate-dict-invalid.json
 rename tests/qapi-schema/{enum-dict-member.out => alternate-dict-invalid.out} (100%)
 create mode 100644 tests/qapi-schema/bad-if-empty-list.err
 create mode 100644 tests/qapi-schema/bad-if-empty-list.exit
 create mode 100644 tests/qapi-schema/bad-if-empty-list.json
 create mode 100644 tests/qapi-schema/bad-if-empty-list.out
 create mode 100644 tests/qapi-schema/bad-if-empty.err
 create mode 100644 tests/qapi-schema/bad-if-empty.exit
 create mode 100644 tests/qapi-schema/bad-if-empty.json
 create mode 100644 tests/qapi-schema/bad-if-empty.out
 create mode 100644 tests/qapi-schema/bad-if.err
 create mode 100644 tests/qapi-schema/bad-if.exit
 create mode 100644 tests/qapi-schema/bad-if.json
 create mode 100644 tests/qapi-schema/bad-if.out
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid.err
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid.exit
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid.json
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid.out
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.err
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.exit
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.json
 create mode 100644 tests/qapi-schema/enum-dict-member-invalid2.out
 delete mode 100644 tests/qapi-schema/enum-dict-member.err
 delete mode 100644 tests/qapi-schema/enum-dict-member.json
 create mode 100644 tests/qapi-schema/enum-if-invalid.err
 create mode 100644 tests/qapi-schema/enum-if-invalid.exit
 create mode 100644 tests/qapi-schema/enum-if-invalid.json
 create mode 100644 tests/qapi-schema/enum-if-invalid.out
 create mode 100644 tests/qapi-schema/struct-if-invalid.err
 create mode 100644 tests/qapi-schema/struct-if-invalid.exit
 create mode 100644 tests/qapi-schema/struct-if-invalid.json
 create mode 100644 tests/qapi-schema/struct-if-invalid.out
 create mode 100644 tests/qapi-schema/struct-member-type.err
 create mode 100644 tests/qapi-schema/struct-member-type.exit
 create mode 100644 tests/qapi-schema/struct-member-type.json
 create mode 100644 tests/qapi-schema/struct-member-type.out

-- 
2.14.1.146.gd35faa819


Re: [Qemu-devel] [PATCH v3 00/50] Hi,
Posted by no-reply@patchew.org 6 years, 7 months ago
Hi,

This series failed automatic build test. Please find the testing commands and
their output below. If you have docker installed, you can probably reproduce it
locally.

Subject: [Qemu-devel] [PATCH v3 00/50] Hi,
Message-id: 20170911110623.24981-1-marcandre.lureau@redhat.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-quick@centos6
time make docker-test-build@min-glib
time make docker-test-mingw@fedora
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
1d8781c86a qapi: make query-cpu-definitions depend on specific targets
c1814694c2 qapi: make query-cpu-model-expansion depend on s390 or x86
bd74091ade qapi: make query-gic-capabilities depend on TARGET_ARM
1d28b98dd1 target.json: add a note about query-cpu* not being s390x-specific
c7b9cba7dd qapi: make s390 commands depend on TARGET_S390X
b131645e5f qapi: make rtc-reset-reinjection depend on TARGET_I386
960aaa74bb build-sys: add a target schema
e3f318c8c3 build-sys: move qmp-introspect per target
71eab793c2 qapi: add a -u/--unit option to specify which unit to visit
9d165fe81e qapi: add a 'unit' pragma
e7ea04e24b qapi: add -i/--include filename.h
fbf22f44fa qapi-commands: don't initialize command list in qmp_init_marshall()
6def7fd06b qapi: add conditions to REPLICATION type/commands on the schema
043aba6677 qapi: add conditions to SPICE type/commands/events on the schema
cd14f015e5 qapi: add conditions to VNC type/commands/events on the schema
0aa323bee5 qapi2texi: add condition to variants
2b93c585fc qapi2texi: add 'If:' condition to struct members
bb70e84669 qapi2texi: add 'If:' condition to enum values
fd7b62cdac qapi2texi: add 'If:' section to generated documentation
44b2c49aa0 docs: document schema configuration
1cac828e3b qapi: add #if conditions to generated alternate variants
b8c8b93c51 qapi: add tests for invalid alternate
7594ba7d28 qapi: add 'if' to alternate variant
25e10a0b8a qapi: add #if conditions to generated variants
bd9efd8521 qapi: add 'if' on union variants
e82ba63f9d qapi: add #if conditions to generated struct members
cff07c1587 qapi: add some struct member tests
fd66601eec qapi: add 'if' to struct members and implicit objects members
c75e5f0c86 tests: add some enum members tests
450301d6d6 qapi: add #if conditions on generated enum members
be66ae92a3 qapi-event: add 'if' condition to generated enum
c248455099 qapi: add 'if' to enum members
ec649c084c qapi: change enum visitor to take QAPISchemaMember
a3635c5ed0 qapi: do not define enumeration value explicitely
a3de6080f9 qapi-types: add #if conditions to types & visitors
bf00d931ab qapi-types: refactor variants handling
2620d8539e qapi-event: add #if conditions to events
9afa67c39b qapi-commands: add #if conditions to commands
6016203f71 qapi-introspect: add preprocessor conditions to generated QLit
1d1970308c qapi-introspect: modify to_qlit() to generate #if code
10a53e0e87 qapi-introspect: modify to_qlit() to append ', ' on level > 0
8c1cf63678 qapi: add #if/#endif helpers
8029ce5875 qapi: mcgen() shouldn't indent # lines
1780e303b8 qapi: add 'ifcond' to visitor methods
dd93a5bdb8 qapi: pass 'if' condition into QAPISchemaEntity objects
b2df076279 qapi: add tests for invalid 'if'
186e9297f0 qapi: add 'if' to top-level expressions
0032b622c7 qapi2texi: minor python code simplification
347ba5193c qapi: generate a literal qobject for introspection
150a7e19aa qlit: add qobject_from_qlit()

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-g9aaw526/src/dtc'...
Submodule path 'dtc': checked out '558cd81bdd432769b59bff01240c44f82cfb1a9d'
  BUILD   centos6
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-g9aaw526/src'
  ARCHIVE qemu.tgz
  ARCHIVE dtc.tgz
  COPY    RUNNER
    RUN test-quick in qemu:centos6 
Packages installed:
SDL-devel-1.2.14-7.el6_7.1.x86_64
bison-2.4.1-5.el6.x86_64
bzip2-devel-1.0.5-7.el6_0.x86_64
ccache-3.1.6-2.el6.x86_64
csnappy-devel-0-6.20150729gitd7bc683.el6.x86_64
flex-2.5.35-9.el6.x86_64
gcc-4.4.7-18.el6.x86_64
git-1.7.1-8.el6.x86_64
glib2-devel-2.28.8-9.el6.x86_64
libepoxy-devel-1.2-3.el6.x86_64
libfdt-devel-1.4.0-1.el6.x86_64
librdmacm-devel-1.0.21-0.el6.x86_64
lzo-devel-2.03-3.1.el6_5.1.x86_64
make-3.81-23.el6.x86_64
mesa-libEGL-devel-11.0.7-4.el6.x86_64
mesa-libgbm-devel-11.0.7-4.el6.x86_64
package g++ is not installed
pixman-devel-0.32.8-1.el6.x86_64
spice-glib-devel-0.26-8.el6.x86_64
spice-server-devel-0.12.4-16.el6.x86_64
tar-1.23-15.el6_8.x86_64
vte-devel-0.25.1-9.el6.x86_64
xen-devel-4.6.3-15.el6.x86_64
zlib-devel-1.2.3-29.el6.x86_64

Environment variables:
PACKAGES=bison     bzip2-devel     ccache     csnappy-devel     flex     g++     gcc     git     glib2-devel     libepoxy-devel     libfdt-devel     librdmacm-devel     lzo-devel     make     mesa-libEGL-devel     mesa-libgbm-devel     pixman-devel     SDL-devel     spice-glib-devel     spice-server-devel     tar     vte-devel     xen-devel     zlib-devel
HOSTNAME=b98b51bd7e45
TERM=xterm
MAKEFLAGS= -j8
HISTSIZE=1000
J=8
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root
PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
LANG=en_US.UTF-8
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES= dtc
DEBUG=
G_BROKEN_FILENAMES=1
CCACHE_HASHDIR=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install
No C++ compiler available; disabling C++ specific optional code
Install prefix    /var/tmp/qemu-build/install
BIOS directory    /var/tmp/qemu-build/install/share/qemu
binary directory  /var/tmp/qemu-build/install/bin
library directory /var/tmp/qemu-build/install/lib
module directory  /var/tmp/qemu-build/install/lib/qemu
libexec directory /var/tmp/qemu-build/install/libexec
include directory /var/tmp/qemu-build/install/include
config directory  /var/tmp/qemu-build/install/etc
local state directory   /var/tmp/qemu-build/install/var
Manual directory  /var/tmp/qemu-build/install/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /tmp/qemu-test/src
C compiler        cc
Host C compiler   cc
C++ compiler      
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g 
QEMU_CFLAGS       -I/usr/include/pixman-1   -I$(SRC_PATH)/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -DNCURSES_WIDECHAR   -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all  -I/usr/include/libpng12   -I/usr/include/libdrm     -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/spice-1   -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4  
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.14)
GTK support       yes (2.24.23)
GTK GL support    no
VTE support       yes (0.25.1)
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no 
nettle kdf        no
libtasn1          no
curses support    yes
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
xen support       yes
xen ctrl version  40600
pv dom build      no
brlapi support    no
bluez  support    no
Documentation     no
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
HAX support       no
TCG support       yes
TCG debug enabled no
TCG interpreter   no
RDMA support      yes
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
vhost-vsock support yes
vhost-user support yes
Trace backends    log
spice support     yes (0.12.6/0.12.4)
rbd support       no
xfsctl support    no
smartcard support yes
libusb            no
usb net redir     no
OpenGL support    yes
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no
build guest agent yes
QGA VSS support   no
QGA w32 disk info no
QGA MSI support   no
seccomp support   no
coroutine backend ucontext
coroutine pool    yes
debug stack usage no
crypto afalg      no
GlusterFS support no
gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
Live block migration yes
lzo support       yes
snappy support    no
bzip2 support     yes
NUMA host support no
tcmalloc support  no
jemalloc support  no
avx2 optimization no
replication support yes
VxHS block device no
mkdir -p dtc/libfdt
mkdir -p dtc/tests
  GEN     x86_64-softmmu/config-devices.mak.tmp
  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     qemu-options.def
  GEN     config-host.h
  GEN     qmp-commands.h
  GEN     qapi-types.h
  GEN     qapi-visit.h
Traceback (most recent call last):
  File "/tmp/qemu-test/src/scripts/qapi-commands.py", line 15, in <module>
    from qapi import *
  File "/tmp/qemu-test/src/scripts/qapi.py", line 714
    check_unknown_keys(info, value, {'type', 'if'})
                                           ^
SyntaxError: invalid syntax
  GEN     qapi-event.h
make: *** [qmp-commands.h] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "/tmp/qemu-test/src/scripts/qapi-visit.py", line 15, in <module>
    from qapi import *
  File "/tmp/qemu-test/src/scripts/qapi.py", line 714
    check_unknown_keys(info, value, {'type', 'if'})
                                           ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "/tmp/qemu-test/src/scripts/qapi-types.py", line 14, in <module>
    from qapi import *
  File "/tmp/qemu-test/src/scripts/qapi.py", line 714
    check_unknown_keys(info, value, {'type', 'if'})
                                           ^
SyntaxError: invalid syntax
make: *** [qapi-visit.h] Error 1
make: *** [qapi-types.h] Error 1
  GEN     aarch64-softmmu/config-devices.mak
Traceback (most recent call last):
  File "/tmp/qemu-test/src/scripts/qapi-event.py", line 14, in <module>
    from qapi import *
  File "/tmp/qemu-test/src/scripts/qapi.py", line 714
    check_unknown_keys(info, value, {'type', 'if'})
                                           ^
SyntaxError: invalid syntax
make: *** [qapi-event.h] Error 1
  GEN     x86_64-softmmu/config-devices.mak
Traceback (most recent call last):
  File "./tests/docker/docker.py", line 384, in <module>
    sys.exit(main())
  File "./tests/docker/docker.py", line 381, in main
    return args.cmdobj.run(args, argv)
  File "./tests/docker/docker.py", line 239, in run
    return Docker().run(argv, args.keep, quiet=args.quiet)
  File "./tests/docker/docker.py", line 207, in run
    quiet=quiet)
  File "./tests/docker/docker.py", line 125, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 186, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'run', '--label', 'com.qemu.instance.uuid=d7268e7a96e711e7b25b52540069c830', '-u', '0', '-t', '--rm', '--net=none', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=8', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/var/tmp/patchew-tester-tmp-g9aaw526/src/docker-src.2017-09-11-07.53.31.9321:/var/tmp/qemu:z,ro', '-v', '/root/.cache/qemu-docker-ccache:/var/tmp/ccache:z', 'qemu:centos6', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2
make[1]: *** [tests/docker/Makefile.include:139: docker-run] Error 1
make[1]: Leaving directory '/var/tmp/patchew-tester-tmp-g9aaw526/src'
make: *** [tests/docker/Makefile.include:168: docker-run-test-quick@centos6] Error 2

real	1m12.628s
user	0m5.082s
sys	0m1.662s
=== OUTPUT END ===

Test command exited with code: 2


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Re: [Qemu-devel] [PATCH v3 00/50] Hi,
Posted by Markus Armbruster 6 years, 4 months ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> In order to clean-up some hacks in qapi (having to unregister commands
> at runtime), I proposed a "[PATCH v5 02/20] qapi.py: add a simple #ifdef condition"
>
> (see http://lists.gnu.org/archive/html/qemu-devel/2016-08/msg03106.html).
>
> However, we decided to drop that patch from the series and solve the
> problem later. The main issues were:
> - the syntax was awkward to the JSON schema and documentation
> - the evaluation of the condition was done in the qapi scripts, with
>   very limited capability
> - each target/config would need different generated files.
>
> Instead, it could defer the #if evaluation to the C-preprocessor.
>
> With this series, top-level qapi JSON entity can take 'if' keys:
>
> { 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
>   'if': 'defined(TEST_IF_STRUCT)' }
>
> Members can be exploded as dictionnary with 'type'/'if' keys:
>
> { 'struct': 'TestIfStruct', 'data':
>   { 'foo': 'int',
>     'bar': { 'type': 'int', 'if': 'defined(TEST_IF_STRUCT_BAR)'} } }
>
> Enum values can be exploded as dictionnary with 'type'/'if' keys:
>
> { 'enum': 'TestIfEnum', 'data':
>   [ 'foo',
>     { 'name' : 'bar', 'if': 'defined(TEST_IF_ENUM_BAR)' } ] }
>
> A good benefit from having conditional schema is that introspection
> will reflect more accurately the capability of the server. Another
> benefit is that it may help to remove some dead code when disabling a
> functionality.
>
> Starting from patch "qapi: add conditions to VNC type/commands/events
> on the schema", the series demonstrate adding conditions, in order to
> remove qmp_unregister_commands_hack(). The main difference with v2, is
> the addition of a per-target schema in "build-sys: add a target
> schema". This removes the NEED_CPU_H hack, and keep most of the qapi
> files in common build.
>
> There are a lot more things we could make conditional in the QAPI
> schema, like pci/kvm/xen/numa/vde/slirp/posix/win32/vsock/lzo etc etc,
> however I am still evaluating the implication of such changes both
> externally and internally, for those interested, I can share my wip
> branch.
>
> Comments welcome,
>
> v3:
> - rebased (qlit is now merged upstream)
> - solve the per-target #ifdef problem by using a target.json
>   and new qapi generated target files
> - update some commit messages based on Markus review
> - more schema error reporting
> - move the ifcond argument closer to info/doc
> - use mcgen() in gen_if()/gen_endif()
> - simplify "modify to_qlit() to take an optional suffix"
> - fix generated qlit indentation
> - fix temporary build break by merging #if types & visitors patch
> - fix some redundant condtionals generation
> - change enum visitor to take QAPISchemaMember
> - reject unknown dictionnary keys in { .., 'if': ..}
> - split qapi test visitor print() with trailing ',' trick

Things I like:

* How you add conditionals to the QAPI language

* How the generated code changes

Things I don't like so much:

* A few commit messages are just too terse

* Code and its test added in separate patches

* ifcond_decorator

  I guess can either accept it, or come up with a better solution.

* Unconventional handling of sugared forms (see my review of PATCH 28).

* Addressing complilation consistency problems (see my review of PATCH
  17) before addressing them by splitting off target-specific generated
  files (PATCH 39..)

* Manual splitting of the generated monolith with pragma unit, -i and
  -u.  I guess can either accept it, or come up with a better solution.

Additionally, there are couple of minor things here and there, and a few
questions.  The usual patch review business.

Overall, there's much more for me to like than to dislike :)