[Qemu-devel] [PATCH 4/6] tests/libqtest: Clean up qtest_cb_for_every_machine() wrt global_qtest

Thomas Huth posted 6 patches 6 years, 5 months ago
Maintainers: Greg Kurz <groug@kaod.org>, Laurent Vivier <lvivier@redhat.com>, Fam Zheng <fam@euphon.net>, Gerd Hoffmann <kraxel@redhat.com>, Amit Shah <amit@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <thuth@redhat.com>, Jason Wang <jasowang@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
[Qemu-devel] [PATCH 4/6] tests/libqtest: Clean up qtest_cb_for_every_machine() wrt global_qtest
Posted by Thomas Huth 6 years, 5 months ago
The generic libqtest library functions should not use functions that
require the global_qtest variable.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/libqtest.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/libqtest.c b/tests/libqtest.c
index 3e9245d4c9..d1aead30ed 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -1189,9 +1189,10 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine),
     QObject *qobj;
     QString *qstr;
     const char *mname;
+    QTestState *qts;
 
-    qtest_start("-machine none");
-    response = qmp("{ 'execute': 'query-machines' }");
+    qts = qtest_init("-machine none");
+    response = qtest_qmp(qts, "{ 'execute': 'query-machines' }");
     g_assert(response);
     list = qdict_get_qlist(response, "return");
     g_assert(list);
@@ -1209,7 +1210,7 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine),
         }
     }
 
-    qtest_end();
+    qtest_quit(qts);
     qobject_unref(response);
 }
 
-- 
2.18.1


Re: [Qemu-devel] [PATCH 4/6] tests/libqtest: Clean up qtest_cb_for_every_machine() wrt global_qtest
Posted by Eric Blake 6 years, 5 months ago
On 8/13/19 4:30 AM, Thomas Huth wrote:
> The generic libqtest library functions should not use functions that
> require the global_qtest variable.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/libqtest.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org