]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/functional/ppc64/pseries: Remove custom migration routine
authorFabiano Rosas <farosas@suse.de>
Tue, 3 Mar 2026 17:33:20 +0000 (14:33 -0300)
committerThomas Huth <thuth@redhat.com>
Tue, 10 Mar 2026 05:18:53 +0000 (06:18 +0100)
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>
Tested-by: Aditya Gupta <adityag@linux.ibm.com>
Message-ID: <20260303173320.10942-5-farosas@suse.de>
[thuth: Remove superfluous ";" as suggested by Aditya]
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/functional/migration.py
tests/functional/ppc64/test_migration.py
tests/functional/ppc64/test_pseries.py

index 49347a30bbf3957d91aa0df8124239a5b004342b..e995328e833f36c536e21304aa274b6e259bfe97 100644 (file)
@@ -65,6 +65,11 @@ class MigrationTest(QemuSystemTest):
             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)
index a3b819680bcee8301b1d491aaf01656fcc95403e..7d49ee175bb9d5436fb2052700ea50e2a62ed034 100755 (executable)
@@ -22,17 +22,6 @@ class PpcMigrationTest(MigrationTest):
         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()
index b45763c305087a57595489f2300408a2cd873eb8..cb6d25dc816f4952aa5458286cd0de5ed91272cb 100755 (executable)
@@ -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 @@ class PseriesMachine(QemuSystemTest):
         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()