aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/libqtest.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-10-07 01:07:30 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-12-21 10:50:22 +0400
commit2c7294d72c4086fc89935514430bd2bfb5ae5011 (patch)
tree77111a2f271257f5f582ab623d009d984f4d2a05 /tests/qtest/libqtest.c
parent99997823bbbd23aa0cce42e03b49fd8a57222e5e (diff)
tests/qtests: add qtest_qmp_add_client()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'tests/qtest/libqtest.c')
-rw-r--r--tests/qtest/libqtest.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 65ed949685..a68326caae 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -1453,6 +1453,25 @@ void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
qobject_unref(args);
}
+void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd)
+{
+ QDict *resp;
+
+ resp = qtest_qmp_fds(qts, &fd, 1, "{'execute': 'getfd',"
+ "'arguments': {'fdname': 'fdname'}}");
+ g_assert(resp);
+ g_assert(!qdict_haskey(resp, "event")); /* We don't expect any events */
+ g_assert(!qdict_haskey(resp, "error"));
+ qobject_unref(resp);
+
+ resp = qtest_qmp(
+ qts, "{'execute': 'add_client',"
+ "'arguments': {'protocol': %s, 'fdname': 'fdname'}}", protocol);
+ g_assert(resp);
+ g_assert(!qdict_haskey(resp, "event")); /* We don't expect any events */
+ g_assert(!qdict_haskey(resp, "error"));
+ qobject_unref(resp);
+}
/*
* Generic hot-unplugging test via the device_del QMP command.