[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] tests/qtest/migration: Ignore if socket-address is missi
From: |
Peter Xu |
Subject: |
Re: [PATCH 1/2] tests/qtest/migration: Ignore if socket-address is missing to avoid crash below |
Date: |
Tue, 19 Mar 2024 17:57:30 -0400 |
On Tue, Mar 19, 2024 at 08:48:39PM +0000, Het Gala wrote:
> 'object' can return NULL if there is no socket-address, such as with a
> file migration. Then the visitor code below fails and the test crashes.
>
> Ignore and return NULL when socket-address is missing in the reply so
> we don't break future tests that use a non-socket type.
Hmm, this patch isn't as clear to me. Even if this can return NULL now,
it'll soon crash at some later point, no?
IMHO such patch is more suitable to be included in the same patch where
such new tests will be introduced, then we're addressing some real test
code changes that will work, rather than worrying on what will happen in
the future (and as I mentioned, i don't think it fully resolved that either..)
Thanks,
>
> Suggested-by: Fabiano Rosas <farosas@suse.de>
> Signed-off-by: Het Gala <het.gala@nutanix.com>
> ---
> tests/qtest/migration-helpers.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
> index b2a90469fb..fb7156f09a 100644
> --- a/tests/qtest/migration-helpers.c
> +++ b/tests/qtest/migration-helpers.c
> @@ -90,6 +90,10 @@ static SocketAddress
> *migrate_get_socket_address(QTestState *who)
> QObject *object;
>
> rsp = migrate_query(who);
> +
> + if (!qdict_haskey(rsp, "socket-address")) {
> + return NULL;
> + }
> object = qdict_get(rsp, "socket-address");
>
> iv = qobject_input_visitor_new(object);
> --
> 2.22.3
>
--
Peter Xu