[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 19/22] libqtest: Add qmp_args_dict() helper
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v4 19/22] libqtest: Add qmp_args_dict() helper |
Date: |
Thu, 10 Aug 2017 10:19:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 08/09/2017 10:59 AM, Markus Armbruster wrote:
>> Eric Blake <address@hidden> writes:
>>
>>> Leaving interpolation into JSON to qobject_from_jsonf() is more
>>> robust than building QMP input manually; however, we have a few
>>> places where code is already creating a QDict to interpolate
>>> individual arguments, which cannot be reproduced with the
>>> qobject_from_jsonf() parser. Expose a public wrapper
>>> qmp_args_dict() for the internal helper qmp_args_dict_async()
>>> that we needed earlier for qmp_args(), and fix a test to use
>>> the new helper.
>>>
>>> Signed-off-by: Eric Blake <address@hidden>
>>> ---
>
>>> +++ b/tests/device-introspect-test.c
>>> @@ -36,8 +36,7 @@ static QList *qom_list_types(const char *implements, bool
>>> abstract)
>>> if (implements) {
>>> qdict_put_str(args, "implements", implements);
>>> }
>>> - resp = qmp("{'execute': 'qom-list-types',"
>>> - " 'arguments': %p }", args);
>>> + resp = qmp_args_dict("qom-list-types", args);
>>> g_assert(qdict_haskey(resp, "return"));
>>> ret = qdict_get_qlist(resp, "return");
>>> QINCREF(ret);
>>
>> If we had five of these, the helper would be worth its keep.
>
> This patch only has one client, but 20/22 adds another. Is having 2
> clients sufficient to keep it (not quite the 5 that makes it obvious,
> but still a good reuse of code)?
Your idea to use macros might make this a moot question. Let's revisit
it in v2.
- Re: [Qemu-devel] [PATCH v4 15/22] libqtest: Delete qtest_qmp() wrappers, (continued)
[Qemu-devel] [PATCH v4 14/22] libqtest: Separate qmp_discard_response() from command, Eric Blake, 2017/08/03
[Qemu-devel] [PATCH v4 18/22] tests/libqos/usb: Clean up string interpolation into QMP input, Eric Blake, 2017/08/03
[Qemu-devel] [PATCH v4 19/22] libqtest: Add qmp_args_dict() helper, Eric Blake, 2017/08/03
[Qemu-devel] [PATCH v4 21/22] libqtest: Drop now-unused qmp(), Eric Blake, 2017/08/03
[Qemu-devel] [PATCH v4 16/22] libqtest: Add qmp_cmd() helper, Eric Blake, 2017/08/03
[Qemu-devel] [PATCH v4 17/22] libqtest: Add qmp_args() helper, Eric Blake, 2017/08/03