From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Richard Henderson <richard.henderson@linaro.org>,
Pierrick Bouvier <pierrick.bouvier@linaro.org>
Subject: [PULL 06/31] tests/functional: Rework the migration test to have target-specific files
Date: Wed, 27 Aug 2025 09:54:16 +0200 [thread overview]
Message-ID: <20250827075443.559712-7-thuth@redhat.com> (raw)
In-Reply-To: <20250827075443.559712-1-thuth@redhat.com>
From: Thomas Huth <thuth@redhat.com>
We are going to move the tests for each target into separate subdirectories.
The migration test does not fit quite into this scheme, since it works
for multiple targets, but not all. Rework the test to have a common
test class, and target specific files with a target specific class, so
that this will fit better into the new scheme.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-2-thuth@redhat.com>
---
MAINTAINERS | 2 +-
tests/functional/meson.build | 22 ++++++------
.../{test_migration.py => migration.py} | 35 +++++--------------
tests/functional/test_aarch64_migration.py | 26 ++++++++++++++
tests/functional/test_alpha_migration.py | 26 ++++++++++++++
tests/functional/test_arm_migration.py | 26 ++++++++++++++
tests/functional/test_i386_migration.py | 26 ++++++++++++++
tests/functional/test_ppc64_migration.py | 26 ++++++++++++++
tests/functional/test_ppc_migration.py | 26 ++++++++++++++
tests/functional/test_riscv32_migration.py | 26 ++++++++++++++
tests/functional/test_riscv64_migration.py | 26 ++++++++++++++
tests/functional/test_sparc64_migration.py | 26 ++++++++++++++
tests/functional/test_sparc_migration.py | 26 ++++++++++++++
tests/functional/test_x86_64_migration.py | 26 ++++++++++++++
14 files changed, 306 insertions(+), 39 deletions(-)
rename tests/functional/{test_migration.py => migration.py} (74%)
mode change 100755 => 100644
create mode 100755 tests/functional/test_aarch64_migration.py
create mode 100755 tests/functional/test_alpha_migration.py
create mode 100755 tests/functional/test_arm_migration.py
create mode 100755 tests/functional/test_i386_migration.py
create mode 100755 tests/functional/test_ppc64_migration.py
create mode 100755 tests/functional/test_ppc_migration.py
create mode 100755 tests/functional/test_riscv32_migration.py
create mode 100755 tests/functional/test_riscv64_migration.py
create mode 100755 tests/functional/test_sparc64_migration.py
create mode 100755 tests/functional/test_sparc_migration.py
create mode 100755 tests/functional/test_x86_64_migration.py
diff --git a/MAINTAINERS b/MAINTAINERS
index a07086ed762..56c1fe67690 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3597,7 +3597,7 @@ F: include/migration/
F: include/qemu/userfaultfd.h
F: migration/
F: scripts/vmstate-static-checker.py
-F: tests/functional/test_migration.py
+F: tests/functional/*migration.py
F: tests/vmstate-static-checker-data/
F: tests/qtest/migration/
F: tests/qtest/migration-*
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 311c6f18065..c32436d99ad 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -80,7 +80,7 @@ tests_generic_bsduser = [
]
tests_aarch64_system_quick = [
- 'migration',
+ 'aarch64_migration',
]
tests_aarch64_system_thorough = [
@@ -110,7 +110,7 @@ tests_aarch64_system_thorough = [
]
tests_alpha_system_quick = [
- 'migration',
+ 'alpha_migration',
]
tests_alpha_system_thorough = [
@@ -119,7 +119,7 @@ tests_alpha_system_thorough = [
]
tests_arm_system_quick = [
- 'migration',
+ 'arm_migration',
]
tests_arm_system_thorough = [
@@ -168,7 +168,7 @@ tests_hppa_system_quick = [
]
tests_i386_system_quick = [
- 'migration',
+ 'i386_migration',
]
tests_i386_system_thorough = [
@@ -228,7 +228,7 @@ tests_or1k_system_thorough = [
]
tests_ppc_system_quick = [
- 'migration',
+ 'ppc_migration',
'ppc_74xx',
]
@@ -245,7 +245,7 @@ tests_ppc_system_thorough = [
]
tests_ppc64_system_quick = [
- 'migration',
+ 'ppc64_migration',
]
tests_ppc64_system_thorough = [
@@ -260,7 +260,7 @@ tests_ppc64_system_thorough = [
]
tests_riscv32_system_quick = [
- 'migration',
+ 'riscv32_migration',
'riscv_opensbi',
]
@@ -269,7 +269,7 @@ tests_riscv32_system_thorough = [
]
tests_riscv64_system_quick = [
- 'migration',
+ 'riscv64_migration',
'riscv_opensbi',
]
@@ -300,7 +300,7 @@ tests_sh4eb_system_thorough = [
]
tests_sparc_system_quick = [
- 'migration',
+ 'sparc_migration',
]
tests_sparc_system_thorough = [
@@ -309,7 +309,7 @@ tests_sparc_system_thorough = [
]
tests_sparc64_system_quick = [
- 'migration',
+ 'sparc64_migration',
]
tests_sparc64_system_thorough = [
@@ -320,7 +320,7 @@ tests_sparc64_system_thorough = [
tests_x86_64_system_quick = [
'cpu_queries',
'mem_addr_space',
- 'migration',
+ 'x86_64_migration',
'pc_cpu_hotplug_props',
'virtio_version',
'x86_cpu_model_versions',
diff --git a/tests/functional/test_migration.py b/tests/functional/migration.py
old mode 100755
new mode 100644
similarity index 74%
rename from tests/functional/test_migration.py
rename to tests/functional/migration.py
index c4393c35434..07395544832
--- a/tests/functional/test_migration.py
+++ b/tests/functional/migration.py
@@ -1,6 +1,6 @@
-#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0-or-later
#
-# Migration test
+# Migration test base class
#
# Copyright (c) 2019 Red Hat, Inc.
#
@@ -14,7 +14,7 @@
import tempfile
import time
-from qemu_test import QemuSystemTest, skipIfMissingCommands
+from qemu_test import QemuSystemTest, which
from qemu_test.ports import Ports
@@ -41,24 +41,7 @@ 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 select_machine(self):
- target_machine = {
- 'aarch64': 'quanta-gsj',
- 'alpha': 'clipper',
- 'arm': 'npcm750-evb',
- 'i386': 'isapc',
- 'ppc': 'sam460ex',
- 'ppc64': 'mac99',
- 'riscv32': 'spike',
- 'riscv64': 'virt',
- 'sparc': 'SS-4',
- 'sparc64': 'sun4u',
- 'x86_64': 'microvm',
- }
- self.set_machine(target_machine[self.arch])
-
def do_migrate(self, dest_uri, src_uri=None):
- self.select_machine()
dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu")
dest_vm.add_args('-nodefaults')
dest_vm.launch()
@@ -76,23 +59,21 @@ def _get_free_port(self, ports):
self.skipTest('Failed to find a free port')
return port
- def test_migration_with_tcp_localhost(self):
+ 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)
- def test_migration_with_unix(self):
+ 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)
- @skipIfMissingCommands('ncat')
- def test_migration_with_exec(self):
+ 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
src_uri = 'exec:ncat localhost %u' % free_port
self.do_migrate(dest_uri, src_uri)
-
-if __name__ == '__main__':
- QemuSystemTest.main()
diff --git a/tests/functional/test_aarch64_migration.py b/tests/functional/test_aarch64_migration.py
new file mode 100755
index 00000000000..70267e756d9
--- /dev/null
+++ b/tests/functional/test_aarch64_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# aarch64 migration test
+
+from migration import MigrationTest
+
+
+class Aarch64MigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('quanta-gsj')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('quanta-gsj')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('quanta-gsj')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_alpha_migration.py b/tests/functional/test_alpha_migration.py
new file mode 100755
index 00000000000..f11b523ec9e
--- /dev/null
+++ b/tests/functional/test_alpha_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Alpha migration test
+
+from migration import MigrationTest
+
+
+class AlphaMigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('clipper')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('clipper')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('clipper')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_arm_migration.py b/tests/functional/test_arm_migration.py
new file mode 100755
index 00000000000..0aa89f4f61a
--- /dev/null
+++ b/tests/functional/test_arm_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# arm migration test
+
+from migration import MigrationTest
+
+
+class ArmMigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('npcm750-evb')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('npcm750-evb')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('npcm750-evb')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_i386_migration.py b/tests/functional/test_i386_migration.py
new file mode 100755
index 00000000000..a57f3164044
--- /dev/null
+++ b/tests/functional/test_i386_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# i386 migration test
+
+from migration import MigrationTest
+
+
+class I386MigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('isapc')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('isapc')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('isapc')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_ppc64_migration.py b/tests/functional/test_ppc64_migration.py
new file mode 100755
index 00000000000..5dfdaaf709a
--- /dev/null
+++ b/tests/functional/test_ppc64_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# ppc migration test
+
+from migration import MigrationTest
+
+
+class PpcMigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('mac99')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('mac99')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('mac99')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_ppc_migration.py b/tests/functional/test_ppc_migration.py
new file mode 100755
index 00000000000..a8692826d35
--- /dev/null
+++ b/tests/functional/test_ppc_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# ppc migration test
+
+from migration import MigrationTest
+
+
+class PpcMigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('sam460ex')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('sam460ex')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('sam460ex')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_riscv32_migration.py b/tests/functional/test_riscv32_migration.py
new file mode 100755
index 00000000000..30acbbe69f9
--- /dev/null
+++ b/tests/functional/test_riscv32_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# riscv32 migration test
+
+from migration import MigrationTest
+
+
+class Rv32MigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('spike')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('virt')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('spike')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_riscv64_migration.py b/tests/functional/test_riscv64_migration.py
new file mode 100755
index 00000000000..2d613a29ec4
--- /dev/null
+++ b/tests/functional/test_riscv64_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# riscv64 migration test
+
+from migration import MigrationTest
+
+
+class Rv64MigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('virt')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('spike')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('virt')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_sparc64_migration.py b/tests/functional/test_sparc64_migration.py
new file mode 100755
index 00000000000..a8a6c73c354
--- /dev/null
+++ b/tests/functional/test_sparc64_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Sparc64 migration test
+
+from migration import MigrationTest
+
+
+class Sparc64MigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('sun4u')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('sun4u')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('sun4u')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_sparc_migration.py b/tests/functional/test_sparc_migration.py
new file mode 100755
index 00000000000..dd6d5783b11
--- /dev/null
+++ b/tests/functional/test_sparc_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Sparc migration test
+
+from migration import MigrationTest
+
+
+class SparcMigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('SS-4')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('SS-5')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('SS-4')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
diff --git a/tests/functional/test_x86_64_migration.py b/tests/functional/test_x86_64_migration.py
new file mode 100755
index 00000000000..f3a517ae1f6
--- /dev/null
+++ b/tests/functional/test_x86_64_migration.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# x86_64 migration test
+
+from migration import MigrationTest
+
+
+class X8664MigrationTest(MigrationTest):
+
+ def test_migration_with_tcp_localhost(self):
+ self.set_machine('microvm')
+ self.migration_with_tcp_localhost()
+
+ def test_migration_with_unix(self):
+ self.set_machine('microvm')
+ self.migration_with_unix()
+
+ def test_migration_with_exec(self):
+ self.set_machine('microvm')
+ self.migration_with_exec()
+
+
+if __name__ == '__main__':
+ MigrationTest.main()
--
2.50.1
next prev parent reply other threads:[~2025-08-27 8:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 7:54 [PULL 00/31] First pull request with functional tests patches for QEMU 10.2 Thomas Huth
2025-08-27 7:54 ` [PULL 01/31] hw: add compat machines for 10.2 Thomas Huth
2025-08-27 7:54 ` [PULL 02/31] CI: Use mingw-w64-x86_64-curl-winssl instead of mingw-w64-x86_64-curl for Windows build Thomas Huth
2025-08-27 7:54 ` [PULL 03/31] tests/functional/test_aarch64_virt_gpu: Skip test if EGL won't initialize Thomas Huth
2025-08-27 7:54 ` [PULL 04/31] tests/functional: Fix reverse_debugging asset precaching Thomas Huth
2025-08-27 7:54 ` [PULL 05/31] tests/functional: Use more fine-grained locking when looking for free ports Thomas Huth
2025-08-27 7:54 ` Thomas Huth [this message]
2025-08-27 7:54 ` [PULL 07/31] tests/functional: Rework the multiprocess test to have target-specific files Thomas Huth
2025-08-27 7:54 ` [PULL 08/31] tests/functional/meson.build: Split timeout settings by target Thomas Huth
2025-08-27 7:54 ` [PULL 09/31] tests/functional/meson.build: Allow tests to reside in subfolders Thomas Huth
2025-08-27 7:54 ` [PULL 10/31] tests/functional: Move aarch64 tests into architecture specific folder Thomas Huth
2025-08-27 7:54 ` [PULL 11/31] tests/functional: Move alpha " Thomas Huth
2025-08-27 7:54 ` [PULL 12/31] tests/functional: Move arm " Thomas Huth
2025-08-27 7:54 ` [PULL 13/31] tests/functional: Move avr " Thomas Huth
2025-08-27 7:54 ` [PULL 14/31] tests/functional: Move hppa " Thomas Huth
2025-08-27 7:54 ` [PULL 15/31] tests/functional: Move i386 " Thomas Huth
2025-08-27 7:54 ` [PULL 16/31] tests/functional: Move loongarch64 " Thomas Huth
2025-08-27 7:54 ` [PULL 17/31] tests/functional: Move m68k " Thomas Huth
2025-08-27 7:54 ` [PULL 18/31] tests/functional: Move microblaze " Thomas Huth
2025-08-27 7:54 ` [PULL 19/31] tests/functional: Move mips tests into target-specific folders Thomas Huth
2025-08-27 7:54 ` [PULL 20/31] tests/functional: Move or1k " Thomas Huth
2025-08-27 7:54 ` [PULL 21/31] tests/functional: Move ppc/ppc64 " Thomas Huth
2025-08-27 7:54 ` [PULL 22/31] tests/functional: Move riscv32/riscv64 " Thomas Huth
2025-08-27 7:54 ` [PULL 23/31] tests/functional: Move rx test " Thomas Huth
2025-08-27 7:54 ` [PULL 24/31] tests/functional: Move s390x tests " Thomas Huth
2025-08-27 7:54 ` [PULL 25/31] tests/functional: Move sh4/sh4eb " Thomas Huth
2025-08-27 7:54 ` [PULL 26/31] tests/functional: Move sparc/sparc64 " Thomas Huth
2025-08-27 7:54 ` [PULL 27/31] tests/functional: Move x86_64 tests into target-specific folder Thomas Huth
2025-08-27 7:54 ` [PULL 28/31] tests/functional: Move xtensa " Thomas Huth
2025-08-27 7:54 ` [PULL 29/31] tests/functional: Move the generic tests to a subfolder Thomas Huth
2025-08-27 7:54 ` [PULL 30/31] MAINTAINERS: Adjust wildcards for the migration, multiprocess and replay tests Thomas Huth
2025-08-27 7:54 ` [PULL 31/31] tests/functional: Mark main in QemuBaseTest class as a static method Thomas Huth
2025-08-27 20:26 ` [PULL 00/31] First pull request with functional tests patches for QEMU 10.2 Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250827075443.559712-7-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).