提交 879b6454 编写于 作者: E Eric Blake 提交者: Michael Roth

tests: Expose regression in QemuOpts visitor

Commit 15c2f669 broke the ability of the QemuOpts visitor to
flag extra input parameters, but the regression went unnoticed
because of missing testsuite coverage.  Add a test to cover this;
take the approach already used in 9cb8ef36 of adding a test that
passes (to avoid breaking bisection) but marks with BUG the
behavior that we don't like, so that the actual impact of the
fix in a later patch is easier to see.

CC: qemu-stable@nongnu.org
Signed-off-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
Message-Id: <20170322144525.18964-2-eblake@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
(cherry picked from commit 76861f6b)
 Conflicts:
	tests/test-opts-visitor.c
 * drop context dep on 9cb8ef36 and a9416dc6 tests
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 ce37df91
......@@ -172,6 +172,24 @@ expect_u64_max(OptsVisitorFixture *f, gconstpointer test_data)
/* test cases */
static void
test_opts_dict_unvisited(void)
{
QemuOpts *opts;
Visitor *v;
UserDefOptions *userdef;
opts = qemu_opts_parse(qemu_find_opts("userdef"), "i64x=0,bogus=1", false,
&error_abort);
v = opts_visitor_new(opts);
/* BUG: bogus should be diagnosed */
visit_type_UserDefOptions(v, NULL, &userdef, &error_abort);
visit_free(v);
qemu_opts_del(opts);
qapi_free_UserDefOptions(userdef);
}
int
main(int argc, char **argv)
{
......@@ -263,6 +281,8 @@ main(int argc, char **argv)
add_test("/visitor/opts/i64/range/2big/full", &expect_fail,
"i64=-0x8000000000000000-0x7fffffffffffffff");
g_test_add_func("/visitor/opts/dict/unvisited", test_opts_dict_unvisited);
g_test_run();
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册