On Thu, Jul 05, 2018 at 11:17:53AM +0800, Peter Xu wrote:
> It's generalized from wait_for_migration_complete() to allow us to wait
> for any migration status besides failure.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
Reviewed-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
> 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 1d85ccbef1..761bf62ffe 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);
> --
> 2.17.1
>
>