From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdfF6-0005Db-VI for qemu-devel@nongnu.org; Tue, 05 Nov 2013 06:56:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdfF2-0001Dh-3o for qemu-devel@nongnu.org; Tue, 05 Nov 2013 06:56:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdfF1-0001Dc-Q0 for qemu-devel@nongnu.org; Tue, 05 Nov 2013 06:56:16 -0500 Message-ID: <5278DCDD.1060603@redhat.com> Date: Tue, 05 Nov 2013 04:56:13 -0700 From: Eric Blake MIME-Version: 1.0 References: <1383141276-19230-1-git-send-email-stefanha@redhat.com> <1383141276-19230-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1383141276-19230-5-git-send-email-stefanha@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KJwCMSoAUx89Kul8saON7JSMhjVefRGav" Subject: Re: [Qemu-devel] [PATCH v3 4/7] libqtest: add qmp(fmt, ...) -> QDict* function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Paolo Bonzini , Andreas Faerber , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KJwCMSoAUx89Kul8saON7JSMhjVefRGav Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10/30/2013 07:54 AM, Stefan Hajnoczi wrote: > Add a qtest qmp() function that returns the response object. This > allows test cases to verify the result or to check for error responses.= > It also allows waiting for QMP events. >=20 > Signed-off-by: Stefan Hajnoczi > --- > tests/libqtest.c | 66 ++++++++++++++++++++++++++++++++++++++++++++----= -------- > tests/libqtest.h | 37 +++++++++++++++++++++++++++++++ > 2 files changed, 89 insertions(+), 14 deletions(-) Reviewed-by: Eric Blake > +static void qmp_response(JSONMessageParser *parser, QList *tokens) > { > - bool has_reply =3D false; > - int nesting =3D 0; > + QMPResponseParser *qmp =3D container_of(parser, QMPResponseParser,= parser); > + QObject *obj; > + > + obj =3D json_parser_parse(tokens, NULL); > + if (!obj) { > + fprintf(stderr, "QMP JSON response parsing failed\n"); > + exit(1); I prefer EXIT_FAILURE, but you're not the first person to use 1 instead. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --KJwCMSoAUx89Kul8saON7JSMhjVefRGav Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSeNzdAAoJEKeha0olJ0Nq4XQIAKl0Z2v3jDmXjeyTQaMKNXSk HJRsDKNVmv5Obc8/kmxRU1dFFzmrL4SSMgVdm2uf8WuImMW3Ox0FWex5Taly4tHv HBxmoMAIgH6FBwzPxEOtU5U50oB0DXapo9fGJcedoZy9jIC5qOwrFU76al9ExFOi Cr9O1ie0Kfjw+QSe6NbKkvIsTa3B3/ChOc0qkmUa+lUkAAKmzgPpTi2PVL6GhsFV t4Mh/GQPtX0GgLR43DhLRUnZp+P1D4vQeeHJzMYQA/HG3uOM/M5owq/TYoIiczT8 Csr0VhliJ5NS1rldGXeEUXYk3BwDnmm5VJLfDOgGxUmti3kSDgXjzhdrTwojdk0= =YkG1 -----END PGP SIGNATURE----- --KJwCMSoAUx89Kul8saON7JSMhjVefRGav--