diff options
author | Eric Blake <eblake@redhat.com> | 2017-03-22 09:45:23 -0500 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-03-22 16:55:54 +0100 |
commit | 76861f6befc50c30cb71e84b372dc91dd26656a4 (patch) | |
tree | 2a8bb25623084835f905bc0ff580ab70b1ffcfc7 /tests/test-opts-visitor.c | |
parent | 4bc0c94da40055dc68645847fa8bcddef47fedd5 (diff) |
tests: Expose regression in QemuOpts visitor
Commit 15c2f669e 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 9cb8ef3 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: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-Id: <20170322144525.18964-2-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/test-opts-visitor.c')
-rw-r--r-- | tests/test-opts-visitor.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c index 2238f8efe5..8e0dda5f68 100644 --- a/tests/test-opts-visitor.c +++ b/tests/test-opts-visitor.c @@ -247,6 +247,24 @@ test_opts_range_beyond(void) qemu_opts_del(opts); } +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) { @@ -343,6 +361,8 @@ main(int argc, char **argv) g_test_add_func("/visitor/opts/range/beyond", test_opts_range_beyond); + g_test_add_func("/visitor/opts/dict/unvisited", test_opts_dict_unvisited); + g_test_run(); return 0; } |