[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 7/9] tests/migration: Fail on unexpected migration states
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 7/9] tests/migration: Fail on unexpected migration states |
Date: |
Wed, 25 Sep 2019 16:01:28 +0100 |
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>
Message-Id: <address@hidden>
Reviewed-by: Cleber Rosa <address@hidden>
Tested-by: Cleber Rosa <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Peter Xu <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <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 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
- [PULL 0/9] migration queue, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 1/9] migration: fix vmdesc leak on vmstate_save() error, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 2/9] migration/postcopy: not necessary to do discard when canonicalizing bitmap, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 3/9] migration/postcopy: unsentmap is not necessary for postcopy, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 4/9] migration: remove sent parameter in get_queued_page_not_dirty, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 5/9] migration/rdma: Don't moan about disconnects at the end, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 6/9] migration/rdma.c: Swap synchronize_rcu for call_rcu, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 7/9] tests/migration: Fail on unexpected migration states,
Dr. David Alan Gilbert (git) <=
- [PULL 8/9] tests/migration/postcopy: trim migration bandwidth, Dr. David Alan Gilbert (git), 2019/09/25
- [PULL 9/9] migration/postcopy: Recognise the recovery states as 'in_postcopy', Dr. David Alan Gilbert (git), 2019/09/25
- Re: [PULL 0/9] migration queue, Peter Maydell, 2019/09/26