From: Fabiano Rosas <farosas@suse.de>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Martin Pitt" <mpitt@redhat.com>,
"Richard W . M . Jones" <rjones@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH v2 3/3 for 9.2] tests/qtest: add test for querying balloon guest stats
Date: Fri, 29 Nov 2024 11:04:43 -0300 [thread overview]
Message-ID: <87jzcmjfus.fsf@suse.de> (raw)
In-Reply-To: <20241129135507.699030-4-berrange@redhat.com>
Daniel P. Berrangé <berrange@redhat.com> writes:
> This test would have identified the crash caused by the addition of new
> balloon stats fields.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> tests/qtest/virtio-balloon-test.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/tests/qtest/virtio-balloon-test.c b/tests/qtest/virtio-balloon-test.c
> index 6bea33b590..ecdd363b06 100644
> --- a/tests/qtest/virtio-balloon-test.c
> +++ b/tests/qtest/virtio-balloon-test.c
> @@ -8,6 +8,7 @@
>
> #include "qemu/osdep.h"
> #include "libqtest.h"
> +#include "standard-headers/linux/virtio_balloon.h"
>
> /*
> * https://gitlab.com/qemu-project/qemu/-/issues/2576
> @@ -26,11 +27,30 @@ static void oss_fuzz_71649(void)
> qtest_quit(s);
> }
>
> +static void query_stats(void)
> +{
> + QTestState *s = qtest_init("-device virtio-balloon,id=balloon"
> + " -nodefaults");
> + QDict *ret = qtest_qmp_assert_success_ref(
> + s,
> + "{ 'execute': 'qom-get', 'arguments': " \
> + "{ 'path': '/machine/peripheral/balloon', " \
> + " 'property': 'guest-stats' } }");
> + QDict *stats = qdict_get_qdict(ret, "stats");
> +
> + /* We expect 1 entry in the dict for each known kernel stat */
> + assert(qdict_size(stats) == VIRTIO_BALLOON_S_NR);
> +
> + qobject_unref(ret);
> + qtest_quit(s);
> +}
> +
> int main(int argc, char **argv)
> {
> g_test_init(&argc, &argv, NULL);
>
> qtest_add_func("virtio-balloon/oss_fuzz_71649", oss_fuzz_71649);
> + qtest_add_func("virtio-balloon/query-stats", query_stats);
>
> return g_test_run();
> }
Reviewed-by: Fabiano Rosas <farosas@suse.de>
next prev parent reply other threads:[~2024-11-29 14:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 13:55 [PATCH v2 0/3 for 9.2] hw/virtio: fix crash in virtio-balloon and test it Daniel P. Berrangé
2024-11-29 13:55 ` [PATCH v2 1/3 for 9.2] hw/virtio: fix crash in processing balloon stats Daniel P. Berrangé
2024-11-29 13:56 ` David Hildenbrand
2024-12-02 18:02 ` Michael Tokarev
2024-11-29 13:55 ` [PATCH v2 2/3 for 9.2] tests/qtest: drop 'fuzz-' prefix from virtio-balloon test Daniel P. Berrangé
2024-11-29 14:01 ` Fabiano Rosas
2024-11-29 15:44 ` Philippe Mathieu-Daudé
2024-11-29 13:55 ` [PATCH v2 3/3 for 9.2] tests/qtest: add test for querying balloon guest stats Daniel P. Berrangé
2024-11-29 14:04 ` Fabiano Rosas [this message]
2024-12-02 17:05 ` [PATCH v2 0/3 for 9.2] hw/virtio: fix crash in virtio-balloon and test it David Hildenbrand
2024-12-02 19:50 ` Philippe Mathieu-Daudé
2024-12-03 8:08 ` Michael S. Tsirkin
2024-12-03 15:42 ` Philippe Mathieu-Daudé
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=87jzcmjfus.fsf@suse.de \
--to=farosas@suse.de \
--cc=berrange@redhat.com \
--cc=david@redhat.com \
--cc=lvivier@redhat.com \
--cc=mpitt@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@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).