qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Leandro Dorileo <l@dorileo.org>, qemu-devel@nongnu.org
Cc: "Wenchao Xia" <wenchaoqemu@gmail.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Chunyan Liu" <cyliu@suse.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Anthony Liguori" <anthony@codemonkey.ws>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH] QemuOpt: add unit tests
Date: Mon, 17 Mar 2014 10:16:12 -0600	[thread overview]
Message-ID: <53271FCC.6010504@redhat.com> (raw)
In-Reply-To: <1395004716-20229-1-git-send-email-l@dorileo.org>

[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]

On 03/16/2014 03:18 PM, Leandro Dorileo wrote:
> Cover basic aspects and API usage for QemuOpt. The current implementation
> covers the API's planed to be changed by Chunyan Liu in his QEMUOptionParameter

s/planed/planned/

> replacement/cleanup job.
> 
> Other APIs should be covered in future improvements.
> 
> Signed-off-by: Leandro Dorileo <l@dorileo.org>
> ---
>  tests/Makefile         |   3 +
>  tests/test-qemu-opts.c | 309 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 312 insertions(+)
>  create mode 100644 tests/test-qemu-opts.c
> 

> +
> +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 = qemu_find_opts("opts_list_01");
> +    g_assert(list != 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 = qemu_opt_get(opts, "str2");
> +    g_assert(opt != NULL && !strcmp(opt, "value"));

Isn't g_assert_cmpstr nicer for this, as in:

g_assert_cmpstr(opt, ==, "value");

> +static void test_qemu_opt_get_size(void)
> +{
> +    QemuOptsList *list;

> +
> +    qemu_opts_absorb_qdict(opts, dict, &local_err);
> +    g_assert(local_err == NULL);

shorter as:

qemu_opts_absorb_qdict(opts, dict, &error_abort);

Overall, I like where this is headed; looking forward to v2.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-03-17 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-16 21:18 [Qemu-devel] [PATCH] QemuOpt: add unit tests Leandro Dorileo
2014-03-17 16:16 ` Eric Blake [this message]
2014-03-17 16:24   ` Leandro Dorileo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53271FCC.6010504@redhat.com \
    --to=eblake@redhat.com \
    --cc=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=cyliu@suse.com \
    --cc=l@dorileo.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wenchaoqemu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).