Skip to content

Commit

Permalink
tests/qtest: migration: Expose migrate_set_capability
Browse files Browse the repository at this point in the history
The following patch will make use of this function from within
migrate-helpers.c, so move it there.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20230712190742.22294-2-farosas@suse.de>
  • Loading branch information
Fabiano Rosas authored and Juan Quintela committed Oct 11, 2023
1 parent 86dec71 commit 9d47929
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
11 changes: 11 additions & 0 deletions tests/qtest/migration-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...)
"{ 'execute': 'migrate', 'arguments': %p}", args);
}

void migrate_set_capability(QTestState *who, const char *capability,
bool value)
{
qtest_qmp_assert_success(who,
"{ 'execute': 'migrate-set-capabilities',"
"'arguments': { "
"'capabilities': [ { "
"'capability': %s, 'state': %i } ] } }",
capability, value);
}

/*
* Note: caller is responsible to free the returned object via
* qobject_unref() after use
Expand Down
3 changes: 3 additions & 0 deletions tests/qtest/migration-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ bool migrate_watch_for_resume(QTestState *who, const char *name,
G_GNUC_PRINTF(3, 4)
void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...);

void migrate_set_capability(QTestState *who, const char *capability,
bool value);

QDict *migrate_query(QTestState *who);
QDict *migrate_query_not_failed(QTestState *who);

Expand Down
11 changes: 0 additions & 11 deletions tests/qtest/migration-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,17 +605,6 @@ static void migrate_cancel(QTestState *who)
qtest_qmp_assert_success(who, "{ 'execute': 'migrate_cancel' }");
}

static void migrate_set_capability(QTestState *who, const char *capability,
bool value)
{
qtest_qmp_assert_success(who,
"{ 'execute': 'migrate-set-capabilities',"
"'arguments': { "
"'capabilities': [ { "
"'capability': %s, 'state': %i } ] } }",
capability, value);
}

static void migrate_postcopy_start(QTestState *from, QTestState *to)
{
qtest_qmp_assert_success(from, "{ 'execute': 'migrate-start-postcopy' }");
Expand Down

0 comments on commit 9d47929

Please sign in to comment.