On Fri, May 09, 2025 at 10:56:05AM +0530, Prasad Pandit wrote: > On Fri, 9 May 2025 at 00:34, Peter Xu <pet...@redhat.com> wrote: > > I may not have followed the whole discussions, but have you tried to avoid > > this global? > > -> https://lore.kernel.org/qemu-devel/875xkyyxyy....@suse.de/ > > * Yes, it was discussed, passing it as a parameter would change the > function prototype and entail changing functions at many places.
Would this work? diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/precopy-tests.c index a575791c72..441a65bcf5 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -34,7 +34,6 @@ #define DIRTYLIMIT_TOLERANCE_RANGE 25 /* MB/s */ static char *tmpfs; -static bool postcopy_ram = false; static void test_precopy_unix_plain(void) { @@ -525,7 +524,7 @@ static void test_multifd_tcp_channels_none(void) * * And see that it works */ -static void test_multifd_tcp_cancel(void) +static void test_multifd_tcp_cancel(bool postcopy_ram) { MigrateStart args = { .hide_stderr = true, @@ -612,11 +611,14 @@ static void test_multifd_tcp_cancel(void) migrate_end(from, to2, true); } +static void test_multifd_precopy_tcp_cancel(void) +{ + test_multifd_tcp_cancel(false); +} + static void test_multifd_postcopy_tcp_cancel(void) { - postcopy_ram = true; - test_multifd_tcp_cancel(); - postcopy_ram = false; + test_multifd_tcp_cancel(true); } static void test_cancel_src_after_failed(QTestState *from, QTestState *to, @@ -1205,7 +1207,7 @@ static void migration_test_add_precopy_smoke(MigrationTestEnv *env) migration_test_add("/migration/multifd/tcp/uri/plain/none", test_multifd_tcp_uri_none); migration_test_add("/migration/multifd/tcp/plain/cancel", - test_multifd_tcp_cancel); + test_multifd_precopy_tcp_cancel); if (env->has_uffd) { migration_test_add("/migration/multifd+postcopy/tcp/plain/cancel", test_multifd_postcopy_tcp_cancel); -- Peter Xu