From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com, lvivier@redhat.com, peterx@redhat.com
Subject: [Qemu-devel] [PULL 13/13] tests: Adjust sleeps for migration test
Date: Mon, 29 Jan 2018 13:09:32 +0100 [thread overview]
Message-ID: <20180129120932.12874-14-quintela@redhat.com> (raw)
In-Reply-To: <20180129120932.12874-1-quintela@redhat.com>
Also reorder code to not sleep when event already happened.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
tests/migration-test.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/tests/migration-test.c b/tests/migration-test.c
index d191f6e03b..fcad2ed460 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -268,10 +268,9 @@ static uint64_t get_migration_pass(QTestState *who)
static void wait_for_migration_complete(QTestState *who)
{
- QDict *rsp, *rsp_return;
- bool completed;
-
- do {
+ while (true) {
+ QDict *rsp, *rsp_return;
+ bool completed;
const char *status;
rsp = wait_command(who, "{ 'execute': 'query-migrate' }");
@@ -280,8 +279,11 @@ static void wait_for_migration_complete(QTestState *who)
completed = strcmp(status, "completed") == 0;
g_assert_cmpstr(status, !=, "failed");
QDECREF(rsp);
- usleep(1000 * 100);
- } while (!completed);
+ if (completed) {
+ return;
+ }
+ usleep(1000);
+ }
}
static void wait_for_migration_pass(QTestState *who)
@@ -290,16 +292,13 @@ static void wait_for_migration_pass(QTestState *who)
uint64_t pass;
/* Wait for the 1st sync */
- do {
+ while (!got_stop && !initial_pass) {
+ usleep(1000);
initial_pass = get_migration_pass(who);
- if (got_stop || initial_pass) {
- break;
- }
- usleep(1000 * 100);
- } while (true);
+ }
do {
- usleep(1000 * 100);
+ usleep(1000);
pass = get_migration_pass(who);
} while (pass == initial_pass && !got_stop);
}
@@ -489,13 +488,13 @@ static void test_migrate_end(QTestState *from, QTestState *to)
/* Destination still running, wait for a byte to change */
do {
qtest_memread(to, start_address, &dest_byte_b, 1);
- usleep(10 * 1000);
+ usleep(1000 * 10);
} while (dest_byte_a == dest_byte_b);
qtest_qmp_discard_response(to, "{ 'execute' : 'stop'}");
/* With it stopped, check nothing changes */
qtest_memread(to, start_address, &dest_byte_c, 1);
- sleep(1);
+ usleep(1000 * 200);
qtest_memread(to, start_address, &dest_byte_d, 1);
g_assert_cmpint(dest_byte_c, ==, dest_byte_d);
--
2.14.3
next prev parent reply other threads:[~2018-01-29 12:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-29 12:09 [Qemu-devel] [PULL 00/13] Migration PULL request Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 01/13] migration: Allow migrate_fd_connect to take an Error * Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 02/13] migration: Route errors down through migration_channel_connect Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 03/13] migration/savevm.c: set MAX_VM_CMD_PACKAGED_SIZE to 1ul << 32 Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 04/13] migration: use s->threshold_size inside migration_update_counters Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 05/13] migration: Drop current address parameter from save_zero_page() Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 06/13] tests: Remove deprecated migration tests commands Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 07/13] tests: Consolidate accelerators declaration Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 08/13] tests: Use consistent names for migration Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 09/13] tests: Add deprecated commands migration test Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 10/13] tests: Add migration precopy test Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 11/13] tests: Add migration xbzrle test Juan Quintela
2018-01-29 12:09 ` [Qemu-devel] [PULL 12/13] tests: Create migrate-start-postcopy command Juan Quintela
2018-01-29 12:09 ` Juan Quintela [this message]
2018-01-29 18:53 ` [Qemu-devel] [PULL 00/13] Migration PULL request Peter Maydell
2018-01-30 6:29 ` Juan Quintela
2018-02-01 13:10 ` Laurent Vivier
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=20180129120932.12874-14-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).