aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2018-07-10 17:19:00 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-07-10 15:18:03 +0100
commit2f6d313836591659375db97a2c1de4f28413f12c (patch)
tree1affdc043c5efb40f443c80aad20ccbe0ccebb9d /tests
parent2f7074c6fdec5015086f5328f8427097bee86e13 (diff)
tests: introduce wait_for_migration_status()
It's generalized from wait_for_migration_complete() to allow us to wait for any migration status besides failure. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Balamuruhan S <bala24@linux.vnet.ibm.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180710091902.28780-9-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/migration-test.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/migration-test.c b/tests/migration-test.c
index e2697efd01..4c15071893 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -231,14 +231,15 @@ static void read_blocktime(QTestState *who)
qobject_unref(rsp_return);
}
-static void wait_for_migration_complete(QTestState *who)
+static void wait_for_migration_status(QTestState *who,
+ const char *goal)
{
while (true) {
bool completed;
char *status;
status = migrate_query_status(who);
- completed = strcmp(status, "completed") == 0;
+ completed = strcmp(status, goal) == 0;
g_assert_cmpstr(status, !=, "failed");
g_free(status);
if (completed) {
@@ -248,6 +249,11 @@ static void wait_for_migration_complete(QTestState *who)
}
}
+static void wait_for_migration_complete(QTestState *who)
+{
+ wait_for_migration_status(who, "completed");
+}
+
static void wait_for_migration_pass(QTestState *who)
{
uint64_t initial_pass = get_migration_pass(who);