From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL v2 03/11] tests/test-qmp-input-strict: Cover missing struct members
Date: Fri, 7 Oct 2016 20:16:14 +0200 [thread overview]
Message-ID: <1475864182-16550-4-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1475864182-16550-1-git-send-email-armbru@redhat.com>
These tests would have caught the bug fixed by the previous commit.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1475594630-24758-1-git-send-email-armbru@redhat.com>
---
tests/test-qmp-input-strict.c | 46 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c
index 814550a..d87f8b8 100644
--- a/tests/test-qmp-input-strict.c
+++ b/tests/test-qmp-input-strict.c
@@ -193,6 +193,50 @@ static void test_validate_fail_struct_nested(TestInputVisitorData *data,
g_assert(!udp);
}
+static void test_validate_fail_struct_missing(TestInputVisitorData *data,
+ const void *unused)
+{
+ Error *err = NULL;
+ Visitor *v;
+ QObject *any;
+ GenericAlternate *alt;
+ bool present;
+ int en;
+ int64_t i64;
+ uint32_t u32;
+ int8_t i8;
+ char *str;
+ double dbl;
+
+ v = validate_test_init(data, "{}");
+ visit_start_struct(v, NULL, NULL, 0, &error_abort);
+ visit_start_struct(v, "struct", NULL, 0, &err);
+ error_free_or_abort(&err);
+ visit_start_list(v, "list", NULL, 0, &err);
+ error_free_or_abort(&err);
+ visit_start_alternate(v, "alternate", &alt, sizeof(*alt), false, &err);
+ error_free_or_abort(&err);
+ visit_optional(v, "optional", &present);
+ g_assert(!present);
+ visit_type_enum(v, "enum", &en, EnumOne_lookup, &err);
+ error_free_or_abort(&err);
+ visit_type_int(v, "i64", &i64, &err);
+ error_free_or_abort(&err);
+ visit_type_uint32(v, "u32", &u32, &err);
+ error_free_or_abort(&err);
+ visit_type_int8(v, "i8", &i8, &err);
+ error_free_or_abort(&err);
+ visit_type_str(v, "i8", &str, &err);
+ error_free_or_abort(&err);
+ visit_type_number(v, "dbl", &dbl, &err);
+ error_free_or_abort(&err);
+ visit_type_any(v, "any", &any, &err);
+ error_free_or_abort(&err);
+ visit_type_null(v, "null", &err);
+ error_free_or_abort(&err);
+ visit_end_struct(v, NULL);
+}
+
static void test_validate_fail_list(TestInputVisitorData *data,
const void *unused)
{
@@ -316,6 +360,8 @@ int main(int argc, char **argv)
&testdata, test_validate_fail_struct);
validate_test_add("/visitor/input-strict/fail/struct-nested",
&testdata, test_validate_fail_struct_nested);
+ validate_test_add("/visitor/input-strict/fail/struct-missing",
+ &testdata, test_validate_fail_struct_missing);
validate_test_add("/visitor/input-strict/fail/list",
&testdata, test_validate_fail_list);
validate_test_add("/visitor/input-strict/fail/union-flat",
--
2.5.5
next prev parent reply other threads:[~2016-10-07 18:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 18:16 [Qemu-devel] [PULL v2 00/11] QAPI patches for 2016-10-07 Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 01/11] qmp: fix object-add assert() without props Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 02/11] qapi: Fix crash when 'any' or 'null' parameter is missing Markus Armbruster
2016-10-07 18:16 ` Markus Armbruster [this message]
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 04/11] qapi: add assert about root value Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 05/11] qapi: assert list entry has a value Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 06/11] qapi: return a 'missing parameter' error Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 07/11] MAINTAINERS: Pass the HMP staff from Luiz to David Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 08/11] MAINTAINERS: Pass the QObject staff from Luiz to Markus Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 09/11] qmp: Disable query-cpu-* commands when they're unavailable Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 10/11] docs: Belatedly update for move of qmp-commands.txt Markus Armbruster
2016-10-07 18:16 ` [Qemu-devel] [PULL v2 11/11] docs: Belatedly update for move of QMP/* to docs/ Markus Armbruster
2016-10-10 11:50 ` [Qemu-devel] [PULL v2 00/11] QAPI patches for 2016-10-07 Peter Maydell
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=1475864182-16550-4-git-send-email-armbru@redhat.com \
--to=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).