mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 20:19:44 +00:00
tests/qapi-schema: Correct two 'if' conditionals
A definition's conditional should imply the conditionals of types it
uses. If it doesn't, some configurations won't compile.
Example (from tests/qapi-schema/qapi-schema-test.json):
{ 'union': 'TestIfUnion', 'data':
{ 'foo': 'TestStruct',
'bar': { 'type': 'str', 'if': 'TEST_IF_UNION_BAR'} },
'if': { 'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT'] } }
{ 'command': 'test-if-union-cmd',
'data': { 'union-cmd-arg': 'TestIfUnion' },
'if': 'TEST_IF_UNION' }
generates
#if (defined(TEST_IF_UNION)) && (defined(TEST_IF_STRUCT))
typedef struct TestIfUnion TestIfUnion;
#endif /* (defined(TEST_IF_UNION)) && (defined(TEST_IF_STRUCT)) */
and
#if defined(TEST_IF_UNION)
void qmp_test_if_union_cmd(TestIfUnion *union_cmd_arg, Error **errp);
void qmp_marshal_test_if_union_cmd(QDict *args, QObject **ret, Error **errp);
#endif /* defined(TEST_IF_UNION) */
which doesn't compile when !defined(TEST_IF_STRUCT).
Messed up in f8c4fdd6ae
"tests/qapi: Cover commands with 'if' and
union / alternate 'data'", v4.0.0. Harmless, as we don't actually use
this configuration. Correct it anyway, along with another instance.
This loses coverage for 'not'. The next commit will bring it back.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-4-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
e46c930cdd
commit
cdcc04fa03
@ -236,7 +236,7 @@
|
|||||||
|
|
||||||
{ 'command': 'test-if-union-cmd',
|
{ 'command': 'test-if-union-cmd',
|
||||||
'data': { 'union-cmd-arg': 'TestIfUnion' },
|
'data': { 'union-cmd-arg': 'TestIfUnion' },
|
||||||
'if': 'TEST_IF_UNION' }
|
'if': { 'all': ['TEST_IF_UNION', 'TEST_IF_STRUCT'] } }
|
||||||
|
|
||||||
{ 'alternate': 'TestIfAlternate', 'data':
|
{ 'alternate': 'TestIfAlternate', 'data':
|
||||||
{ 'foo': 'int',
|
{ 'foo': 'int',
|
||||||
@ -245,8 +245,7 @@
|
|||||||
|
|
||||||
{ 'command': 'test-if-alternate-cmd',
|
{ 'command': 'test-if-alternate-cmd',
|
||||||
'data': { 'alt-cmd-arg': 'TestIfAlternate' },
|
'data': { 'alt-cmd-arg': 'TestIfAlternate' },
|
||||||
'if': { 'all': ['TEST_IF_ALT',
|
'if': { 'all': ['TEST_IF_ALT', 'TEST_IF_STRUCT'] } }
|
||||||
{'not': 'TEST_IF_NOT_ALT'}] } }
|
|
||||||
|
|
||||||
{ 'command': 'test-if-cmd',
|
{ 'command': 'test-if-cmd',
|
||||||
'data': {
|
'data': {
|
||||||
|
@ -321,10 +321,10 @@ object TestIfUnion
|
|||||||
if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])])
|
if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])])
|
||||||
object q_obj_test-if-union-cmd-arg
|
object q_obj_test-if-union-cmd-arg
|
||||||
member union-cmd-arg: TestIfUnion optional=False
|
member union-cmd-arg: TestIfUnion optional=False
|
||||||
if TEST_IF_UNION
|
if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])])
|
||||||
command test-if-union-cmd q_obj_test-if-union-cmd-arg -> None
|
command test-if-union-cmd q_obj_test-if-union-cmd-arg -> None
|
||||||
gen=True success_response=True boxed=False oob=False preconfig=False
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
||||||
if TEST_IF_UNION
|
if OrderedDict([('all', ['TEST_IF_UNION', 'TEST_IF_STRUCT'])])
|
||||||
alternate TestIfAlternate
|
alternate TestIfAlternate
|
||||||
tag type
|
tag type
|
||||||
case foo: int
|
case foo: int
|
||||||
@ -333,10 +333,10 @@ alternate TestIfAlternate
|
|||||||
if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])])
|
if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])])
|
||||||
object q_obj_test-if-alternate-cmd-arg
|
object q_obj_test-if-alternate-cmd-arg
|
||||||
member alt-cmd-arg: TestIfAlternate optional=False
|
member alt-cmd-arg: TestIfAlternate optional=False
|
||||||
if OrderedDict([('all', ['TEST_IF_ALT', OrderedDict([('not', 'TEST_IF_NOT_ALT')])])])
|
if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])])
|
||||||
command test-if-alternate-cmd q_obj_test-if-alternate-cmd-arg -> None
|
command test-if-alternate-cmd q_obj_test-if-alternate-cmd-arg -> None
|
||||||
gen=True success_response=True boxed=False oob=False preconfig=False
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
||||||
if OrderedDict([('all', ['TEST_IF_ALT', OrderedDict([('not', 'TEST_IF_NOT_ALT')])])])
|
if OrderedDict([('all', ['TEST_IF_ALT', 'TEST_IF_STRUCT'])])
|
||||||
object q_obj_test-if-cmd-arg
|
object q_obj_test-if-cmd-arg
|
||||||
member foo: TestIfStruct optional=False
|
member foo: TestIfStruct optional=False
|
||||||
member bar: TestIfEnum optional=False
|
member bar: TestIfEnum optional=False
|
||||||
|
Loading…
Reference in New Issue
Block a user