From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: ptoscano@redhat.com, qemu-devel@nongnu.org,
Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/3] tests: Enhance qobject output to cover partial visit
Date: Fri, 04 Nov 2016 08:27:23 +0100 [thread overview]
Message-ID: <87k2cjso10.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <d39af04c-18fe-f890-3ff6-e3da405b3acf@redhat.com> (Eric Blake's message of "Thu, 3 Nov 2016 12:51:06 -0500")
Eric Blake <eblake@redhat.com> writes:
> On 11/03/2016 11:42 AM, Markus Armbruster wrote:
>> Eric Blake <eblake@redhat.com> 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 <eblake@redhat.com>
>
>>> +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...
Now I see.
>>> +
>>> + /* 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.
Would you like to suggest a fixup for me to squash in on commit?
next prev parent reply other threads:[~2016-11-04 7:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 21:12 [Qemu-devel] [PATCH v2 0/3] qmp output visitor test improvement Eric Blake
2016-10-26 21:18 ` [Qemu-devel] [PATCH v2 1/3] tests: Simplify expected error checking for qmp output Eric Blake
2016-10-26 21:18 ` [Qemu-devel] [PATCH v2 2/3] qapi: Further enhance visitor virtual walk doc example Eric Blake
2016-10-26 21:18 ` [Qemu-devel] [PATCH v2 3/3] tests: Enhance qobject output to cover partial visit Eric Blake
2016-11-03 16:42 ` Markus Armbruster
2016-11-03 17:51 ` Eric Blake
2016-11-04 7:27 ` Markus Armbruster [this message]
2016-11-04 13:16 ` [Qemu-devel] [PATCH v2 3.5/3] fixup! " Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2cjso10.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=ptoscano@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.