From: Fabiano Rosas <farosas@suse.de>
To: Takeru Hayasaka <hayatake396@gmail.com>, qemu-devel@nongnu.org
Cc: hayatake396@gmail.com, lvivier@redhat.com, pbonzini@redhat.com,
peterx@redhat.com
Subject: Re: [PATCH v2] tests/qtest/migration: Add mapped-ram/postcopy validation test
Date: Mon, 30 Mar 2026 11:20:02 -0300 [thread overview]
Message-ID: <87se9hh019.fsf@suse.de> (raw)
In-Reply-To: <20260327164705.1990226-1-hayatake396@gmail.com>
Takeru Hayasaka <hayatake396@gmail.com> writes:
> 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
>
> v2:
> - Rename do_test_validate_capability_pair to validate_caps_pair
> - Move migrate_start/migrate_end to caller for VM reuse
> - Set only_source to skip target VM
> - Generalize test using migration_test_add_suffix pattern
Hi, thank you for the patch. It looks good aside from a small functional
issue I'll mention below.
Let me just point out that is customary to not send patches in reply to
the previous thread. So this v2 should have been its own thread
completely independent of the first version. This helps the community
keep track of the various series on the list without patches getting
lost deep inside mail threads.
> ---
> tests/qtest/migration/misc-tests.c | 50 ++++++++++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
>
> diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c
> index 196f1ca84287..4131e7b0614d 100644
> --- a/tests/qtest/migration/misc-tests.c
> +++ b/tests/qtest/migration/misc-tests.c
> @@ -215,6 +215,53 @@ static void do_test_validate_uri_channel(MigrateCommon *args)
> migrate_end(from, to, false);
> }
>
> +static void validate_caps_pair(QTestState *from,
> + const char *first_capability,
> + const char *second_capability,
> + const char *expected_error)
> +{
> + QDict *rsp;
> + const char *error_desc;
> +
> + 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_set_capability(from, first_capability, false);
> +}
> +
> +static void test_validate_caps_pair(char *test_path, MigrateCommon *args)
> +{
> + g_autofree char *cap_pair = g_path_get_basename(test_path);
> + QTestState *from, *to;
> +
> + args->start.hide_stderr = true;
> + args->start.only_source = true;
> +
> + if (migrate_start(&from, &to, "defer", &args->start)) {
> + return;
> + }
> +
> + if (g_str_equal(cap_pair, "mapped_ram_postcopy")) {
> + const char *error =
> + "Mapped-ram migration is incompatible with postcopy";
> +
> + validate_caps_pair(from, "mapped-ram", "postcopy-ram", error);
> + validate_caps_pair(from, "postcopy-ram", "mapped-ram", error);
> + }
> +
> + qtest_quit(from);
This will leave the "src_serial" file behind in the test directory and
will cause cleanup of the tests to fail. However, I see that using
migrate_end() here would cause an access to the not-initialized "to"
pointer. I actually misremembered the code we have in master when I
suggested to use only_source for this, I have a patch making
migrate_end() accept NULL that has not been merged yet.
As a temporary solution, we could just unlink() the src_serial file here
directly. I'll do that myself when applying the patch, you don't need to
send a new version.
> +}
> +
> static void test_validate_uri_channels_both_set(char *name, MigrateCommon *args)
> {
> args->listen_uri = "defer",
> @@ -276,4 +323,7 @@ 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_suffix("/migration/validate_caps/",
> + "mapped_ram_postcopy",
> + test_validate_caps_pair);
> }
next prev parent reply other threads:[~2026-03-30 14:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-03-30 16:19 ` Takeru Hayasaka
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=87se9hh019.fsf@suse.de \
--to=farosas@suse.de \
--cc=hayatake396@gmail.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 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.