[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 27/36] tests/qtests: add qtest_qmp_add_client()
From: |
marcandre . lureau |
Subject: |
[PULL v2 27/36] tests/qtests: add qtest_qmp_add_client() |
Date: |
Tue, 21 Dec 2021 10:58:46 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
---
tests/qtest/libqos/libqtest.h | 10 ++++++++++
tests/qtest/libqtest.c | 19 +++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
index dff6b31cf0ec..a6d38d7ef7fb 100644
--- a/tests/qtest/libqos/libqtest.h
+++ b/tests/qtest/libqos/libqtest.h
@@ -744,6 +744,16 @@ void qtest_qmp_device_add_qdict(QTestState *qts, const
char *drv,
void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
const char *fmt, ...) GCC_FMT_ATTR(4, 5);
+/**
+ * qtest_qmp_add_client:
+ * @qts: QTestState instance to operate on
+ * @protocol: the protocol to add to
+ * @fd: the client file-descriptor
+ *
+ * Call QMP ``getfd`` followed by ``add_client`` with the given @fd.
+ */
+void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd);
+
/**
* qtest_qmp_device_del:
* @qts: QTestState instance to operate on
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 65ed9496850f..a68326caae98 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.
--
2.34.1.8.g35151cf07204
- [PULL v2 17/36] ui: move qemu_spice_fill_device_address to ui/util.c, (continued)
- [PULL v2 17/36] ui: move qemu_spice_fill_device_address to ui/util.c, marcandre . lureau, 2021/12/21
- [PULL v2 18/36] console: save current scanout details, marcandre . lureau, 2021/12/21
- [PULL v2 19/36] scripts: teach modinfo to skip non-C sources, marcandre . lureau, 2021/12/21
- [PULL v2 20/36] docs/sphinx: add sphinx modules to include D-Bus documentation, marcandre . lureau, 2021/12/21
- [PULL v2 21/36] backends: move dbus-vmstate1.xml to backends/, marcandre . lureau, 2021/12/21
- [PULL v2 22/36] docs: move D-Bus VMState documentation to source XML, marcandre . lureau, 2021/12/21
- [PULL v2 23/36] docs: add dbus-display documentation, marcandre . lureau, 2021/12/21
- [PULL v2 24/36] build-sys: set glib dependency version, marcandre . lureau, 2021/12/21
- [PULL v2 25/36] ui: add a D-Bus display backend, marcandre . lureau, 2021/12/21
- [PULL v2 26/36] ui/dbus: add p2p=on/off option, marcandre . lureau, 2021/12/21
- [PULL v2 27/36] tests/qtests: add qtest_qmp_add_client(),
marcandre . lureau <=
- [PULL v2 28/36] tests: start dbus-display-test, marcandre . lureau, 2021/12/21
- [PULL v2 29/36] audio: add "dbus" audio backend, marcandre . lureau, 2021/12/21
- [PULL v2 30/36] ui/dbus: add clipboard interface, marcandre . lureau, 2021/12/21
- [PULL v2 31/36] chardev: teach socket to accept no addresses, marcandre . lureau, 2021/12/21
- [PULL v2 32/36] chardev: make socket derivable, marcandre . lureau, 2021/12/21
- [PULL v2 33/36] option: add g_auto for QemuOpts, marcandre . lureau, 2021/12/21
- [PULL v2 34/36] ui/dbus: add chardev backend & interface, marcandre . lureau, 2021/12/21
- [PULL v2 35/36] ui/dbus: register D-Bus VC handler, marcandre . lureau, 2021/12/21
- [PULL v2 36/36] MAINTAINERS: update D-Bus section, marcandre . lureau, 2021/12/21
- Re: [PULL v2 00/36] ui: D-Bus display backend, Richard Henderson, 2021/12/21