@samitouri / QOSamiQemu / commits / 718b9e4eb6

tests/qtest/migration: Use precopy_unix_common for ignore-shared test

The ignore-shared test has the same code as the precopy_common test but inverting (probably incorrectly) the order of a few event waits. Change it to use the common code instead. Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Peter Xu <peterx@redhat.com> Link: https://lore.kernel.org/r/20260505160915.25558-6-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>

Fabiano Rosas committed May 5, 2026 at 13:09 UTC 718b9e4eb6bc530e99f9b4910df501e39e32c657
1 file changed +11 -29
tests/qtest/migration/misc-tests.c
+11 -29
@@ -90,40 +90,22 @@ static void test_analyze_script(char *name, MigrateCommon *args)
90 }
91 #endif
92
93 -static void test_ignore_shared(char *name, MigrateCommon *args)
93 +static void ignore_shared_assert_skipped(QTestState *from, QTestState *to,
94 + void *data)
95 {
95 - g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
96 - QTestState *from, *to;
97 -
98 - args->start.mem_type = MEM_TYPE_SHMEM;
99 - args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] = true;
100 -
101 - if (migrate_start(&from, &to, uri, &args->start)) {
102 - return;
103 - }
104 -
105 - migrate_ensure_non_converge(from);
106 - migrate_prepare_for_dirty_mem(from);
107 -
108 - /* Wait for the first serial output from the source */
109 - wait_for_serial("src_serial");
110 -
111 - migrate_qmp(from, to, uri, NULL, "{}");
112 -
113 - migrate_wait_for_dirty_mem(from, to);
114 -
115 - wait_for_stop(from, get_src());
116 -
117 - qtest_qmp_eventwait(to, "RESUME");
118 -
119 - wait_for_serial("dest_serial");
120 - wait_for_migration_complete(from);
121 -
96 /* Check whether shared RAM has been really skipped */
97 g_assert_cmpint(
98 read_ram_property_int(from, "transferred"), <, 4 * 1024 * 1024);
99 +}
100 +
101 +static void test_ignore_shared(char *name, MigrateCommon *args)
102 +{
103 + args->live = true;
104 + args->start.mem_type = MEM_TYPE_SHMEM;
105 + args->start.caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED] = true;
106 + args->end_hook = ignore_shared_assert_skipped;
107
126 - migrate_end(from, to, true);
108 + test_precopy_unix_common(args);
109 }
110
111 static void do_test_validate_uuid(MigrateStart *args, bool should_fail)