qemu-stable
[Top][All Lists]
Advanced

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

Re: [Qemu-stable] [Qemu-devel] [PATCH v4 5/7] qmp: Fix device-list-prope


From: Markus Armbruster
Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH v4 5/7] qmp: Fix device-list-properties not to crash for abstract device
Date: Tue, 29 Sep 2015 14:44:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Thomas Huth <address@hidden> writes:

> On 28/09/15 22:08, Markus Armbruster wrote:
>> Broken in commit f4eb32b "qmp: show QOM properties in
>> device-list-properties", v2.1.
>> 
>> Cc: address@hidden
>> Signed-off-by: Markus Armbruster <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
>> ---
>>  qmp.c                          |  6 ++++++
>>  tests/device-introspect-test.c | 15 ++++-----------
>>  2 files changed, 10 insertions(+), 11 deletions(-)
>> 
>> diff --git a/qmp.c b/qmp.c
>> index 057a7cb..1413de4 100644
>> --- a/qmp.c
>> +++ b/qmp.c
>> @@ -515,6 +515,12 @@ DevicePropertyInfoList 
>> *qmp_device_list_properties(const char *typename,
>>          return NULL;
>>      }
>>  
>> +    if (object_class_is_abstract(klass)) {
>> +        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name",
>> +                   "non-abstract device type");
>> +        return NULL;
>> +    }
>> +
>>      obj = object_new(typename);
>>  
>>      QTAILQ_FOREACH(prop, &obj->properties, node) {
>> diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c
>> index 832b60a..a8950a1 100644
>> --- a/tests/device-introspect-test.c
>> +++ b/tests/device-introspect-test.c
>> @@ -45,17 +45,10 @@ static void test_one_device(const char *type)
>>      QDict *resp;
>>      char *help, *qom_tree;
>>  
>> -    /*
>> -     * Skip this part for the abstract device test case, because
>> -     * device-list-properties crashes for such devices.
>> -     * FIXME fix it not to crash
>> -     */
>> -    if (strcmp(type, "device")) {
>> -        resp = qmp("{'execute': 'device-list-properties',"
>> -                   " 'arguments': {'typename': %s}}",
>> -                   type);
>> -        QDECREF(resp);
>> -    }
>> +    resp = qmp("{'execute': 'device-list-properties',"
>> +               " 'arguments': {'typename': %s}}",
>> +               type);
>> +    QDECREF(resp);
>>  
>>      help = hmp("device_add \"%s,help\"", type);
>>      g_free(help);
>> 
>
> Why don't you fix this before patch 4/7, then you don't have to add the
> temporary work-around in device-introspect-test.c ?

I really, really like to demonstrate bugs with tests first, then fix
them.

Unfortunately, we don't seem to have a way to say "this test is expected
to fail", so I need a bit of extra scaffolding to make it pass.  I think
it still serves okay for demonstrating the bugs.



reply via email to

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