qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/9] tests/libqos/pci: Clean up string interpola


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 6/9] tests/libqos/pci: Clean up string interpolation into QMP input
Date: Thu, 27 Jul 2017 10:31:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 07/21/2017 08:53 AM, Markus Armbruster wrote:
>> Leaving interpolation into JSON to qmp() is more robust than building
>> QMP input manually, as explained in the commit before previous.
>> 
>> The case in qpci_plug_device_test() is a bit complicated: it
>> interpolates several JSON object members, not just a value.  Clean it
>> up by passing them in as QDict rather than string, so we can leave
>> interpolation to qmp() here and to qobject_from_jsonf() in callers.
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>
>> +    QObject *extra_args = qobject_from_jsonf("{ 'shm': '%s', 'size': '1M' 
>> }",
>> +                                             tmpshm);
>>  
>>      qtest_start("");
>>  
>> -    opts = g_strdup_printf("'shm': '%s', 'size': '1M'", tmpshm);
>> -
>> -    qpci_plug_device_test("ivshmem", "iv1", PCI_SLOT_HP, opts);
>
> Wait, 'size':'1M' works?  I guess because it's a string, rather than a
> JSON number.  One of our intentional design choices in QMP was to
> represent everything as bytes, rather than as suffixed numbers, since
> machine-generated code can easily generate bytes anywhere that humans
> prefer a suffixed number.  But as you are not changing this interface,
> but merely refactoring how it is tested, it's more of a side comment
> than something that affects review.

Design mistake in legacy device "ivshmem".  Fixed in "ivshmem-plain" and
"ivshmem-doorbell", see commit 5400c02.



reply via email to

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