From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLeXU-0008A0-Cc for qemu-devel@nongnu.org; Thu, 06 Mar 2014 15:05:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLeXP-0005RN-DK for qemu-devel@nongnu.org; Thu, 06 Mar 2014 15:05:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLeXP-0005QG-4A for qemu-devel@nongnu.org; Thu, 06 Mar 2014 15:05:03 -0500 Message-ID: <5318D4EC.4040809@redhat.com> Date: Thu, 06 Mar 2014 13:05:00 -0700 From: Eric Blake MIME-Version: 1.0 References: <1388704234-22498-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1388704234-22498-5-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1388704234-22498-5-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UH6NSIux0g2AabTsBwRRoI3enKr8AE0a7" Subject: Re: [Qemu-devel] [RFC PATCH V2 4/5] test: add test cases for qapi event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia , qemu-devel@nongnu.org Cc: mreitz@redhat.com, armbru@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --UH6NSIux0g2AabTsBwRRoI3enKr8AE0a7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/02/2014 04:10 PM, Wenchao Xia wrote: > These cases will verify whether the expected qdict is built. >=20 > Signed-off-by: Wenchao Xia > --- > tests/Makefile | 14 ++- > tests/qapi-schema/qapi-schema-test.json | 12 ++ > tests/qapi-schema/qapi-schema-test.out | 10 +- > tests/test-qmp-event.c | 254 +++++++++++++++++++++++= ++++++++ > 4 files changed, 285 insertions(+), 5 deletions(-) > create mode 100644 tests/test-qmp-event.c >=20 > + > +/* This function is hooked as final emit funtion, which can verify the= > + correctness. */ > +static void event_test_emit(QAPIEvent ev, QDict *d, Error **errp) s/funtion/function/ > +{ > + QObject *obj; > + QDict *t; > + > + /* Verify that we have timestamp, then remove it to compare other = field */ > + obj =3D qdict_get(d, "timestamp"); > + g_assert(obj); > + t =3D qobject_to_qdict(obj); > + g_assert(t); > + obj =3D qdict_get(t, "seconds"); > + g_assert(obj && qobject_type(obj) =3D=3D QTYPE_QINT); > + obj =3D qdict_get(t, "microseconds"); > + g_assert(obj && qobject_type(obj) =3D=3D QTYPE_QINT); > + > + qdict_del(d, "timestamp"); Should you also check that no other fields besides seconds and microseconds were in the timestamp dictionary? With the typo fixed, Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --UH6NSIux0g2AabTsBwRRoI3enKr8AE0a7 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTGNTsAAoJEKeha0olJ0NqfB8H/2aQg7/okVBOl9P94VYMJioj VHETqnixZlLTz257qDWpfqXVK3qMU1ptdG1UJtqo3RpCkNX0XojZDXv7rykpF6GO h7YB3xylnY/DTkapkuuXoUNHHzhP0l9wsTmW2pHC7CFgxo8LAbZ39CZrQcSs85ti MEPKS95VP2ai0BSTCdF29GV/LHh249NCz9aqrYvHl2lYFcy2BJGJnO0BNysPalns anGyJ986Ub8EaUiINerrfoPZeEZFstuI/2TRvVhb8YDlsdL1h2MiwB6gxY8TpYhP CrfPsOPbExZw0Y5c4I3rdjIoHkPXwbgHLGAgCycwJUFgcKy+v3JTASf2TS1hhz0= =ecYr -----END PGP SIGNATURE----- --UH6NSIux0g2AabTsBwRRoI3enKr8AE0a7--