@@ -146,7 +146,7 @@ void qtest_add_abrt_handler(GHookFunc fn, const void *data)
g_hook_prepend(&abrt_hooks, hook);
}
-QTestState *qtest_init(const char *extra_args)
+QTestState *qtest_init_qmp_caps(const char *extra_args, const char *qmp_caps)
{
QTestState *s;
int sock, qmpsock, i;
@@ -203,7 +203,11 @@ QTestState *qtest_init(const char *extra_args)
/* Read the QMP greeting and then do the handshake */
qtest_qmp_discard_response(s, "");
- qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }");
+ command = g_strdup_printf(
+ "{ 'execute': 'qmp_capabilities',"
+ " 'arguments': {'capabilities': [%s]}}", qmp_caps);
+ qtest_qmp_discard_response(s, command);
+ g_free(command);
if (getenv("QTEST_STOP")) {
kill(s->qemu_pid, SIGSTOP);
@@ -212,6 +216,11 @@ QTestState *qtest_init(const char *extra_args)
return s;
}
+QTestState *qtest_init(const char *extra_args)
+{
+ return qtest_init_qmp_caps(extra_args, "");
+}
+
void qtest_quit(QTestState *s)
{
qtest_instances = g_list_remove(qtest_instances, s);
@@ -31,6 +31,15 @@ extern QTestState *global_qtest;
*/
QTestState *qtest_init(const char *extra_args);
+/**
+ * qtest_init_qmp_caps:
+ * @extra_args: other arguments to pass to QEMU.
+ * @qmp_caps: qmp capabilities
+ *
+ * Returns: #QTestState instance.
+ */
+QTestState *qtest_init_qmp_caps(const char *extra_args, const char *qmp_caps);
+
/**
* qtest_quit:
* @s: #QTestState instance to operate on.
Add a function to specify the qmp capabilities content. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- tests/libqtest.c | 13 +++++++++++-- tests/libqtest.h | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-)