Commit c83a31bbcb for qemu.org
commit c83a31bbcb4caa8bb084282d306dad5ac271cfe1
Author: Aadeshveer Singh <aadeshveer07@gmail.com>
Date: Sun Aug 16 23:16:30 2026 +0530
migration/tests: Add test for fast snapshot load
Add test_postcopy_file_mapped_ram() to test for saving a snapshot in
mapped ram format and loading it using postcopy/fast snapshot load.
Test is similar to test_precopy_file_mapped_ram() with additional
start_hook to set postcopy capabilities on the receiving end.
Signed-off-by: Aadeshveer Singh <aadeshveer07@gmail.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/file-tests.c
index 5118d9dec9..c7e4b05c61 100644
--- a/tests/qtest/migration/file-tests.c
+++ b/tests/qtest/migration/file-tests.c
@@ -190,6 +190,25 @@ static void test_multifd_file_mapped_ram_dio(char *name, MigrateCommon *args)
test_file_common(args, true);
}
+static void *migrate_hook_start_postcopy_mapped_ram(QTestState *from,
+ QTestState *to)
+{
+ migrate_set_capability(
+ to, MigrationCapability_lookup.array[MIGRATION_CAPABILITY_POSTCOPY_RAM],
+ true);
+
+ return NULL;
+}
+
+static void test_postcopy_file_mapped_ram(char *name, MigrateCommon *args)
+{
+ args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] = true;
+
+ args->start_hook = migrate_hook_start_postcopy_mapped_ram;
+
+ test_file_common(args, false);
+}
+
#ifndef _WIN32
static void migrate_hook_end_multifd_mapped_ram_fdset(QTestState *from,
QTestState *to,
@@ -330,6 +349,11 @@ void migration_test_add_file(MigrationTestEnv *env)
migration_test_add("/migration/multifd/file/mapped-ram/live",
test_multifd_file_mapped_ram_live);
+ if (env->has_uffd) {
+ migration_test_add("/migration/postcopy/file/mapped-ram",
+ test_postcopy_file_mapped_ram);
+ }
+
#ifndef _WIN32
migration_test_add("/migration/multifd/file/mapped-ram/fdset",
test_multifd_file_mapped_ram_fdset);