On Thu, Jun 01, 2023 at 02:20:34PM +0200, Juan Quintela wrote:
> Daniel P. Berrangé <[email protected]> wrote:
> > Add several counterparts of qtest_qmp_assert_success() that can
> >
> > * Use va_list instead of ...
> > * Accept a list of FDs to send
> > * Return the response data
> >
> > Signed-off-by: Daniel P. Berrangé <[email protected]>
> > ---
> > tests/qtest/libqtest.c | 99 +++++++++++++++++++++++++++++++++--
> > tests/qtest/libqtest.h | 115 +++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 209 insertions(+), 5 deletions(-)
> >
> > diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> > index c3a0ef5bb4..603c26d955 100644
> > --- a/tests/qtest/libqtest.c
> > +++ b/tests/qtest/libqtest.c
> > +#ifndef _WIN32
> > +QDict *qtest_vqmp_fds_assert_success_ref(QTestState *qts, int *fds, size_t
> > nfds,
> > + const char *fmt, va_list args)
> > +{
> > + QDict *response;
> > + QDict *ret;
> > +
> > + response = qtest_vqmp_fds(qts, fds, nfds, fmt, args);
> > +
> > + g_assert(response);
> > + if (!qdict_haskey(response, "return")) {
> > + GString *s = qobject_to_json_pretty(QOBJECT(response), true);
> > + g_test_message("%s", s->str);
> > + g_string_free(s, true);
>
> I know we are not consistent ot this file, but what about using autoptr here?
>
> g_autoptr(GString) *s = qobject_to_json_pretty(QOBJECT(response),
> true);
> g_test_message("%s", s->str);
>
> ??
Sure.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|