diff options
author | Thomas Huth <thuth@redhat.com> | 2019-04-09 10:52:43 +0200 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2019-05-08 16:59:28 +0200 |
commit | da9cd2d06cd28fccf09d2e22361a19f9ce6ffc71 (patch) | |
tree | 7225b8d280106ef8522e6eb0b883267a5692d1f5 /tests/qmp-cmd-test.c | |
parent | 2756f82af412c6a0a06030e8ff8df0861d639c7a (diff) | |
download | qemu-da9cd2d06cd28fccf09d2e22361a19f9ce6ffc71.zip qemu-da9cd2d06cd28fccf09d2e22361a19f9ce6ffc71.tar.gz qemu-da9cd2d06cd28fccf09d2e22361a19f9ce6ffc71.tar.bz2 |
tests/qmp-cmd-test: Use qtest_init() instead of qtest_start()
qtest_start() + qtest_end() should be avoided, since they use the
global_qtest variable that we want to get rid of in the long run
(since global_qtest can not be used in tests that have to track
multiple QEMU states, like migration tests). Use qtest_init() and
qtest_quit() instead.
Message-Id: <20190409085245.31548-4-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qmp-cmd-test.c')
-rw-r--r-- | tests/qmp-cmd-test.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/qmp-cmd-test.c b/tests/qmp-cmd-test.c index d12cac5..9f5228c 100644 --- a/tests/qmp-cmd-test.c +++ b/tests/qmp-cmd-test.c @@ -61,10 +61,11 @@ static void test_query(const void *data) int expected_error_class = query_error_class(cmd); QDict *resp, *error; const char *error_class; + QTestState *qts; - qtest_start(common_args); + qts = qtest_init(common_args); - resp = qmp("{ 'execute': %s }", cmd); + resp = qtest_qmp(qts, "{ 'execute': %s }", cmd); error = qdict_get_qdict(resp, "error"); error_class = error ? qdict_get_str(error, "class") : NULL; @@ -78,7 +79,7 @@ static void test_query(const void *data) } qobject_unref(resp); - qtest_end(); + qtest_quit(qts); } static bool query_is_blacklisted(const char *cmd) @@ -118,16 +119,18 @@ static void qmp_schema_init(QmpSchema *schema) QDict *resp; Visitor *qiv; SchemaInfoList *tail; + QTestState *qts; - qtest_start(common_args); - resp = qmp("{ 'execute': 'query-qmp-schema' }"); + qts = qtest_init(common_args); + + resp = qtest_qmp(qts, "{ 'execute': 'query-qmp-schema' }"); qiv = qobject_input_visitor_new(qdict_get(resp, "return")); visit_type_SchemaInfoList(qiv, NULL, &schema->list, &error_abort); visit_free(qiv); qobject_unref(resp); - qtest_end(); + qtest_quit(qts); schema->hash = g_hash_table_new(g_str_hash, g_str_equal); |