[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 24/25] tests: Add postcopy preempt test
From: |
Peter Xu |
Subject: |
[PATCH v2 24/25] tests: Add postcopy preempt test |
Date: |
Tue, 1 Mar 2022 16:39:24 +0800 |
Two tests are added: a normal postcopy preempt test, and a recovery test.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
tests/qtest/migration-test.c | 41 ++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 7b42f6fd90..09a9ce4401 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -470,6 +470,7 @@ typedef struct {
*/
bool hide_stderr;
bool use_shmem;
+ bool postcopy_preempt;
/* only launch the target process */
bool only_target;
/* Use dirty ring if true; dirty logging otherwise */
@@ -663,6 +664,8 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
MigrateStart *args)
{
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
+ /* NOTE: args will be freed in test_migrate_start(), cache it */
+ bool postcopy_preempt = args->postcopy_preempt;
QTestState *from, *to;
if (test_migrate_start(&from, &to, uri, args)) {
@@ -673,6 +676,11 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
migrate_set_capability(to, "postcopy-ram", true);
migrate_set_capability(to, "postcopy-blocktime", true);
+ if (postcopy_preempt) {
+ migrate_set_capability(from, "postcopy-preempt", true);
+ migrate_set_capability(to, "postcopy-preempt", true);
+ }
+
/* We want to pick a speed slow enough that the test completes
* quickly, but that it doesn't complete precopy even on a slow
* machine, so also set the downtime.
@@ -719,13 +727,29 @@ static void test_postcopy(void)
migrate_postcopy_complete(from, to);
}
-static void test_postcopy_recovery(void)
+static void test_postcopy_preempt(void)
+{
+ MigrateStart *args = migrate_start_new();
+ QTestState *from, *to;
+
+ args->postcopy_preempt = true;
+
+ if (migrate_postcopy_prepare(&from, &to, args)) {
+ return;
+ }
+ migrate_postcopy_start(from, to);
+ migrate_postcopy_complete(from, to);
+}
+
+/* @preempt: whether to use postcopy-preempt */
+static void test_postcopy_recovery(bool preempt)
{
MigrateStart *args = migrate_start_new();
QTestState *from, *to;
g_autofree char *uri = NULL;
args->hide_stderr = true;
+ args->postcopy_preempt = preempt;
if (migrate_postcopy_prepare(&from, &to, args)) {
return;
@@ -781,6 +805,16 @@ static void test_postcopy_recovery(void)
migrate_postcopy_complete(from, to);
}
+static void test_postcopy_recovery_normal(void)
+{
+ test_postcopy_recovery(false);
+}
+
+static void test_postcopy_recovery_preempt(void)
+{
+ test_postcopy_recovery(true);
+}
+
static void test_baddest(void)
{
MigrateStart *args = migrate_start_new();
@@ -1458,7 +1492,10 @@ int main(int argc, char **argv)
module_call_init(MODULE_INIT_QOM);
qtest_add_func("/migration/postcopy/unix", test_postcopy);
- qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
+ qtest_add_func("/migration/postcopy/recovery",
test_postcopy_recovery_normal);
+ qtest_add_func("/migration/postcopy/preempt/unix", test_postcopy_preempt);
+ qtest_add_func("/migration/postcopy/preempt/recovery",
+ test_postcopy_recovery_preempt);
qtest_add_func("/migration/bad_dest", test_baddest);
qtest_add_func("/migration/precopy/unix", test_precopy_unix);
qtest_add_func("/migration/precopy/tcp", test_precopy_tcp);
--
2.32.0
- [PATCH v2 17/25] migration: Postcopy preemption preparation on channel creation, (continued)
- [PATCH v2 17/25] migration: Postcopy preemption preparation on channel creation, Peter Xu, 2022/03/01
- [PATCH v2 18/25] migration: Postcopy preemption enablement, Peter Xu, 2022/03/01
- [PATCH v2 19/25] migration: Postcopy recover with preempt enabled, Peter Xu, 2022/03/01
- [PATCH v2 12/25] migration: Export ram_load_postcopy(), Peter Xu, 2022/03/01
- [PATCH v2 21/25] migration: Parameter x-postcopy-preempt-break-huge, Peter Xu, 2022/03/01
- [PATCH v2 22/25] migration: Add helpers to detect TLS capability, Peter Xu, 2022/03/01
- [PATCH v2 23/25] migration: Fail postcopy preempt with TLS for now, Peter Xu, 2022/03/01
- [PATCH v2 20/25] migration: Create the postcopy preempt channel asynchronously, Peter Xu, 2022/03/01
- [PATCH v2 25/25] tests: Pass in MigrateStart** into test_migrate_start(), Peter Xu, 2022/03/01
- [PATCH v2 24/25] tests: Add postcopy preempt test,
Peter Xu <=
- Re: [PATCH v2 00/25] migration: Postcopy Preemption, Daniel P . Berrangé, 2022/03/01
- Re: [PATCH v2 00/25] migration: Postcopy Preemption, Peter Xu, 2022/03/01
- Re: [PATCH v2 00/25] migration: Postcopy Preemption, Daniel P . Berrangé, 2022/03/01
- Re: [PATCH v2 00/25] migration: Postcopy Preemption, Peter Xu, 2022/03/01
- Re: [PATCH v2 00/25] migration: Postcopy Preemption, Dr. David Alan Gilbert, 2022/03/01
- Re: [PATCH v2 00/25] migration: Postcopy Preemption, Peter Xu, 2022/03/01
- Time to introduce a migration protocol negotiation (Re: [PATCH v2 00/25] migration: Postcopy Preemption), Daniel P . Berrangé, 2022/03/14
- Re: Time to introduce a migration protocol negotiation (Re: [PATCH v2 00/25] migration: Postcopy Preemption), Peter Xu, 2022/03/15
- Re: Time to introduce a migration protocol negotiation (Re: [PATCH v2 00/25] migration: Postcopy Preemption), Daniel P . Berrangé, 2022/03/15
- Re: Time to introduce a migration protocol negotiation (Re: [PATCH v2 00/25] migration: Postcopy Preemption), Peter Xu, 2022/03/15