On Mon, Dec 15, 2025 at 07:00:11PM -0300, Fabiano Rosas wrote: > With the upcoming addition of the config QDict, the tests will need a > better way of managing the memory of the test data than putting the > test arguments on the stack of the test functions. The config QDict > will need to be merged into the arguments of migrate_qmp* functions, > which causes a refcount increment, so the test functions would need to > allocate and deref the config QDict themselves. > > A better approach is to already pass the arguments into the test > functions and do the memory management in the existing wrapper. There > is already migration_test_destroy(), which is called for every test.
This patch has a conflict with the other mapped-ram fix patch queued for 11.0 already: https://lore.kernel.org/all/[email protected]/ I'll squash this fixup into this patch when sending the pull: >From 5a772b9f992d87055151ab3a026e08b8dc87409e Mon Sep 17 00:00:00 2001 From: Peter Xu <[email protected]> Date: Wed, 17 Dec 2025 13:31:08 -0500 Subject: [PATCH] fixup! tests/qtest/migration: Pass MigrateCommon into test functions Signed-off-by: Peter Xu <[email protected]> --- tests/qtest/migration/file-tests.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/file-tests.c index c4c3016f0a..5d1b861cf6 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -281,20 +281,18 @@ static void migration_test_add_file_smoke(MigrationTestEnv *env) test_multifd_file_mapped_ram_dio); } -static void test_precopy_file_mapped_ram_ignore_shared(void) +static void +test_precopy_file_mapped_ram_ignore_shared(char *name, MigrateCommon *args) { g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs, FILE_TEST_FILENAME); - MigrateCommon args = { - .connect_uri = uri, - .listen_uri = "defer", - .start = { - .caps[MIGRATION_CAPABILITY_MAPPED_RAM] = true, - .caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] = true, - }, - }; - - test_file_common(&args, true); + args->connect_uri = uri; + args->listen_uri = "defer"; + + args->start.caps[MIGRATION_CAPABILITY_MAPPED_RAM] = true; + args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] = true; + + test_file_common(args, true); } void migration_test_add_file(MigrationTestEnv *env) -- 2.50.1 -- Peter Xu
