qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: thuth@redhat.com, alex.bennee@linaro.org, qemu-devel@nongnu.org,
	peterx@redhat.com, quintela@redhat.com
Subject: Re: [PATCH 1/2] tests/migration: Fail on unexpected migration states
Date: Mon, 23 Sep 2019 10:12:11 -0400	[thread overview]
Message-ID: <20190923141211.GA9445@dhcp-17-179.bos.redhat.com> (raw)
In-Reply-To: <20190923131022.15498-2-dgilbert@redhat.com>

On Mon, Sep 23, 2019 at 02:10:21PM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> We've got various places where we wait for a migration to enter
> a given state; but if we enter an unexpected state we tend to fail
> in odd ways; add a mechanism for explicitly testing for any state
> which we shouldn't be in.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  tests/migration-test.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/migration-test.c b/tests/migration-test.c
> index 258aa064d4..9c62ee5331 100644
> --- a/tests/migration-test.c
> +++ b/tests/migration-test.c
> @@ -255,15 +255,19 @@ static void read_blocktime(QTestState *who)
>  }
>  
>  static void wait_for_migration_status(QTestState *who,
> -                                      const char *goal)
> +                                      const char *goal,
> +                                      const char **ungoals)
>  {
>      while (true) {
>          bool completed;
>          char *status;
> +        const char **ungoal;
>  
>          status = migrate_query_status(who);
>          completed = strcmp(status, goal) == 0;
> -        g_assert_cmpstr(status, !=,  "failed");
> +        for (ungoal = ungoals; *ungoal; ungoal++) {
> +            g_assert_cmpstr(status, !=,  *ungoal);
> +        }
>          g_free(status);
>          if (completed) {
>              return;
> @@ -274,7 +278,8 @@ static void wait_for_migration_status(QTestState *who,
>  
>  static void wait_for_migration_complete(QTestState *who)
>  {
> -    wait_for_migration_status(who, "completed");
> +    wait_for_migration_status(who, "completed",
> +                              (const char * []) { "failed", NULL });
>  }
>  
>  static void wait_for_migration_pass(QTestState *who)
> @@ -809,7 +814,9 @@ static void test_postcopy_recovery(void)
>       * Wait until postcopy is really started; we can only run the
>       * migrate-pause command during a postcopy
>       */
> -    wait_for_migration_status(from, "postcopy-active");
> +    wait_for_migration_status(from, "postcopy-active",
> +                              (const char * []) { "failed",
> +                                                  "completed", NULL });
>  
>      /*
>       * Manually stop the postcopy migration. This emulates a network
> @@ -822,7 +829,9 @@ static void test_postcopy_recovery(void)
>       * migrate-recover command can only succeed if destination machine
>       * is in the paused state
>       */
> -    wait_for_migration_status(to, "postcopy-paused");
> +    wait_for_migration_status(to, "postcopy-paused",
> +                              (const char * []) { "failed", "active",
> +                                                  "completed", NULL });
>  
>      /*
>       * Create a new socket to emulate a new channel that is different
> @@ -836,7 +845,9 @@ static void test_postcopy_recovery(void)
>       * Try to rebuild the migration channel using the resume flag and
>       * the newly created channel
>       */
> -    wait_for_migration_status(from, "postcopy-paused");
> +    wait_for_migration_status(from, "postcopy-paused",
> +                              (const char * []) { "failed", "active",
> +                                                  "completed", NULL });
>      migrate(from, uri, "{'resume': true}");
>      g_free(uri);
>  
> -- 
> 2.21.0
> 
>

LGTM (tested with x86_64 and aarch64 targets on an x86_64 host).

Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>


  reply	other threads:[~2019-09-23 14:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23 13:10 [PATCH 0/2] migration test tweeks Dr. David Alan Gilbert (git)
2019-09-23 13:10 ` [PATCH 1/2] tests/migration: Fail on unexpected migration states Dr. David Alan Gilbert (git)
2019-09-23 14:12   ` Cleber Rosa [this message]
2019-09-23 16:20   ` Alex Bennée
2019-09-24  7:24   ` Juan Quintela
2019-09-23 13:10 ` [PATCH 2/2] tests/migration/postcopy: trim migration bandwidth Dr. David Alan Gilbert (git)
2019-09-23 14:14   ` Cleber Rosa
2019-09-23 16:15   ` Alex Bennée
2019-09-24  7:25   ` Juan Quintela
2019-09-23 13:24 ` [PATCH 0/2] migration test tweeks Peter Xu
2019-09-23 13:36   ` Dr. David Alan Gilbert
2019-09-25 10:35 ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190923141211.GA9445@dhcp-17-179.bos.redhat.com \
    --to=crosa@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=dgilbert@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).