Always use the proper function for starting the incoming migration, there's no need to call QMP directly from the tests.
Signed-off-by: Fabiano Rosas <[email protected]> --- tests/qtest/migration/cpr-tests.c | 19 ++++++++++++------- tests/qtest/migration/framework.c | 16 +++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-tests.c index 7456337370..280e671e4b 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -15,6 +15,8 @@ #include "migration/framework.h" #include "migration/migration-qmp.h" #include "migration/migration-util.h" +#include "qapi/error.h" +#include "qobject/qjson.h" static char *tmpfs; @@ -183,6 +185,7 @@ static void test_cpr_exec(MigrateCommon *args) g_autofree char *connect_uri = g_strdup(args->connect_uri); g_autofree char *filename = g_strdup_printf("%s/%s", tmpfs, FILE_TEST_FILENAME); + g_autofree char *channels = NULL; if (migrate_start(&from, NULL, args->listen_uri, &args->start)) { return; @@ -203,13 +206,15 @@ static void test_cpr_exec(MigrateCommon *args) to = qtest_init_after_exec(from); - qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," - " 'arguments': { " - " 'channels': [ { 'channel-type': 'main'," - " 'addr': { 'transport': 'file'," - " 'filename': %s," - " 'offset': 0 } } ] } }", - filename); + channels = g_strdup_printf("[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'file'," + " 'filename': '%s'," + " 'offset': 0 } } ]", + filename); + + migrate_incoming_qmp(to, NULL, + qobject_from_json(channels, &error_abort), + "{}"); wait_for_migration_complete(to); wait_for_resume(to, get_dst()); diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c index ebd41d3c9f..227bc39303 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -579,6 +579,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, MigrateCommon *args) { QTestState *from, *to; + QObject *channels; /* set postcopy capabilities */ args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME] = true; @@ -594,13 +595,14 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, migrate_ensure_non_converge(from, args->start.config); migrate_prepare_for_dirty_mem(from); - qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," - " 'arguments': { " - " 'channels': [ { 'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ] } }"); + + channels = qobject_from_json("[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]", + &error_abort); + migrate_incoming_qmp(to, NULL, channels, "{}"); /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); -- 2.51.0
