As argued elsewhere, it's less code to maintain if we convert from a dynamic string passed to qobject_from_jsonv() to instead use a hand-built QDict.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- tests/device-introspect-test.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index 37debc1..9655a49 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -19,6 +19,8 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" #include "libqtest.h" @@ -28,10 +30,11 @@ static QList *device_type_list(bool abstract) { QDict *resp; QList *ret; + QDict *args = qdict_new(); - resp = qmp("{'execute': 'qom-list-types'," - " 'arguments': {'implements': 'device', 'abstract': %i}}", - abstract); + qdict_put_str(args, "implements", "device"); + qdict_put_bool(args, "abstract", abstract); + resp = qmp_cmd("qom-list-types", args); g_assert(qdict_haskey(resp, "return")); ret = qdict_get_qlist(resp, "return"); QINCREF(ret); @@ -43,10 +46,10 @@ static void test_one_device(const char *type) { QDict *resp; char *help, *qom_tree; + QDict *args = qdict_new(); - resp = qmp("{'execute': 'device-list-properties'," - " 'arguments': {'typename': %s}}", - type); + qdict_put_str(args, "typename", type); + resp = qmp_cmd("device-list-properties", args); QDECREF(resp); help = hmp("device_add \"%s,help\"", type); -- 2.7.4