From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com,
Michael Roth <mdroth@linux.vnet.ibm.com>,
ehabkost@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v7 08/18] qapi: Test use of 'number' within alternates
Date: Mon, 5 Oct 2015 16:45:08 -0600 [thread overview]
Message-ID: <5612FD74.5000403@redhat.com> (raw)
In-Reply-To: <1443565276-4535-9-git-send-email-eblake@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2754 bytes --]
On 09/29/2015 04:21 PM, Eric Blake wrote:
> Add some testsuite exposure for use of a 'number' as part of
> an alternate. The current state of the tree has a few bugs
> exposed by this: our input parser depends on the ordering of
> how the qapi schema declared the alternate, and the parser
> does not accept integers for a 'number' in an alternate even
> though it does for numbers outside of an alternate.
>
> Mixing 'int' and 'number' in the same alternate is unusual,
> since both are supplied by json-numbers, but there does not
> seem to be a technical reason to forbid it given that our
> json lexer distinguishes between json-numbers that can be
> represented as an int vs. those that cannot.
>
> Improve the existing test_visitor_in_alternate() to match the
> style of the new test_visitor_in_alternate_number(), and to
> ensure full coverage of all possible qtype parsing.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> ---
> +static void test_visitor_in_alternate_number(TestInputVisitorData *data,
> + const void *unused)
> +{
> + Visitor *v;
> + Error *err = NULL;
> + AltStrBool *asb;
> + AltStrNum *asn;
> + AltNumStr *ans;
> + AltStrInt *asi;
> + AltIntNum *ain;
> + AltNumInt *ani;
> +
> + /* Parsing an int */
> +
> + v = visitor_input_test_init(data, "42");
> + visit_type_AltStrBool(v, &asb, NULL, &err);
> + g_assert(err);
> + qapi_free_AltStrBool(asb);
> + visitor_input_teardown(data, NULL);
This fails to reset err = NULL...
> +
> + /* FIXME: Order of alternate should not affect semantics; asn should
> + * parse the same as ans */
> + v = visitor_input_test_init(data, "42");
> + visit_type_AltStrNum(v, &asn, NULL, &err);
> + /* FIXME g_assert_cmpint(asn->kind, == ALT_STR_NUM_KIND_N); */
> + /* FIXME g_assert_cmpfloat(asn->n, ==, 42); */
> + g_assert(err);
> + error_free(err);
> + err = NULL;
...which means that this test is not reliable. Do you need a v8, or can
you squash this in?
diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c
index 1b5a369..6104ac6 100644
--- a/tests/test-qmp-input-visitor.c
+++ b/tests/test-qmp-input-visitor.c
@@ -395,6 +395,8 @@ static void
test_visitor_in_alternate_number(TestInputVisitorData *data,
v = visitor_input_test_init(data, "42");
visit_type_AltStrBool(v, &asb, NULL, &err);
g_assert(err);
+ error_free(err);
+ err = NULL;
qapi_free_AltStrBool(asb);
v = visitor_input_test_init(data, "42");
--
2.4.3
--
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 --]
next prev parent reply other threads:[~2015-10-05 22:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 22:20 [Qemu-devel] [PATCH v7 00/18] post-introspection cleanups, subset A Eric Blake
2015-09-29 22:20 ` [Qemu-devel] [PATCH v7 01/18] qapi: Sort qapi-schema tests Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 02/18] qapi: Improve 'include' error message Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 03/18] qapi: Invoke exception superclass initializer Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 04/18] qapi: Clean up qapi.py per pep8 Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 05/18] qapi: Test for various name collisions Eric Blake
2015-10-01 3:30 ` Eric Blake
2015-10-01 12:57 ` Markus Armbruster
2015-10-01 11:51 ` Markus Armbruster
2015-10-01 13:10 ` Eric Blake
2015-10-01 15:34 ` Markus Armbruster
2015-10-01 15:41 ` Eric Blake
2015-10-01 17:39 ` Markus Armbruster
2015-10-01 18:51 ` Eric Blake
2015-10-01 20:27 ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 06/18] qapi: Avoid assertion failure on union 'type' collision Eric Blake
2015-10-01 12:10 ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 07/18] qapi: Add tests for empty unions Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 08/18] qapi: Test use of 'number' within alternates Eric Blake
2015-10-05 22:45 ` Eric Blake [this message]
2015-10-06 7:24 ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 09/18] qapi: Reuse code for flat union base validation Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 10/18] qapi: Consistent generated code: prefer error 'err' Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 11/18] qapi: Consistent generated code: prefer visitor 'v' Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 12/18] qapi: Consistent generated code: prefer common labels Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 13/18] qapi: Consistent generated code: prefer common indentation Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 14/18] qapi: Consistent generated code: minimize push_indent() usage Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 15/18] qapi: Share gen_err_check() Eric Blake
2015-10-01 12:40 ` Markus Armbruster
2015-10-01 13:01 ` Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [PATCH v7 16/18] qapi: Share gen_visit_fields() Eric Blake
2015-09-29 22:21 ` [Qemu-devel] [RFC PATCH v7 17/18] qapi: Simplify gen_visit_fields() error handling Eric Blake
2015-10-01 12:49 ` Markus Armbruster
2015-09-29 22:21 ` [Qemu-devel] [RFC PATCH v7 18/18] qapi: Use gen_err_check() in more places Eric Blake
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=5612FD74.5000403@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.