--- tests/test-qmp-cmds.c | 8 +++++++- tests/qapi-schema/qapi-schema-test.json | 6 ++++++ tests/qapi-schema/qapi-schema-test.out | 6 +++++- 3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c index eaf30b7a0f..840530b84c 100644 --- a/tests/test-qmp-cmds.c +++ b/tests/test-qmp-cmds.c @@ -13,11 +13,17 @@ static QmpCommandList qmp_commands; /* #if defined(TEST_IF_STRUCT) && defined(TEST_IF_CMD) */ -void qmp_TestIfCmd(TestIfStruct *foo, Error **errp) +UserDefThree *qmp_TestIfCmd(TestIfStruct *foo, Error **errp) { + return NULL; } /* #endif */ +UserDefThree *qmp_TestCmdReturnDefThree(Error **errp) +{ + return NULL; +} + void qmp_user_def_cmd(Error **errp) { } diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index ec0fea804f..16209b57b3 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -56,6 +56,9 @@ 'data': { 'string0': 'str', 'dict1': 'UserDefTwoDict' } } +{ 'struct': 'UserDefThree', + 'data': { 'string0': 'str' } } + # dummy struct to force generation of array types not otherwise mentioned { 'struct': 'ForceArrays', 'data': { 'unused1':['UserDefOne'], 'unused2':['UserDefTwo'], @@ -209,7 +212,10 @@ 'if': 'defined(TEST_IF_ALT) && defined(TEST_IF_STRUCT)' } { 'command': 'TestIfCmd', 'data': { 'foo': 'TestIfStruct' }, + 'returns': 'UserDefThree', 'if': ['defined(TEST_IF_CMD)', 'defined(TEST_IF_STRUCT)'] } +{ 'command': 'TestCmdReturnDefThree', 'returns': 'UserDefThree' } + { 'event': 'TestIfEvent', 'data': { 'foo': 'TestIfStruct' }, 'if': 'defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT)' } diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out index 34b6d546f3..ed25e5b60c 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -36,6 +36,8 @@ object UserDefTwoDict object UserDefTwo member string0: str optional=False member dict1: UserDefTwoDict optional=False +object UserDefThree + member string0: str optional=False object ForceArrays member unused1: UserDefOneList optional=False member unused2: UserDefTwoList optional=False @@ -249,7 +251,9 @@ alternate TestIfAlternate case bar: TestStruct object q_obj_TestIfCmd-arg member foo: TestIfStruct optional=False -command TestIfCmd q_obj_TestIfCmd-arg -> None +command TestIfCmd q_obj_TestIfCmd-arg -> UserDefThree + gen=True success_response=True boxed=False oob=False preconfig=False +command TestCmdReturnDefThree None -> UserDefThree gen=True success_response=True boxed=False oob=False preconfig=False object q_obj_TestIfEvent-arg member foo: TestIfStruct optional=False -- 2.18.0.rc1