From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPaDH-0004St-ID for qemu-devel@nongnu.org; Mon, 17 Mar 2014 12:16:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPaDD-0005K9-2m for qemu-devel@nongnu.org; Mon, 17 Mar 2014 12:16:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPaDC-0005Jw-Ry for qemu-devel@nongnu.org; Mon, 17 Mar 2014 12:16:27 -0400 Message-ID: <53271FCC.6010504@redhat.com> Date: Mon, 17 Mar 2014 10:16:12 -0600 From: Eric Blake MIME-Version: 1.0 References: <1395004716-20229-1-git-send-email-l@dorileo.org> In-Reply-To: <1395004716-20229-1-git-send-email-l@dorileo.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cfifc9LgaOEIAotFxiaPTi3G1pPwJMmIj" Subject: Re: [Qemu-devel] [PATCH] QemuOpt: add unit tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leandro Dorileo , qemu-devel@nongnu.org Cc: Wenchao Xia , Stefan Hajnoczi , Chunyan Liu , Markus Armbruster , Anthony Liguori , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cfifc9LgaOEIAotFxiaPTi3G1pPwJMmIj Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/16/2014 03:18 PM, Leandro Dorileo wrote: > Cover basic aspects and API usage for QemuOpt. The current implementati= on > covers the API's planed to be changed by Chunyan Liu in his QEMUOptionP= arameter s/planed/planned/ > replacement/cleanup job. >=20 > Other APIs should be covered in future improvements. >=20 > Signed-off-by: Leandro Dorileo > --- > tests/Makefile | 3 + > tests/test-qemu-opts.c | 309 +++++++++++++++++++++++++++++++++++++++++= ++++++++ > 2 files changed, 312 insertions(+) > create mode 100644 tests/test-qemu-opts.c >=20 > + > +static void test_find_unknown_opts(void) > +{ > + QemuOptsList *list; > + > + register_opts(); > + > + /** should not return anything, we don't known "unknown" option */= s/known/have an/ Here, and throughout the file: /** */ comments are special to doc markup, and should only be needed prior to declaring a function. Within a function body, use the simpler /* */ comment. > +static void test_qemu_find_opts(void) > +{ > + QemuOptsList *list; > + > + register_opts(); > + > + /** we have an rtc option, should return it */ > + list =3D qemu_find_opts("opts_list_01"); > + g_assert(list !=3D NULL); Should you do any further testing on the contents of the returned list? > +static void test_qemu_opt_get(void) > +{ > + /** now we have set str2, should know about it */ > + opt =3D qemu_opt_get(opts, "str2"); > + g_assert(opt !=3D NULL && !strcmp(opt, "value")); Isn't g_assert_cmpstr nicer for this, as in: g_assert_cmpstr(opt, =3D=3D, "value"); > +static void test_qemu_opt_get_size(void) > +{ > + QemuOptsList *list; > + > + qemu_opts_absorb_qdict(opts, dict, &local_err); > + g_assert(local_err =3D=3D NULL); shorter as: qemu_opts_absorb_qdict(opts, dict, &error_abort); Overall, I like where this is headed; looking forward to v2. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --cfifc9LgaOEIAotFxiaPTi3G1pPwJMmIj 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/ iQEcBAEBCAAGBQJTJx/MAAoJEKeha0olJ0Nqt0AIAK/22CTYZcHHlifdFLBIthsU 9k8x47Ysoi/EntWa2U0CjJ/coiH7bRhzXAbJPXiba6vyZGoOL0csWvm5roDJZyzv 7bcujjFqQiqN1xDQJfXcCmLvuz6JjlYC/z8Q/eo1qm0tnFmskxVhe58Pqt0IKFEb yduCWH7Mh4nPBA93dkmjmqn80cap4ToKHdIfno394AfVNYt0P/7L0623Pswijsq7 2zCPoaa57m1x9A/gad1dgQxjHX7rdc2IBfE6AXWZU57O5rRgB/SwOYPc1k5dBpBa F7CLN0DvLS9T3chLwBew/+baJOSgLoSayhKynbMyhUxD+LKHqKYHKGDi3yeY2GU= =siXO -----END PGP SIGNATURE----- --cfifc9LgaOEIAotFxiaPTi3G1pPwJMmIj--