* [PATCH 0/3] tests/functional: Fix ppc64 issue with make -j
@ 2026-01-28 14:28 Fabiano Rosas
2026-01-28 14:28 ` [PATCH 1/3] tests/functional/migration: Use socket_dir Fabiano Rosas
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Fabiano Rosas @ 2026-01-28 14:28 UTC (permalink / raw)
To: qemu-devel
As reported in [1], running the ppc64 functional tests in parallel is
currently broken due to one test importing another and causing
unittest.main to instantiate the imported test twice. Fix by removing
the dependency between tests.
1- https://lore.kernel.org/r/aXOGKb88Yho2jb_o@li-3c92a0cc-27cf-11b2-a85c-b804d9ca68fa.ibm.com
CI run: https://gitlab.com/farosas/qemu/-/pipelines/2289828999
Fabiano Rosas (3):
tests/functional/migration: Use socket_dir
tests/functional/migration: Accept vm objects in do_migrate
tests/functional/ppc64: Remove custom migration routine
tests/functional/migration.py | 31 ++++++++++++++----------
tests/functional/ppc64/test_migration.py | 11 ---------
tests/functional/ppc64/test_pseries.py | 6 +++--
3 files changed, 22 insertions(+), 26 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/3] tests/functional/migration: Use socket_dir 2026-01-28 14:28 [PATCH 0/3] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas @ 2026-01-28 14:28 ` Fabiano Rosas 2026-01-28 19:37 ` Peter Xu 2026-01-28 14:28 ` [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate Fabiano Rosas 2026-01-28 14:28 ` [PATCH 3/3] tests/functional/ppc64: Remove custom migration routine Fabiano Rosas 2 siblings, 1 reply; 6+ messages in thread From: Fabiano Rosas @ 2026-01-28 14:28 UTC (permalink / raw) To: qemu-devel; +Cc: Daniel P. Berrangé, Peter Xu Use QemuBaseTest.socket_dir instead of calling tempfile directly so all tests have consistent directory prefixes. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> --- tests/functional/migration.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/functional/migration.py b/tests/functional/migration.py index 2bfb1f7790..0aa873edba 100644 --- a/tests/functional/migration.py +++ b/tests/functional/migration.py @@ -11,7 +11,6 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -import tempfile import time from qemu_test import QemuSystemTest, which @@ -65,9 +64,8 @@ def migration_with_tcp_localhost(self): self.do_migrate(dest_uri) def migration_with_unix(self): - with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: - dest_uri = 'unix:%s/qemu-test.sock' % socket_path - self.do_migrate(dest_uri) + dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name + self.do_migrate(dest_uri) def migration_with_exec(self): if not which('ncat'): -- 2.51.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] tests/functional/migration: Use socket_dir 2026-01-28 14:28 ` [PATCH 1/3] tests/functional/migration: Use socket_dir Fabiano Rosas @ 2026-01-28 19:37 ` Peter Xu 0 siblings, 0 replies; 6+ messages in thread From: Peter Xu @ 2026-01-28 19:37 UTC (permalink / raw) To: Fabiano Rosas; +Cc: qemu-devel, Daniel P. Berrangé On Wed, Jan 28, 2026 at 11:28:27AM -0300, Fabiano Rosas wrote: > Use QemuBaseTest.socket_dir instead of calling tempfile directly so > all tests have consistent directory prefixes. > > Suggested-by: Daniel P. Berrangé <berrange@redhat.com> > Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Peter Xu <peterx@redhat.com> -- Peter Xu ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate 2026-01-28 14:28 [PATCH 0/3] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas 2026-01-28 14:28 ` [PATCH 1/3] tests/functional/migration: Use socket_dir Fabiano Rosas @ 2026-01-28 14:28 ` Fabiano Rosas 2026-01-28 19:35 ` Peter Xu 2026-01-28 14:28 ` [PATCH 3/3] tests/functional/ppc64: Remove custom migration routine Fabiano Rosas 2 siblings, 1 reply; 6+ messages in thread From: Fabiano Rosas @ 2026-01-28 14:28 UTC (permalink / raw) To: qemu-devel; +Cc: Peter Xu Allow MigrationTest.do_migrate() to receive objects for virtual machines already created. This will allow MigrationTest to provide the migration functionality for tests that are defined in a separate module and require extra setup (e.g. arch-specific) to the virtual machines before migration. The next patches will instantiate MigrationTest from another test class. Signed-off-by: Fabiano Rosas <farosas@suse.de> --- tests/functional/migration.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/functional/migration.py b/tests/functional/migration.py index 0aa873edba..ac6feeeefb 100644 --- a/tests/functional/migration.py +++ b/tests/functional/migration.py @@ -40,15 +40,22 @@ def assert_migration(self, src_vm, dst_vm): self.assertEqual(dst_vm.cmd('query-status')['status'], 'running') self.assertEqual(src_vm.cmd('query-status')['status'],'postmigrate') - def do_migrate(self, dest_uri, src_uri=None): - dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu") - dest_vm.add_args('-nodefaults') - dest_vm.launch() + def do_migrate(self, dest_uri, src_uri=None, source_vm=None, dest_vm=None): + if dest_vm: + dest_vm.qmp('migrate-incoming', uri=dest_uri) + else: + dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu") + dest_vm.add_args('-nodefaults') + dest_vm.launch() + + if not source_vm: + source_vm = self.get_vm(name="source-qemu") + source_vm.add_args('-nodefaults') + source_vm.launch() + if src_uri is None: src_uri = dest_uri - source_vm = self.get_vm(name="source-qemu") - source_vm.add_args('-nodefaults') - source_vm.launch() + source_vm.qmp('migrate', uri=src_uri) self.assert_migration(source_vm, dest_vm) -- 2.51.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate 2026-01-28 14:28 ` [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate Fabiano Rosas @ 2026-01-28 19:35 ` Peter Xu 0 siblings, 0 replies; 6+ messages in thread From: Peter Xu @ 2026-01-28 19:35 UTC (permalink / raw) To: Fabiano Rosas; +Cc: qemu-devel On Wed, Jan 28, 2026 at 11:28:28AM -0300, Fabiano Rosas wrote: > Allow MigrationTest.do_migrate() to receive objects for virtual > machines already created. This will allow MigrationTest to provide the > migration functionality for tests that are defined in a separate > module and require extra setup (e.g. arch-specific) to the virtual > machines before migration. > > The next patches will instantiate MigrationTest from another test > class. > > Signed-off-by: Fabiano Rosas <farosas@suse.de> > --- > tests/functional/migration.py | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/tests/functional/migration.py b/tests/functional/migration.py > index 0aa873edba..ac6feeeefb 100644 > --- a/tests/functional/migration.py > +++ b/tests/functional/migration.py > @@ -40,15 +40,22 @@ def assert_migration(self, src_vm, dst_vm): > self.assertEqual(dst_vm.cmd('query-status')['status'], 'running') > self.assertEqual(src_vm.cmd('query-status')['status'],'postmigrate') > > - def do_migrate(self, dest_uri, src_uri=None): > - dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu") > - dest_vm.add_args('-nodefaults') > - dest_vm.launch() > + def do_migrate(self, dest_uri, src_uri=None, source_vm=None, dest_vm=None): Nit: maybe good to always have dst, then src, or vice versa. > + if dest_vm: > + dest_vm.qmp('migrate-incoming', uri=dest_uri) > + else: > + dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu") > + dest_vm.add_args('-nodefaults') > + dest_vm.launch() Maybe this is a chance to switch to -incoming defer and always use "migrate-incoming" QMP? Then we can have _do_migrate() (or some better name..) do the real migration commands, always taking VMs + URIs, making do_migrate() only create two VMs and pass it over. > + > + if not source_vm: > + source_vm = self.get_vm(name="source-qemu") > + source_vm.add_args('-nodefaults') > + source_vm.launch() > + > if src_uri is None: > src_uri = dest_uri > - source_vm = self.get_vm(name="source-qemu") > - source_vm.add_args('-nodefaults') > - source_vm.launch() > + > source_vm.qmp('migrate', uri=src_uri) > self.assert_migration(source_vm, dest_vm) > > -- > 2.51.0 > -- Peter Xu ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] tests/functional/ppc64: Remove custom migration routine 2026-01-28 14:28 [PATCH 0/3] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas 2026-01-28 14:28 ` [PATCH 1/3] tests/functional/migration: Use socket_dir Fabiano Rosas 2026-01-28 14:28 ` [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate Fabiano Rosas @ 2026-01-28 14:28 ` Fabiano Rosas 2 siblings, 0 replies; 6+ messages in thread From: Fabiano Rosas @ 2026-01-28 14:28 UTC (permalink / raw) To: qemu-devel; +Cc: Aditya Gupta, Peter Xu, Nicholas Piggin, Harsh Prateek Bora Don't implement a custom migration routine at PpcMigrationTest and instead reuse the generic one from MigrationTest. This removes the dependency of PpcMigrationTest from PseriesMachine. Having one test import another causes unittest code to instantiate the imported test, resulting in the setup and teardown methods being invoked for the imported test class, even if no test from that class will be executed. If run in parallel, the extra setup/teardown methods that result from importing can race with the ones from the actual test being executed and cause the following error: File "<SRC_DIR>/tests/functional/qemu_test/testcase.py", line 238, in tearDown shutil.rmtree(self.workdir) ... FileNotFoundError: [Errno 2] No such file or directory: '<SRC_DIR>/build/tests/functional/ppc64/.../test_migration_with_exec/scratch' Fixes: f4e34d0fd5 ("tests/functional: Add a OS level migration test for pseries") Reported-by: Aditya Gupta <adityag@linux.ibm.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> --- tests/functional/migration.py | 4 ++-- tests/functional/ppc64/test_migration.py | 11 ----------- tests/functional/ppc64/test_pseries.py | 6 ++++-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/tests/functional/migration.py b/tests/functional/migration.py index ac6feeeefb..008be67d3f 100644 --- a/tests/functional/migration.py +++ b/tests/functional/migration.py @@ -65,10 +65,10 @@ def _get_free_port(self, ports): self.skipTest('Failed to find a free port') return port - def migration_with_tcp_localhost(self): + def migration_with_tcp_localhost(self, src_vm=None, dst_vm=None): with Ports() as ports: dest_uri = 'tcp:localhost:%u' % self._get_free_port(ports) - self.do_migrate(dest_uri) + self.do_migrate(dest_uri, source_vm=src_vm, dest_vm=dst_vm) def migration_with_unix(self): dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name diff --git a/tests/functional/ppc64/test_migration.py b/tests/functional/ppc64/test_migration.py index a3b819680b..7d49ee175b 100755 --- a/tests/functional/ppc64/test_migration.py +++ b/tests/functional/ppc64/test_migration.py @@ -22,17 +22,6 @@ def test_migration_with_exec(self): self.set_machine('mac99') self.migration_with_exec() - def do_migrate_ppc64_linux(self, source_vm, dest_vm): - with Ports() as ports: - port = ports.find_free_port() - if port is None: - self.skipTest('Failed to find a free port') - uri = 'tcp:localhost:%u' % port - - dest_vm.qmp('migrate-incoming', uri=uri) - source_vm.qmp('migrate', uri=uri) - self.assert_migration(source_vm, dest_vm) - if __name__ == '__main__': MigrationTest.main() diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py index b45763c305..368c85762e 100755 --- a/tests/functional/ppc64/test_pseries.py +++ b/tests/functional/ppc64/test_pseries.py @@ -9,7 +9,7 @@ from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern -from test_migration import PpcMigrationTest +from migration import MigrationTest class PseriesMachine(QemuSystemTest): @@ -116,7 +116,9 @@ def test_ppc64_linux_migration(self): wait_for_console_pattern(self, console_pattern, self.panic_message, vm=source_vm) - PpcMigrationTest().do_migrate_ppc64_linux(source_vm, dest_vm); + mt = MigrationTest() + mt.timeout = self.timeout + mt.migration_with_tcp_localhost(source_vm, dest_vm); # ensure the boot proceeds after migration wait_for_console_pattern(self, self.good_message, self.panic_message, -- 2.51.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-28 19:37 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-28 14:28 [PATCH 0/3] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas 2026-01-28 14:28 ` [PATCH 1/3] tests/functional/migration: Use socket_dir Fabiano Rosas 2026-01-28 19:37 ` Peter Xu 2026-01-28 14:28 ` [PATCH 2/3] tests/functional/migration: Accept vm objects in do_migrate Fabiano Rosas 2026-01-28 19:35 ` Peter Xu 2026-01-28 14:28 ` [PATCH 3/3] tests/functional/ppc64: Remove custom migration routine Fabiano Rosas
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.