All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] tests/functional: Fix ppc64 issue with make -j
@ 2026-03-03 17:33 Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 1/4] tests/functional/migration: Use socket_dir Fabiano Rosas
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Fabiano Rosas @ 2026-03-03 17:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: adityag, thuth, berrange, peterx

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/2361425606

v3:
https://lore.kernel.org/r/20260303134348.8890-1-farosas@suse.de
v2:
https://lore.kernel.org/r/20260204172332.21367-1-farosas@suse.de
v1:
https://lore.kernel.org/r/20260128142829.25326-1-farosas@suse.de

Fabiano Rosas (4):
  tests/functional/migration: Use socket_dir
  tests/functional/migration: Add migrate_vms
  tests/functional/migration: Use the migrate_vms helper
  tests/functional/ppc64/pseries: Remove custom migration routine

 tests/functional/migration.py            | 46 ++++++++++++++----------
 tests/functional/ppc64/test_migration.py | 11 ------
 tests/functional/ppc64/test_pseries.py   | 10 +++---
 3 files changed, 33 insertions(+), 34 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 1/4] tests/functional/migration: Use socket_dir
  2026-03-03 17:33 [PATCH v4 0/4] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
@ 2026-03-03 17:33 ` Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 2/4] tests/functional/migration: Add migrate_vms Fabiano Rosas
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Fabiano Rosas @ 2026-03-03 17:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: adityag, thuth, berrange, peterx

Use QemuBaseTest.socket_dir instead of calling tempfile directly so
all tests have consistent directory prefixes.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Thomas Huth <thuth@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] 7+ messages in thread

* [PATCH v4 2/4] tests/functional/migration: Add migrate_vms
  2026-03-03 17:33 [PATCH v4 0/4] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 1/4] tests/functional/migration: Use socket_dir Fabiano Rosas
@ 2026-03-03 17:33 ` Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 3/4] tests/functional/migration: Use the migrate_vms helper Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
  3 siblings, 0 replies; 7+ messages in thread
From: Fabiano Rosas @ 2026-03-03 17:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: adityag, thuth, berrange, peterx

Add a migration helper to MigrationTest that uses the migrate-incoming
QMP commmand and takes the already instantiated VMs. The -incoming
'defer' command line option is preferred way instead of the -incoming
URI syntax that's currently used.

Suggested-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/functional/migration.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 0aa873edba..3362e5c743 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -40,6 +40,11 @@ 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 migrate_vms(self, dst_uri, src_uri, dst_vm, src_vm):
+        dst_vm.qmp('migrate-incoming', uri=dst_uri)
+        src_vm.qmp('migrate', uri=src_uri)
+        self.assert_migration(src_vm, dst_vm)
+
     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')
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v4 3/4] tests/functional/migration: Use the migrate_vms helper
  2026-03-03 17:33 [PATCH v4 0/4] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 1/4] tests/functional/migration: Use socket_dir Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 2/4] tests/functional/migration: Add migrate_vms Fabiano Rosas
@ 2026-03-03 17:33 ` Fabiano Rosas
  2026-03-03 17:33 ` [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
  3 siblings, 0 replies; 7+ messages in thread
From: Fabiano Rosas @ 2026-03-03 17:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: adityag, thuth, berrange, peterx

Change do_migrate() to call the migrate_vms() helper and provide it
with the two VMs already created. Rename do_migrate -> migrate and
adjust the callers.

While here, standardize on the "src" and "dst" names.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/functional/migration.py | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 3362e5c743..49347a30bb 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -45,17 +45,19 @@ def migrate_vms(self, dst_uri, src_uri, dst_vm, src_vm):
         src_vm.qmp('migrate', uri=src_uri)
         self.assert_migration(src_vm, dst_vm)
 
-    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 migrate(self, dst_uri, src_uri=None):
+        dst_vm = self.get_vm('-incoming', 'defer', name="dst-qemu")
+        dst_vm.add_args('-nodefaults')
+        dst_vm.launch()
+
+        src_vm = self.get_vm(name="src-qemu")
+        src_vm.add_args('-nodefaults')
+        src_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)
+            src_uri = dst_uri
+
+        self.migrate_vms(dst_uri, src_uri, dst_vm, src_vm)
 
     def _get_free_port(self, ports):
         port = ports.find_free_port()
@@ -65,18 +67,18 @@ def _get_free_port(self, ports):
 
     def migration_with_tcp_localhost(self):
         with Ports() as ports:
-            dest_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
-            self.do_migrate(dest_uri)
+            dst_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
+            self.migrate(dst_uri)
 
     def migration_with_unix(self):
-        dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name
-        self.do_migrate(dest_uri)
+        dst_uri = 'unix:%s/migration.sock' % self.socket_dir().name
+        self.migrate(dst_uri)
 
     def migration_with_exec(self):
         if not which('ncat'):
             self.skipTest('ncat is not available')
         with Ports() as ports:
             free_port = self._get_free_port(ports)
-            dest_uri = 'exec:ncat -l localhost %u' % free_port
+            dst_uri = 'exec:ncat -l localhost %u' % free_port
             src_uri = 'exec:ncat localhost %u' % free_port
-            self.do_migrate(dest_uri, src_uri)
+            self.migrate(dst_uri, src_uri)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine
  2026-03-03 17:33 [PATCH v4 0/4] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
                   ` (2 preceding siblings ...)
  2026-03-03 17:33 ` [PATCH v4 3/4] tests/functional/migration: Use the migrate_vms helper Fabiano Rosas
@ 2026-03-03 17:33 ` Fabiano Rosas
  2026-03-03 18:21   ` Aditya Gupta
  2026-03-03 18:43   ` Peter Xu
  3 siblings, 2 replies; 7+ messages in thread
From: Fabiano Rosas @ 2026-03-03 17:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: adityag, thuth, berrange, peterx, 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'

The PseriesMachine class is changed to inherit from MigrationTest so
both the migration routines and the class attributes of PseriesMachine
can be accessed without the need to instantiate another object.

Fixes: f4e34d0fd5 ("tests/functional: Add a OS level migration test for pseries")
Reported-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/functional/migration.py            |  5 +++++
 tests/functional/ppc64/test_migration.py | 11 -----------
 tests/functional/ppc64/test_pseries.py   | 10 +++++-----
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 49347a30bb..e995328e83 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -65,6 +65,11 @@ def _get_free_port(self, ports):
             self.skipTest('Failed to find a free port')
         return port
 
+    def migration_with_tcp_localhost_vms(self, dst_vm, src_vm):
+        with Ports() as ports:
+            uri = 'tcp:localhost:%u' % self._get_free_port(ports)
+            self.migrate_vms(uri, uri, dst_vm, src_vm)
+
     def migration_with_tcp_localhost(self):
         with Ports() as ports:
             dst_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
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..b28292233d 100755
--- a/tests/functional/ppc64/test_pseries.py
+++ b/tests/functional/ppc64/test_pseries.py
@@ -7,11 +7,11 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
-from qemu_test import QemuSystemTest, Asset
+from qemu_test import Asset
 from qemu_test import wait_for_console_pattern
-from test_migration import PpcMigrationTest
+from migration import MigrationTest
 
-class PseriesMachine(QemuSystemTest):
+class PseriesMachine(MigrationTest):
 
     timeout = 90
     KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
@@ -116,11 +116,11 @@ 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);
+        self.migration_with_tcp_localhost_vms(dest_vm, source_vm);
 
         # ensure the boot proceeds after migration
         wait_for_console_pattern(self, self.good_message, self.panic_message,
                                  vm=dest_vm)
 
 if __name__ == '__main__':
-    QemuSystemTest.main()
+    MigrationTest.main()
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine
  2026-03-03 17:33 ` [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
@ 2026-03-03 18:21   ` Aditya Gupta
  2026-03-03 18:43   ` Peter Xu
  1 sibling, 0 replies; 7+ messages in thread
From: Aditya Gupta @ 2026-03-03 18:21 UTC (permalink / raw)
  To: Fabiano Rosas
  Cc: qemu-devel, thuth, berrange, peterx, Nicholas Piggin,
	Harsh Prateek Bora

On 26/03/03 02:33PM, Fabiano Rosas wrote:
> 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'
> 
> The PseriesMachine class is changed to inherit from MigrationTest so
> both the migration routines and the class attributes of PseriesMachine
> can be accessed without the need to instantiate another object.
> 
> Fixes: f4e34d0fd5 ("tests/functional: Add a OS level migration test for pseries")
> Reported-by: Aditya Gupta <adityag@linux.ibm.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>

I don't see any issues with the tests now, and able to run them
parallely, thanks for fixing it !

Tested-by: Aditya Gupta <adityag@linux.ibm.com>

>      timeout = 90
>      KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
> @@ -116,11 +116,11 @@ 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);
> +        self.migration_with_tcp_localhost_vms(dest_vm, source_vm);

nit: the ';', can ignore though

Thanks,
- Aditya G



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine
  2026-03-03 17:33 ` [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
  2026-03-03 18:21   ` Aditya Gupta
@ 2026-03-03 18:43   ` Peter Xu
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Xu @ 2026-03-03 18:43 UTC (permalink / raw)
  To: Fabiano Rosas
  Cc: qemu-devel, adityag, thuth, berrange, Nicholas Piggin,
	Harsh Prateek Bora

On Tue, Mar 03, 2026 at 02:33:20PM -0300, Fabiano Rosas wrote:
> 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'
> 
> The PseriesMachine class is changed to inherit from MigrationTest so
> both the migration routines and the class attributes of PseriesMachine
> can be accessed without the need to instantiate another object.
> 
> Fixes: f4e34d0fd5 ("tests/functional: Add a OS level migration test for pseries")
> Reported-by: Aditya Gupta <adityag@linux.ibm.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-03 18:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 17:33 [PATCH v4 0/4] tests/functional: Fix ppc64 issue with make -j Fabiano Rosas
2026-03-03 17:33 ` [PATCH v4 1/4] tests/functional/migration: Use socket_dir Fabiano Rosas
2026-03-03 17:33 ` [PATCH v4 2/4] tests/functional/migration: Add migrate_vms Fabiano Rosas
2026-03-03 17:33 ` [PATCH v4 3/4] tests/functional/migration: Use the migrate_vms helper Fabiano Rosas
2026-03-03 17:33 ` [PATCH v4 4/4] tests/functional/ppc64/pseries: Remove custom migration routine Fabiano Rosas
2026-03-03 18:21   ` Aditya Gupta
2026-03-03 18:43   ` Peter Xu

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.