Received: from eggs.gnu.org ([2001:4830:134:3::10]:36923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2MAS-0002oi-5t for qemu-devel@nongnu.org; Thu, 03 Nov 2016 13:51:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2MAP-0002Jj-3p for qemu-devel@nongnu.org; Thu, 03 Nov 2016 13:51:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34618) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c2MAO-0002JK-SK for qemu-devel@nongnu.org; Thu, 03 Nov 2016 13:51:09 -0400 References: <1477516358-15039-1-git-send-email-eblake@redhat.com> <1477516718-15439-3-git-send-email-eblake@redhat.com> <87shr8wm4r.fsf@dusky.pond.sub.org> From: Eric Blake Message-ID: Date: Thu, 3 Nov 2016 12:51:06 -0500 MIME-Version: 1.0 In-Reply-To: <87shr8wm4r.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sxk9iqVpOhAKggWGc5eRL1qdghwlpji23" Subject: Re: [Qemu-devel] [PATCH v2 3/3] tests: Enhance qobject 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) --sxk9iqVpOhAKggWGc5eRL1qdghwlpji23 From: Eric Blake To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth , ptoscano@redhat.com Message-ID: Subject: Re: [Qemu-devel] [PATCH v2 3/3] tests: Enhance qobject output to cover partial visit References: <1477516358-15039-1-git-send-email-eblake@redhat.com> <1477516718-15439-3-git-send-email-eblake@redhat.com> <87shr8wm4r.fsf@dusky.pond.sub.org> In-Reply-To: <87shr8wm4r.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/03/2016 11:42 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) >> +{ >> + /* Various checks that a mid-visit abort doesn't leak or double-f= ree. */ >> + const char *str =3D "hi"; >> + Error *err =3D NULL; >> + UserDefAlternate uda =3D { .type =3D QTYPE_QDICT, >> + .u.udfu =3D { .integer =3D 1, >> + .string =3D (char *) "bye", >> + .enum1 =3D -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.ud= fu, >> + &err); >> + error_free_or_abort(&err); >=20 > Why does this fail? =2E..so visiting the UnionBase_members gripes loudly. But I see your point that more comments would be helpful. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sxk9iqVpOhAKggWGc5eRL1qdghwlpji23 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/ iQEcBAEBCAAGBQJYG3kKAAoJEKeha0olJ0Nq3HEH/iDrz9o9rz5IhDHnKOHitR8a ISfjncMfb7QN2Tzq5fVi4yGzpYIGr4AGY2j+GpS//aZ6MfxYkmhvDhOsJ8wJ5tfV TtyKi1FAtnTV5EffZKqZq2g3zi5+OdVcv4B5sAO/fpTE+YhRtJRINfm8rk9+gZxs gRuaT5JL1QpPhMvtuRRlu4ojsQx3qEtof39EJJX/iQSEs9crD9QM3Py2kGZxv/fL 9OH0cd2S91gjGwa+97GdzyiA0g8+a+qTJooaa4Ws/7l9G4THaH0ZRO6st/VdalgX +I1jox7w9tk0Hkb4p57GF0hRzj4eg85Pl4XCwELuwc0F99hMNa8Ubox5H1pld8w= =o8OV -----END PGP SIGNATURE----- --sxk9iqVpOhAKggWGc5eRL1qdghwlpji23--