[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: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v4 19/22] libqtest: Add qmp_args_dict() helper |
Date: |
Wed, 9 Aug 2017 11:41:56 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
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)?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- 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