qemu-devel
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]