From 2f6d313836591659375db97a2c1de4f28413f12c Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Tue, 10 Jul 2018 17:19:00 +0800 Subject: 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 Reviewed-by: Juan Quintela Reviewed-by: Balamuruhan S Signed-off-by: Peter Xu Message-Id: <20180710091902.28780-9-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- tests/migration-test.c | 10 ++++++++-- 1 file 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); -- cgit v1.2.3