qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 3/3] tests: Enhance qobject output to cover p


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 3/3] tests: Enhance qobject output to cover partial visit
Date: Thu, 3 Nov 2016 12:51:06 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 11/03/2016 11:42 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> Add a test that proves (at least when run under valgrind) that
>> we are correctly handling allocated memory even when a visit
>> is aborted in the middle for whatever other reason.
>>
>> See commit f24582d "qapi: fix double free in
>> qmp_output_visitor_cleanup()" for a fix that was lacking
>> testsuite exposure prior to this patch.
>>
>> Signed-off-by: Eric Blake <address@hidden>

>> +static void test_visitor_out_partial_visit(TestOutputVisitorData *data,
>> +                                           const void *unused)
>> +{
>> +    /* Various checks that a mid-visit abort doesn't leak or double-free. */
>> +    const char *str = "hi";
>> +    Error *err = NULL;
>> +    UserDefAlternate uda = { .type = QTYPE_QDICT,
>> +                             .u.udfu = { .integer = 1,
>> +                                         .string = (char *) "bye",
>> +                                         .enum1 = -1 } };

^ Not a valid enum value...


>> +
>> +    /* Abort in the middle of an alternate. Alternates can't be
>> +     * virtually visited, so we get to inline the first half of
>> +     * visit_type_UserDefAlternate(). */
>> +    visit_start_alternate(data->ov, NULL, (GenericAlternate **)&obj,
>> +                          sizeof(uda), false, &error_abort);
>> +    visit_start_struct(data->ov, NULL, NULL, 0, &error_abort);
>> +    visit_type_UserDefUnionBase_members(data->ov,
>> +                                        (UserDefUnionBase *)&uda.u.udfu,
>> +                                        &err);
>> +    error_free_or_abort(&err);
> 
> Why does this fail?

...so visiting the UnionBase_members gripes loudly.  But I see your
point that more comments would be helpful.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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