[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH V2 4/5] test: add test cases for qapi event
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC PATCH V2 4/5] test: add test cases for qapi event |
Date: |
Thu, 06 Mar 2014 13:05:00 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 01/02/2014 04:10 PM, Wenchao Xia wrote:
> These cases will verify whether the expected qdict is built.
>
> Signed-off-by: Wenchao Xia <address@hidden>
> ---
> 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
>
> +
> +/* 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 = qdict_get(d, "timestamp");
> + g_assert(obj);
> + t = qobject_to_qdict(obj);
> + g_assert(t);
> + obj = qdict_get(t, "seconds");
> + g_assert(obj && qobject_type(obj) == QTYPE_QINT);
> + obj = qdict_get(t, "microseconds");
> + g_assert(obj && qobject_type(obj) == 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 <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [RFC PATCH V2 4/5] test: add test cases for qapi event,
Eric Blake <=