Four tests are added for preempt mode:
- Postcopy default
- Postcopy tls
- Postcopy recovery
- Postcopy tls+recovery
Signed-off-by: Peter Xu <peterx@redhat.com>
---
tests/qtest/migration-test.c | 49 ++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 7288c64e97..7188503ae1 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -477,6 +477,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 */
@@ -992,6 +993,11 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
migrate_set_capability(to, "postcopy-ram", true);
migrate_set_capability(to, "postcopy-blocktime", true);
+ if (args->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.
@@ -1058,6 +1064,25 @@ static void test_postcopy_tls(void)
test_postcopy_common(&args);
}
+static void test_postcopy_preempt(void)
+{
+ MigrateStart args = {
+ .postcopy_preempt = true,
+ };
+
+ test_postcopy_common(&args);
+}
+
+static void test_postcopy_preempt_tls(void)
+{
+ MigrateStart args = {
+ .postcopy_preempt = true,
+ .postcopy_tls = true,
+ };
+
+ test_postcopy_common(&args);
+}
+
static void test_postcopy_recovery_common(MigrateStart *args)
{
QTestState *from, *to;
@@ -1134,6 +1159,24 @@ static void test_postcopy_recovery_tls(void)
test_postcopy_recovery_common(&args);
}
+static void test_postcopy_preempt_recovery(void)
+{
+ MigrateStart args = { .postcopy_preempt = true };
+
+ test_postcopy_recovery_common(&args);
+}
+
+/* This contains preempt+recovery+tls test altogether */
+static void test_postcopy_preempt_all(void)
+{
+ MigrateStart args = {
+ .postcopy_preempt = true,
+ .postcopy_tls = true,
+ };
+
+ test_postcopy_recovery_common(&args);
+}
+
static void test_baddest(void)
{
MigrateStart args = {
@@ -2176,6 +2219,12 @@ int main(int argc, char **argv)
qtest_add_func("/migration/postcopy/unix", test_postcopy);
qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
+ qtest_add_func("/migration/postcopy/preempt/unix", test_postcopy_preempt);
+ qtest_add_func("/migration/postcopy/preempt/recovery",
+ test_postcopy_preempt_recovery);
+ qtest_add_func("/migration/postcopy/preempt/tls", test_postcopy_preempt_tls);
+ qtest_add_func("/migration/postcopy/preempt/tls+recovery",
+ test_postcopy_preempt_all);
#ifdef CONFIG_GNUTLS
qtest_add_func("/migration/postcopy/tls", test_postcopy_tls);
qtest_add_func("/migration/postcopy/tls/recovery", test_postcopy_recovery_tls);
--
2.32.0