aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/migration-helpers.c
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2023-06-01 17:13:43 +0100
committerJuan Quintela <quintela@redhat.com>2023-06-02 11:46:19 +0200
commitaca040695890fe67b44402fdb167809809946068 (patch)
tree325d552c8397729bb73fc47c704dc6940b2b013a /tests/qtest/migration-helpers.c
parentcdf5ab55872438bb3996d2b2a439c3a7b7425aa3 (diff)
downloadqemu-aca040695890fe67b44402fdb167809809946068.zip
qemu-aca040695890fe67b44402fdb167809809946068.tar.gz
qemu-aca040695890fe67b44402fdb167809809946068.tar.bz2
tests/qtest: replace wait_command() with qtest_qmp_assert_success
Most usage of wait_command() is followed by qobject_unref(), which is just a verbose re-implementation of qtest_qmp_assert_success(). Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230601161347.1803440-7-berrange@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'tests/qtest/migration-helpers.c')
-rw-r--r--tests/qtest/migration-helpers.c53
1 files changed, 3 insertions, 50 deletions
diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index 7ceadec..73e506a 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -36,54 +36,6 @@ bool migrate_watch_for_stop(QTestState *who, const char *name,
return false;
}
-#ifndef _WIN32
-/*
- * Events can get in the way of responses we are actually waiting for.
- */
-QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...)
-{
- va_list ap;
- QDict *resp, *ret;
-
- va_start(ap, command);
- qtest_qmp_vsend_fds(who, &fd, 1, command, ap);
- va_end(ap);
-
- resp = qtest_qmp_receive(who);
-
- g_assert(!qdict_haskey(resp, "error"));
- g_assert(qdict_haskey(resp, "return"));
-
- ret = qdict_get_qdict(resp, "return");
- qobject_ref(ret);
- qobject_unref(resp);
-
- return ret;
-}
-#endif
-
-/*
- * Events can get in the way of responses we are actually waiting for.
- */
-QDict *wait_command(QTestState *who, const char *command, ...)
-{
- va_list ap;
- QDict *resp, *ret;
-
- va_start(ap, command);
- resp = qtest_vqmp(who, command, ap);
- va_end(ap);
-
- g_assert(!qdict_haskey(resp, "error"));
- g_assert(qdict_haskey(resp, "return"));
-
- ret = qdict_get_qdict(resp, "return");
- qobject_ref(ret);
- qobject_unref(resp);
-
- return ret;
-}
-
/*
* Send QMP command "migrate".
* Arguments are built from @fmt... (formatted like
@@ -111,7 +63,7 @@ void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...)
*/
QDict *migrate_query(QTestState *who)
{
- return wait_command(who, "{ 'execute': 'query-migrate' }");
+ return qtest_qmp_assert_success_ref(who, "{ 'execute': 'query-migrate' }");
}
QDict *migrate_query_not_failed(QTestState *who)
@@ -209,7 +161,8 @@ void wait_for_migration_fail(QTestState *from, bool allow_active)
} while (!failed);
/* Is the machine currently running? */
- rsp_return = wait_command(from, "{ 'execute': 'query-status' }");
+ rsp_return = qtest_qmp_assert_success_ref(from,
+ "{ 'execute': 'query-status' }");
g_assert(qdict_haskey(rsp_return, "running"));
g_assert(qdict_get_bool(rsp_return, "running"));
qobject_unref(rsp_return);