[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/10] tests/qtest: capture RESUME events during migration
From: |
Juan Quintela |
Subject: |
[PULL 07/10] tests/qtest: capture RESUME events during migration |
Date: |
Fri, 2 Jun 2023 12:49:07 +0200 |
From: Daniel P. Berrangé <berrange@redhat.com>
When running migration tests we monitor for a STOP event so we can skip
redundant waits. This will be needed for the RESUME event too shortly.
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230601161347.1803440-8-berrange@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
tests/qtest/migration-helpers.h | 2 ++
tests/qtest/migration-helpers.c | 13 +++++++++++++
tests/qtest/migration-test.c | 5 +++++
3 files changed, 20 insertions(+)
diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index aab0745cfe..009e250e90 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -17,6 +17,8 @@
bool migrate_watch_for_stop(QTestState *who, const char *name,
QDict *event, void *opaque);
+bool migrate_watch_for_resume(QTestState *who, const char *name,
+ QDict *event, void *opaque);
G_GNUC_PRINTF(3, 4)
void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...);
diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index 73e506a5f8..be00c52d00 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -36,6 +36,19 @@ bool migrate_watch_for_stop(QTestState *who, const char
*name,
return false;
}
+bool migrate_watch_for_resume(QTestState *who, const char *name,
+ QDict *event, void *opaque)
+{
+ bool *seen = opaque;
+
+ if (g_str_equal(name, "RESUME")) {
+ *seen = true;
+ return true;
+ }
+
+ return false;
+}
+
/*
* Send QMP command "migrate".
* Arguments are built from @fmt... (formatted like
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 822cf13536..0948d13e14 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -44,6 +44,7 @@ unsigned start_address;
unsigned end_address;
static bool uffd_feature_thread_id;
static bool got_stop;
+static bool got_resume;
/*
* Dirtylimit stop working if dirty page rate error
@@ -607,6 +608,7 @@ static int test_migrate_start(QTestState **from, QTestState
**to,
}
got_stop = false;
+ got_resume = false;
bootpath = g_strdup_printf("%s/bootsect", tmpfs);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
/* the assembled x86 boot sector should be exactly one sector large */
@@ -712,6 +714,9 @@ static int test_migrate_start(QTestState **from, QTestState
**to,
args->opts_target ? args->opts_target : "",
ignore_stderr);
*to = qtest_init(cmd_target);
+ qtest_qmp_set_event_callback(*to,
+ migrate_watch_for_resume,
+ &got_resume);
/*
* Remove shmem file immediately to avoid memory leak in test failed case.
--
2.40.1
- [PULL 00/10] Migration 20230602 patches, Juan Quintela, 2023/06/02
- [PULL 01/10] tests/qtest: add various qtest_qmp_assert_success() variants, Juan Quintela, 2023/06/02
- [PULL 02/10] tests/qtest: add support for callback to receive QMP events, Juan Quintela, 2023/06/02
- [PULL 04/10] tests/qtest: get rid of some 'qtest_qmp' usage in migration test, Juan Quintela, 2023/06/02
- [PULL 07/10] tests/qtest: capture RESUME events during migration,
Juan Quintela <=
- [PULL 06/10] tests/qtest: replace wait_command() with qtest_qmp_assert_success, Juan Quintela, 2023/06/02
- [PULL 08/10] tests/qtest: distinguish src/dst migration VM stop/resume events, Juan Quintela, 2023/06/02
- [PULL 10/10] qtest/migration: Document live=true cases, Juan Quintela, 2023/06/02
- [PULL 09/10] tests/qtest: make more migration pre-copy scenarios run non-live, Juan Quintela, 2023/06/02
- [PULL 05/10] tests/qtest: switch to using event callbacks for STOP event, Juan Quintela, 2023/06/02
- [PULL 03/10] tests/qtest: get rid of 'qmp_command' helper in migration test, Juan Quintela, 2023/06/02
- Re: [PULL 00/10] Migration 20230602 patches, Richard Henderson, 2023/06/02