From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 21/26] tests: Cover partial input visit of list
Date: Tue, 28 Feb 2017 09:55:11 -0600 [thread overview]
Message-ID: <aa12f2f1-7ff3-d58f-011d-25be93722d0e@redhat.com> (raw)
In-Reply-To: <1488145424-14974-22-git-send-email-armbru@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2953 bytes --]
On 02/26/2017 03:43 PM, Markus Armbruster wrote:
> Demonstrates a design flaw: there is no way to for input visitors to
> report that a list visit didn't visit the complete input list. The
> generated list visits always do, but manual visits needn't.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> tests/test-opts-visitor.c | 41 +++++++++++++++++++++++++++++++++++
> tests/test-qobject-input-visitor.c | 44 ++++++++++++++++++++++++++++++++++++++
> tests/test-string-input-visitor.c | 22 +++++++++++++++++++
> 3 files changed, 107 insertions(+)
>
>
> +static void
> +test_opts_range_unvisited(void)
> +{
> + intList *list = NULL;
> + intList *tail;
> + QemuOpts *opts;
> + Visitor *v;
> +
> + opts = qemu_opts_parse(qemu_find_opts("userdef"), "ilist=0-2", false,
> + &error_abort);
> +
> + v = opts_visitor_new(opts);
> +
> + visit_start_struct(v, NULL, NULL, 0, &error_abort);
> +
> + /* Would be simpler if the visitor genuinely supported virtual walks */
> + visit_start_list(v, "ilist", (GenericList **)&list, sizeof(*list),
> + &error_abort);
Although the complexity of adding virtual walks to the string visitor
may not be worth the effort.
> +++ b/tests/test-qobject-input-visitor.c
> @@ -923,6 +923,46 @@ static void test_visitor_in_fail_struct_missing(TestInputVisitorData *data,
> visit_end_struct(v, NULL);
> }
>
> +static void test_visitor_in_fail_list(TestInputVisitorData *data,
> + const void *unused)
> +{
> + int64_t i64 = -1;
> + Visitor *v;
> +
> + /* Unvisited list tail */
> +
> + v = visitor_input_test_init(data, "[ 1, 2, 3 ]");
> +
> + visit_start_list(v, NULL, NULL, 0, &error_abort);
> + visit_type_int(v, NULL, &i64, &error_abort);
> + g_assert_cmpint(i64, ==, 1);
> + visit_type_int(v, NULL, &i64, &error_abort);
> + g_assert_cmpint(i64, ==, 2);
> + visit_end_list(v, NULL);
> + /* BUG: unvisited tail not reported; actually not reportable by design */
Indeed - the virtual walk is easier. At any rate, good testsuite
addition, and sets the stage for why the next patches fix the design flaw.
> +}
> +
> +static void test_visitor_in_fail_list_nested(TestInputVisitorData *data,
> + const void *unused)
> +{
> + int64_t i64 = -1;
> + Visitor *v;
> +
> + /* Unvisited nested list tail */
> +
> + v = visitor_input_test_init(data, "[ 0, [ 1, 2, 3 ] ]");
In fact, QAPI does not (currently) allow the creation of one list nested
inside another (at least, not without an intervening struct), so this
particular input can only be walked virtually.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
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:[~2017-02-28 15:55 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-26 21:43 [Qemu-devel] [PATCH v2 00/26] qapi: QMP dispatch and input visitor work Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 01/26] qga: Fix crash on non-dictionary QMP argument Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 02/26] libqtest: Work around a "QMP wants a newline" bug Markus Armbruster
2017-02-27 16:36 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 03/26] qmp-test: New, covering basic QMP protocol Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 04/26] qmp: Dumb down how we run QMP command registration Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 05/26] qmp: Clean up how we enforce capability negotiation Markus Armbruster
2017-02-27 16:39 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 06/26] qmp: Drop duplicated QMP command object checks Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 07/26] qmp: Eliminate silly QERR_QMP_* macros Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 08/26] qmp: Improve QMP dispatch error messages Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 09/26] qapi: Improve a QObject input visitor error message Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 10/26] qapi: Clean up after commit 3d344c2 Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 11/26] qapi: Make QObject input visitor set *list reliably Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 12/26] qapi: Improve qobject input visitor error reporting Markus Armbruster
2017-02-27 16:45 ` Eric Blake
2017-02-28 8:42 ` Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 13/26] qapi: Drop string input visitor method optional() Markus Armbruster
2017-02-27 16:46 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 14/26] qapi: Make string input and opts visitor require non-null input Markus Armbruster
2017-02-27 16:58 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 15/26] qom: Make object_property_set_qobject()'s input visitor strict Markus Armbruster
2017-02-27 19:25 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 16/26] test-qobject-input-visitor: Use strict visitor Markus Armbruster
2017-02-27 22:49 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 17/26] qapi: Drop unused non-strict qobject input visitor Markus Armbruster
2017-02-28 14:56 ` Eric Blake
2017-02-28 17:29 ` Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 18/26] tests-qobject-input-strict: Merge into test-qobject-input-visitor Markus Armbruster
2017-02-28 15:39 ` Eric Blake
2017-02-28 16:57 ` Markus Armbruster
2017-02-28 17:10 ` Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 19/26] test-string-input-visitor: Tear down existing test automatically Markus Armbruster
2017-02-28 15:44 ` Eric Blake
2017-02-28 16:08 ` Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 20/26] test-string-input-visitor: Improve list coverage Markus Armbruster
2017-02-28 15:47 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 21/26] tests: Cover partial input visit of list Markus Armbruster
2017-02-28 15:55 ` Eric Blake [this message]
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 22/26] test-qobject-input-visitor: Cover missing nested struct member Markus Armbruster
2017-02-28 16:00 ` Eric Blake
2017-02-28 16:52 ` Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 23/26] qapi: Make input visitors detect unvisited list tails Markus Armbruster
2017-02-28 16:09 ` Eric Blake
2017-02-28 16:55 ` Markus Armbruster
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 24/26] tests: Cover input visit beyond end of list Markus Armbruster
2017-02-28 16:19 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 25/26] qapi: Fix object " Markus Armbruster
2017-02-28 16:20 ` Eric Blake
2017-02-26 21:43 ` [Qemu-devel] [PATCH v2 26/26] qapi: Improve qobject visitor documentation Markus Armbruster
2017-02-28 16:22 ` Eric Blake
2017-02-26 22:23 ` [Qemu-devel] [PATCH v2 00/26] qapi: QMP dispatch and input visitor work no-reply
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=aa12f2f1-7ff3-d58f-011d-25be93722d0e@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.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 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).