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>
Aadeshveer Singh committed
Aug 16, 2026 at 23:16 UTC
c83a31bbcb4caa8bb084282d306dad5ac271cfe1
1 file changed
+24
tests/qtest/migration/file-tests.c
+24
@@ -190,6 +190,25 @@ static void test_multifd_file_mapped_ram_dio(char *name, MigrateCommon *args)
190
test_file_common(args, true);
191
}
192
193
+static void *migrate_hook_start_postcopy_mapped_ram(QTestState *from,
194
+ QTestState *to)
195
+{
196
+ migrate_set_capability(
197
+ to, MigrationCapability_lookup.array[MIGRATION_CAPABILITY_POSTCOPY_RAM],
198
+ true);
199
+
200
+ return NULL;
201
+}
202
+
203
+static void test_postcopy_file_mapped_ram(char *name, MigrateCommon *args)
204
+{
205
+ args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] = true;
206
+
207
+ args->start_hook = migrate_hook_start_postcopy_mapped_ram;
208
+
209
+ test_file_common(args, false);
210
+}
211
+
212
#ifndef _WIN32
213
static void migrate_hook_end_multifd_mapped_ram_fdset(QTestState *from,
214
QTestState *to,
@@ -330,6 +349,11 @@ void migration_test_add_file(MigrationTestEnv *env)
349
migration_test_add("/migration/multifd/file/mapped-ram/live",
350
test_multifd_file_mapped_ram_live);
351
352
+ if (env->has_uffd) {
353
+ migration_test_add("/migration/postcopy/file/mapped-ram",
354
+ test_postcopy_file_mapped_ram);
355
+ }
356
+
357
#ifndef _WIN32
358
migration_test_add("/migration/multifd/file/mapped-ram/fdset",
359
test_multifd_file_mapped_ram_fdset);