All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/qtest/migration: Add mapped-ram/postcopy validation test
@ 2026-03-27  3:04 Takeru Hayasaka
  2026-03-27 14:44 ` Fabiano Rosas
  0 siblings, 1 reply; 6+ messages in thread
From: Takeru Hayasaka @ 2026-03-27  3:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: Takeru Hayasaka, Peter Xu, Fabiano Rosas, Laurent Vivier,
	Paolo Bonzini

The migration capability checks reject enabling postcopy-ram together
with mapped-ram, but there is no qtest covering this incompatibility.

Add a validation test that verifies QMP rejects the combination in
both capability ordering cases and returns the expected error.

This keeps the existing capability boundary covered without changing
migration behavior.

Signed-off-by: Takeru Hayasaka <hayatake396@gmail.com>
---
Built with:
  ./configure --target-list=x86_64-softmmu --disable-werror
  ninja -C build tests/qtest/migration-test qemu-system-x86_64

Tested with:
  QTEST_QEMU_BINARY=./build/qemu-system-x86_64 \
  ./build/tests/qtest/migration-test --full \
  -p /x86_64/migration/validate_caps/mapped_ram_postcopy
---
 tests/qtest/migration/misc-tests.c | 45 ++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c
index 196f1ca84287..ae247250713b 100644
--- a/tests/qtest/migration/misc-tests.c
+++ b/tests/qtest/migration/misc-tests.c
@@ -215,6 +215,49 @@ static void do_test_validate_uri_channel(MigrateCommon *args)
     migrate_end(from, to, false);
 }
 
+static void do_test_validate_capability_pair(MigrateCommon *args,
+                                             const char *first_capability,
+                                             const char *second_capability,
+                                             const char *expected_error)
+{
+    QTestState *from, *to;
+    QDict *rsp;
+    const char *error_desc;
+
+    args->start.hide_stderr = true;
+
+    if (migrate_start(&from, &to, "defer", &args->start)) {
+        return;
+    }
+
+    migrate_set_capability(from, first_capability, true);
+
+    rsp = qtest_qmp_assert_failure_ref(
+        from,
+        "{ 'execute': 'migrate-set-capabilities',"
+        "  'arguments': { 'capabilities': [ { "
+        "      'capability': %s, 'state': true } ] } }",
+        second_capability);
+
+    error_desc = qdict_get_str(rsp, "desc");
+    g_assert_cmpstr(error_desc, ==, expected_error);
+    qobject_unref(rsp);
+
+    migrate_end(from, to, false);
+}
+
+static void test_validate_caps_mapped_ram_postcopy(char *name,
+                                                   MigrateCommon *args)
+{
+    const char *error =
+        "Mapped-ram migration is incompatible with postcopy";
+
+    do_test_validate_capability_pair(args, "mapped-ram", "postcopy-ram",
+                                     error);
+    do_test_validate_capability_pair(args, "postcopy-ram", "mapped-ram",
+                                     error);
+}
+
 static void test_validate_uri_channels_both_set(char *name, MigrateCommon *args)
 {
     args->listen_uri = "defer",
@@ -276,4 +319,6 @@ void migration_test_add_misc(MigrationTestEnv *env)
                        test_validate_uri_channels_both_set);
     migration_test_add("/migration/validate_uri/channels/none_set",
                        test_validate_uri_channels_none_set);
+    migration_test_add("/migration/validate_caps/mapped_ram_postcopy",
+                       test_validate_caps_mapped_ram_postcopy);
 }
-- 
2.43.0



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

end of thread, other threads:[~2026-03-30 16:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27  3:04 [PATCH] tests/qtest/migration: Add mapped-ram/postcopy validation test Takeru Hayasaka
2026-03-27 14:44 ` Fabiano Rosas
2026-03-27 15:53   ` Takeru Hayasaka
2026-03-27 16:46     ` [PATCH v2] " Takeru Hayasaka
2026-03-30 14:20       ` Fabiano Rosas
2026-03-30 16:19         ` Takeru Hayasaka

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.