]> git.ipfire.org Git - thirdparty/qemu.git/commit
tests/qtest/migration: Pass MigrateCommon into test functions
authorFabiano Rosas <farosas@suse.de>
Mon, 15 Dec 2025 22:00:11 +0000 (19:00 -0300)
committerPeter Xu <peterx@redhat.com>
Tue, 23 Dec 2025 14:24:34 +0000 (09:24 -0500)
commit6fea394aa6d4b6ffb7b7631e247ef9de7c59b4fa
treef9c440ab498fd5ecfe28efdacf68bd695526dbf8
parent058f71402ff7686ff222340b01b72f4ed89fba52
tests/qtest/migration: Pass MigrateCommon into test functions

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.

Do the following:

- merge the two existing wrappers, migration_test_wrapper() and
  migration_test_wrapper_full(). The latter was pioneer in passing
  data into the tests, but now all tests will receive data, so we
  don't need it anymore.

  The usage of migration_test_wrapper_full() was in passing a slightly
  different test name string into the cancel tests, so still keep the
  migration_test_add_suffix() function.

- add (char *name, MigrateCommon *args) to the signature of all test
  functions.

- alter any code to stop allocating args on the stack and instead use
  the object that came as parameter.

- pass args around as needed.

- while here, order args (MigrateCommon) before args->start
  (MigrateStart) and put a blank like in between.

No functional change.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20251215220041.12657-26-farosas@suse.de
[peterx: fix a conflict with newly added mapped-ram+ignore-share test]
Signed-off-by: Peter Xu <peterx@redhat.com>
tests/qtest/migration/compression-tests.c
tests/qtest/migration/cpr-tests.c
tests/qtest/migration/file-tests.c
tests/qtest/migration/migration-util.c
tests/qtest/migration/migration-util.h
tests/qtest/migration/misc-tests.c
tests/qtest/migration/postcopy-tests.c
tests/qtest/migration/precopy-tests.c
tests/qtest/migration/tls-tests.c