Received: from eggs.gnu.org ([2001:4830:134:3::10]:60922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz1yk-0002Mz-UB for qemu-devel@nongnu.org; Tue, 25 Oct 2016 09:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz1yg-00039y-UH for qemu-devel@nongnu.org; Tue, 25 Oct 2016 09:41:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49994) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bz1yg-00039o-MB for qemu-devel@nongnu.org; Tue, 25 Oct 2016 09:41:18 -0400 References: <1477323383-12380-1-git-send-email-eblake@redhat.com> <1477323383-12380-3-git-send-email-eblake@redhat.com> <87twc03cwx.fsf@dusky.pond.sub.org> From: Eric Blake Message-ID: Date: Tue, 25 Oct 2016 08:41:16 -0500 MIME-Version: 1.0 In-Reply-To: <87twc03cwx.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cTVrPTaPNoPn5D9H0Uf0v6gs74HPHiRxk" Subject: Re: [Qemu-devel] [PATCH 2/2] tests: Enhance qmp output to cover partial visit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth , ptoscano@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cTVrPTaPNoPn5D9H0Uf0v6gs74HPHiRxk From: Eric Blake To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth , ptoscano@redhat.com Message-ID: Subject: Re: [Qemu-devel] [PATCH 2/2] tests: Enhance qmp output to cover partial visit References: <1477323383-12380-1-git-send-email-eblake@redhat.com> <1477323383-12380-3-git-send-email-eblake@redhat.com> <87twc03cwx.fsf@dusky.pond.sub.org> In-Reply-To: <87twc03cwx.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/25/2016 06:07 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> 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 >> +static void test_visitor_out_partial_visit(TestOutputVisitorData *dat= a, >> + const void *unused) >> +{ >> + /* Check that aborting mid-visit doesn't leak or double-free */ >> + visit_start_struct(data->ov, NULL, NULL, 0, &error_abort); >> + visit_start_struct(data->ov, "nested", NULL, 0, &error_abort); >> + visitor_reset(data); >=20 > Add a second test that additionally visits a member? Or is visiting th= e > "nested" member enough? Visiting "nested" was enough to trigger the particular valgrind trace I wanted, but more coverage never hurts. I'll send v2... > Would you be willing to do the same for lists and alternates? =2E..and it will also cover these. >=20 > Speaking of alternates, visitor.h's virtual walk example covers struct > and list, but not alternate. Sounds like my v2 will be a longer series :) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --cTVrPTaPNoPn5D9H0Uf0v6gs74HPHiRxk Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYD2D8AAoJEKeha0olJ0Nq2NwH/RyE2WeBAnDQMnjSVMZkcsuj b8FihTIbH2f/6QDdZ4ipWzCofTSzdEQI4bX1M5c4V4jKhqjFJMAMRcL5XsM+G3ha b7QHInBE96T2DHtEyiZPY7zVuXsSFsyjKmVMVQJHpUwwZGphLXpE8PygySVFCZUJ TaD+bf44J4TTserN1eUSnoEO1qd33UjKUtKs1hsHbMj8uhYAI9BJ1YJwnlamvoCg voMQGCTGWeXB6Uld29frMQ6G/ZbleaENeCZdN38kMLl9TifuYmALM+XnP8BUev1E HJNOaxzA7V8CIHde52qtQ9IsU9cNU5XcJRmETrOCuAi3kWfG9puZjO4C46XwACQ= =sRSW -----END PGP SIGNATURE----- --cTVrPTaPNoPn5D9H0Uf0v6gs74HPHiRxk--