[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 08/33] tests/migration: Fail on unexpected migration state
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v3 08/33] tests/migration: Fail on unexpected migration states |
Date: |
Thu, 26 Sep 2019 00:30:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 9/24/19 11:00 PM, Alex Bennée wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> 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 <address@hidden>
> Signed-off-by: Alex Bennée <address@hidden>
> Message-Id: <address@hidden>
> ---
> 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 258aa064d48..9c62ee5331b 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);
:)
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> + }
> 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);
>
>
- [PATCH v3 05/33] target/alpha: Write to fpcr_flush_to_zero once, (continued)
- [PATCH v3 05/33] target/alpha: Write to fpcr_flush_to_zero once, Alex Bennée, 2019/09/24
- [PATCH v3 11/33] target/ppc: fix signal delivery for ppc64abi32, Alex Bennée, 2019/09/24
- [PATCH v3 21/33] tests/tcg: add simple record/replay smoke test for aarch64, Alex Bennée, 2019/09/24
- [PATCH v3 06/33] target/alpha: Mask IOV exception with INV for user-only, Alex Bennée, 2019/09/24
- [PATCH v3 13/33] tests/docker: fix DOCKER_PARTIAL_IMAGES, Alex Bennée, 2019/09/24
- [PATCH v3 04/33] target/alpha: Handle SWCR_MAP_DMZ earlier, Alex Bennée, 2019/09/24
- [PATCH v3 15/33] tests/docker: reduce scary warnings by cleaning up clean up, Alex Bennée, 2019/09/24
- [PATCH v3 08/33] tests/migration: Fail on unexpected migration states, Alex Bennée, 2019/09/24
- Re: [PATCH v3 08/33] tests/migration: Fail on unexpected migration states,
Philippe Mathieu-Daudé <=
- [PATCH v3 12/33] tests/docker: add sanitizers back to clang build, Alex Bennée, 2019/09/24
- [PATCH v3 10/33] migration/postcopy: Recognise the recovery states as 'in_postcopy', Alex Bennée, 2019/09/24
- [PATCH v3 09/33] tests/migration/postcopy: trim migration bandwidth, Alex Bennée, 2019/09/24
- [PATCH v3 27/33] docker: remove debian8-mxe definitions, Alex Bennée, 2019/09/24
- [PATCH v3 17/33] tests/tcg: clean-up some comments after the de-tangling, Alex Bennée, 2019/09/24
- [PATCH v3 18/33] tests/tcg: re-enable linux-test for ppc64abi32, Alex Bennée, 2019/09/24