OSDN Git Service

tests/libqtest: Clean up qtest_cb_for_every_machine() wrt global_qtest
authorThomas Huth <thuth@redhat.com>
Mon, 22 Jul 2019 14:34:42 +0000 (16:34 +0200)
committerThomas Huth <thuth@redhat.com>
Thu, 15 Aug 2019 17:24:10 +0000 (19:24 +0200)
The generic libqtest library functions should not use functions that
require the global_qtest variable.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190813093047.27948-5-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/libqtest.c

index 3e9245d..d1aead3 100644 (file)
@@ -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);
 }