qemu/tests/qapi-schema
Eric Blake c818408e44 qapi: Implement boxed types for commands/events
Turn on the ability to pass command and event arguments in
a single boxed parameter, which must name a non-empty type
(although the type can be a struct with all optional members).
For structs, it makes it possible to pass a single qapi type
instead of a breakout of all struct members (useful if the
arguments are already in a struct or if the number of members
is large); for other complex types, it is now possible to use
a union or alternate as the data for a command or event.

The empty type may be technically feasible if needed down the
road, but it's easier to forbid it now and relax things to allow
it later, than it is to allow it now and have to special case
how the generated 'q_empty' type is handled (see commit 7ce106a9
for reasons why nothing is generated for the empty type).  An
alternate type is never considered empty, but now that a boxed
type can be either an object or an alternate, we have to provide
a trivial QAPISchemaAlternateType.is_empty().  The new call to
arg_type.is_empty() during QAPISchemaCommand.check() requires
that we first check the type in question; but there is no chance
of introducing a cycle since objects do not refer back to commands.

We still have a split in syntax checking between ad-hoc parsing
up front (merely validates that 'boxed' has a sane value) and
during .check() methods (if 'boxed' is set, then 'data' must name
a non-empty user-defined type).

Generated code is unchanged, as long as no client uses the
new feature.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1468468228-27827-10-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Test files renamed to *-boxed-*]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-07-19 13:21:08 +02:00
..
include
alternate-any.err qapi: Forbid 'any' inside an alternate 2016-02-19 11:08:56 +01:00
alternate-any.exit qapi: Forbid 'any' inside an alternate 2016-02-19 11:08:56 +01:00
alternate-any.json qapi: Forbid 'any' inside an alternate 2016-02-19 11:08:56 +01:00
alternate-any.out qapi: Forbid 'any' inside an alternate 2016-02-19 11:08:56 +01:00
alternate-array.err
alternate-array.exit
alternate-array.json
alternate-array.out
alternate-base.err
alternate-base.exit
alternate-base.json
alternate-base.out
alternate-clash.err
alternate-clash.exit
alternate-clash.json
alternate-clash.out
alternate-conflict-dict.err
alternate-conflict-dict.exit
alternate-conflict-dict.json
alternate-conflict-dict.out
alternate-conflict-string.err
alternate-conflict-string.exit
alternate-conflict-string.json
alternate-conflict-string.out
alternate-empty.err qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
alternate-empty.exit qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
alternate-empty.json qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
alternate-empty.out qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
alternate-nested.err
alternate-nested.exit
alternate-nested.json
alternate-nested.out
alternate-unknown.err
alternate-unknown.exit
alternate-unknown.json
alternate-unknown.out
args-alternate.err
args-alternate.exit
args-alternate.json
args-alternate.out
args-any.err
args-any.exit
args-any.json
args-any.out
args-array-empty.err
args-array-empty.exit
args-array-empty.json
args-array-empty.out
args-array-unknown.err
args-array-unknown.exit
args-array-unknown.json
args-array-unknown.out
args-bad-boxed.err qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-bad-boxed.exit qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-bad-boxed.json qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-bad-boxed.out qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-anon.err qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-anon.exit qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-anon.json qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-anon.out qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-empty.err qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-empty.exit qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-empty.json qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-empty.out qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-string.err qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-string.exit qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-string.json qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-boxed-string.out qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-int.err
args-int.exit
args-int.json
args-int.out
args-invalid.err
args-invalid.exit
args-invalid.json
args-invalid.out
args-member-array-bad.err
args-member-array-bad.exit
args-member-array-bad.json
args-member-array-bad.out
args-member-case.err
args-member-case.exit
args-member-case.json
args-member-case.out
args-member-unknown.err
args-member-unknown.exit
args-member-unknown.json
args-member-unknown.out
args-name-clash.err
args-name-clash.exit
args-name-clash.json
args-name-clash.out
args-union.err qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-union.exit
args-union.json qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
args-union.out
args-unknown.err
args-unknown.exit
args-unknown.json
args-unknown.out
bad-base.err
bad-base.exit
bad-base.json
bad-base.out
bad-data.err
bad-data.exit
bad-data.json
bad-data.out
bad-ident.err
bad-ident.exit
bad-ident.json
bad-ident.out
bad-type-bool.err
bad-type-bool.exit
bad-type-bool.json
bad-type-bool.out
bad-type-dict.err
bad-type-dict.exit
bad-type-dict.json
bad-type-dict.out
bad-type-int.err
bad-type-int.exit
bad-type-int.json
bad-type-int.out
base-cycle-direct.err
base-cycle-direct.exit
base-cycle-direct.json
base-cycle-direct.out
base-cycle-indirect.err
base-cycle-indirect.exit
base-cycle-indirect.json
base-cycle-indirect.out
command-int.err
command-int.exit
command-int.json
command-int.out
comments.err
comments.exit
comments.json
comments.out qapi: Adjust names of implicit types 2016-03-18 10:29:25 +01:00
double-data.err
double-data.exit
double-data.json
double-data.out
double-type.err
double-type.exit
double-type.json
double-type.out
duplicate-key.err
duplicate-key.exit
duplicate-key.json
duplicate-key.out
empty.err
empty.exit
empty.json
empty.out qapi: Adjust names of implicit types 2016-03-18 10:29:25 +01:00
enum-bad-name.err
enum-bad-name.exit
enum-bad-name.json
enum-bad-name.out
enum-bad-prefix.err
enum-bad-prefix.exit
enum-bad-prefix.json
enum-bad-prefix.out
enum-clash-member.err
enum-clash-member.exit
enum-clash-member.json
enum-clash-member.out
enum-dict-member.err
enum-dict-member.exit
enum-dict-member.json
enum-dict-member.out
enum-int-member.err
enum-int-member.exit
enum-int-member.json
enum-int-member.out
enum-member-case.err
enum-member-case.exit
enum-member-case.json
enum-member-case.out
enum-missing-data.err
enum-missing-data.exit
enum-missing-data.json
enum-missing-data.out
enum-wrong-data.err
enum-wrong-data.exit
enum-wrong-data.json
enum-wrong-data.out
escape-outside-string.err
escape-outside-string.exit
escape-outside-string.json
escape-outside-string.out
escape-too-big.err
escape-too-big.exit
escape-too-big.json
escape-too-big.out
escape-too-short.err
escape-too-short.exit
escape-too-short.json
escape-too-short.out
event-boxed-empty.err qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
event-boxed-empty.exit qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
event-boxed-empty.json qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
event-boxed-empty.out qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
event-case.err
event-case.exit
event-case.json
event-case.out qapi: Plumb in 'boxed' to qapi generator lower levels 2016-07-19 13:21:08 +02:00
event-nest-struct.err
event-nest-struct.exit
event-nest-struct.json
event-nest-struct.out
flat-union-array-branch.err
flat-union-array-branch.exit
flat-union-array-branch.json
flat-union-array-branch.out
flat-union-bad-base.err qapi: Allow anonymous base for flat union 2016-03-18 10:29:26 +01:00
flat-union-bad-base.exit
flat-union-bad-base.json qapi: Allow anonymous base for flat union 2016-03-18 10:29:26 +01:00
flat-union-bad-base.out
flat-union-bad-discriminator.err
flat-union-bad-discriminator.exit
flat-union-bad-discriminator.json
flat-union-bad-discriminator.out
flat-union-base-any.err
flat-union-base-any.exit
flat-union-base-any.json
flat-union-base-any.out
flat-union-base-union.err
flat-union-base-union.exit
flat-union-base-union.json
flat-union-base-union.out
flat-union-clash-member.err
flat-union-clash-member.exit
flat-union-clash-member.json
flat-union-clash-member.out
flat-union-empty.err qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
flat-union-empty.exit qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
flat-union-empty.json qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
flat-union-empty.out qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
flat-union-incomplete-branch.err qapi: Require all branches of flat union enum to be covered 2016-07-19 13:21:08 +02:00
flat-union-incomplete-branch.exit qapi: Require all branches of flat union enum to be covered 2016-07-19 13:21:08 +02:00
flat-union-incomplete-branch.json qapi: Require all branches of flat union enum to be covered 2016-07-19 13:21:08 +02:00
flat-union-incomplete-branch.out qapi: Require all branches of flat union enum to be covered 2016-07-19 13:21:08 +02:00
flat-union-inline.err
flat-union-inline.exit
flat-union-inline.json
flat-union-inline.out
flat-union-int-branch.err
flat-union-int-branch.exit
flat-union-int-branch.json
flat-union-int-branch.out
flat-union-invalid-branch-key.err
flat-union-invalid-branch-key.exit
flat-union-invalid-branch-key.json
flat-union-invalid-branch-key.out
flat-union-invalid-discriminator.err
flat-union-invalid-discriminator.exit
flat-union-invalid-discriminator.json
flat-union-invalid-discriminator.out
flat-union-no-base.err
flat-union-no-base.exit
flat-union-no-base.json
flat-union-no-base.out
flat-union-optional-discriminator.err
flat-union-optional-discriminator.exit
flat-union-optional-discriminator.json
flat-union-optional-discriminator.out
flat-union-string-discriminator.err
flat-union-string-discriminator.exit
flat-union-string-discriminator.json
flat-union-string-discriminator.out
funny-char.err
funny-char.exit
funny-char.json
funny-char.out
ident-with-escape.err
ident-with-escape.exit
ident-with-escape.json
ident-with-escape.out qapi: Plumb in 'boxed' to qapi generator lower levels 2016-07-19 13:21:08 +02:00
include-before-err.err
include-before-err.exit
include-before-err.json
include-before-err.out
include-cycle-b.json
include-cycle-c.json
include-cycle.err
include-cycle.exit
include-cycle.json
include-cycle.out
include-format-err.err
include-format-err.exit
include-format-err.json
include-format-err.out
include-nested-err.err
include-nested-err.exit
include-nested-err.json
include-nested-err.out
include-no-file.err
include-no-file.exit
include-no-file.json
include-no-file.out
include-non-file.err
include-non-file.exit
include-non-file.json
include-non-file.out
include-relpath-sub.json
include-relpath.err
include-relpath.exit
include-relpath.json
include-relpath.out qapi: Adjust names of implicit types 2016-03-18 10:29:25 +01:00
include-repetition-sub.json
include-repetition.err
include-repetition.exit
include-repetition.json
include-repetition.out qapi: Adjust names of implicit types 2016-03-18 10:29:25 +01:00
include-self-cycle.err
include-self-cycle.exit
include-self-cycle.json
include-self-cycle.out
include-simple-sub.json
include-simple.err
include-simple.exit
include-simple.json
include-simple.out qapi: Adjust names of implicit types 2016-03-18 10:29:25 +01:00
indented-expr.err
indented-expr.exit
indented-expr.json
indented-expr.out qapi: Plumb in 'boxed' to qapi generator lower levels 2016-07-19 13:21:08 +02:00
leading-comma-list.err
leading-comma-list.exit
leading-comma-list.json
leading-comma-list.out
leading-comma-object.err
leading-comma-object.exit
leading-comma-object.json
leading-comma-object.out
missing-colon.err
missing-colon.exit
missing-colon.json
missing-colon.out
missing-comma-list.err
missing-comma-list.exit
missing-comma-list.json
missing-comma-list.out
missing-comma-object.err
missing-comma-object.exit
missing-comma-object.json
missing-comma-object.out
missing-type.err
missing-type.exit
missing-type.json
missing-type.out
nested-struct-data.err
nested-struct-data.exit
nested-struct-data.json
nested-struct-data.out
non-objects.err
non-objects.exit
non-objects.json
non-objects.out
qapi-schema-test.err
qapi-schema-test.exit
qapi-schema-test.json qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
qapi-schema-test.out qapi: Implement boxed types for commands/events 2016-07-19 13:21:08 +02:00
quoted-structural-chars.err
quoted-structural-chars.exit
quoted-structural-chars.json
quoted-structural-chars.out
redefined-builtin.err
redefined-builtin.exit
redefined-builtin.json
redefined-builtin.out
redefined-command.err
redefined-command.exit
redefined-command.json
redefined-command.out
redefined-event.err
redefined-event.exit
redefined-event.json
redefined-event.out
redefined-type.err
redefined-type.exit
redefined-type.json
redefined-type.out
reserved-command-q.err
reserved-command-q.exit
reserved-command-q.json
reserved-command-q.out
reserved-enum-q.err
reserved-enum-q.exit
reserved-enum-q.json
reserved-enum-q.out
reserved-member-has.err
reserved-member-has.exit
reserved-member-has.json
reserved-member-has.out
reserved-member-q.err
reserved-member-q.exit
reserved-member-q.json
reserved-member-q.out
reserved-member-u.err
reserved-member-u.exit
reserved-member-u.json
reserved-member-u.out
reserved-member-underscore.err
reserved-member-underscore.exit
reserved-member-underscore.json
reserved-member-underscore.out
reserved-type-kind.err
reserved-type-kind.exit
reserved-type-kind.json
reserved-type-kind.out
reserved-type-list.err
reserved-type-list.exit
reserved-type-list.json
reserved-type-list.out
returns-alternate.err
returns-alternate.exit
returns-alternate.json
returns-alternate.out
returns-array-bad.err
returns-array-bad.exit
returns-array-bad.json
returns-array-bad.out
returns-dict.err
returns-dict.exit
returns-dict.json
returns-dict.out
returns-unknown.err
returns-unknown.exit
returns-unknown.json
returns-unknown.out
returns-whitelist.err
returns-whitelist.exit
returns-whitelist.json
returns-whitelist.out
struct-base-clash-deep.err
struct-base-clash-deep.exit
struct-base-clash-deep.json
struct-base-clash-deep.out
struct-base-clash.err
struct-base-clash.exit
struct-base-clash.json
struct-base-clash.out
struct-data-invalid.err
struct-data-invalid.exit
struct-data-invalid.json
struct-data-invalid.out
struct-member-invalid.err
struct-member-invalid.exit
struct-member-invalid.json
struct-member-invalid.out
test-qapi.py qapi: Plumb in 'boxed' to qapi generator lower levels 2016-07-19 13:21:08 +02:00
trailing-comma-list.err
trailing-comma-list.exit
trailing-comma-list.json
trailing-comma-list.out
trailing-comma-object.err
trailing-comma-object.exit
trailing-comma-object.json
trailing-comma-object.out
type-bypass-bad-gen.err
type-bypass-bad-gen.exit
type-bypass-bad-gen.json
type-bypass-bad-gen.out
unclosed-list.err
unclosed-list.exit
unclosed-list.json
unclosed-list.out
unclosed-object.err
unclosed-object.exit
unclosed-object.json
unclosed-object.out
unclosed-string.err
unclosed-string.exit
unclosed-string.json
unclosed-string.out
unicode-str.err
unicode-str.exit
unicode-str.json
unicode-str.out
union-base-no-discriminator.err
union-base-no-discriminator.exit
union-base-no-discriminator.json
union-base-no-discriminator.out
union-branch-case.err
union-branch-case.exit
union-branch-case.json
union-branch-case.out
union-clash-branches.err
union-clash-branches.exit
union-clash-branches.json
union-clash-branches.out
union-empty.err qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
union-empty.exit qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
union-empty.json qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
union-empty.out qapi: Forbid empty unions and useless alternates 2016-02-19 11:08:56 +01:00
union-invalid-base.err
union-invalid-base.exit
union-invalid-base.json
union-invalid-base.out
union-optional-branch.err
union-optional-branch.exit
union-optional-branch.json
union-optional-branch.out
union-unknown.err
union-unknown.exit
union-unknown.json
union-unknown.out
unknown-escape.err
unknown-escape.exit
unknown-escape.json
unknown-escape.out
unknown-expr-key.err
unknown-expr-key.exit
unknown-expr-key.json
unknown-expr-key.out