aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2025-01-15 11:00:48 -0800
committerFabiano Rosas <farosas@suse.de>2025-01-29 11:56:39 -0300
commite6c18b996e6c3a41c9a028f325d293d6740e52b2 (patch)
tree50a7e7b8c0274fac6f573b6eda35f2b3c42c83f9
parent43ca9d1866b89803490fb69caf5e1d728a112612 (diff)
downloadqemu-e6c18b996e6c3a41c9a028f325d293d6740e52b2.zip
qemu-e6c18b996e6c3a41c9a028f325d293d6740e52b2.tar.gz
qemu-e6c18b996e6c3a41c9a028f325d293d6740e52b2.tar.bz2
tests/qtest: assert qmp connected
Assert that qmp_fd is valid when we communicate with the monitor. Suggested-by: Peter Xu <peterx@redhat.com> Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1736967650-129648-23-git-send-email-steven.sistare@oracle.com Signed-off-by: Fabiano Rosas <farosas@suse.de>
-rw-r--r--tests/qtest/libqtest.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index fbb51e3..437b24f 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -811,6 +811,7 @@ QDict *qtest_qmp_receive(QTestState *s)
QDict *qtest_qmp_receive_dict(QTestState *s)
{
+ g_assert(s->qmp_fd >= 0);
return qmp_fd_receive(s->qmp_fd);
}
@@ -838,12 +839,14 @@ int qtest_socket_server(const char *socket_path)
void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, va_list ap)
{
+ g_assert(s->qmp_fd >= 0);
qmp_fd_vsend_fds(s->qmp_fd, fds, fds_num, fmt, ap);
}
#endif
void qtest_qmp_vsend(QTestState *s, const char *fmt, va_list ap)
{
+ g_assert(s->qmp_fd >= 0);
qmp_fd_vsend(s->qmp_fd, fmt, ap);
}
@@ -904,6 +907,7 @@ void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
{
va_list ap;
+ g_assert(s->qmp_fd >= 0);
va_start(ap, fmt);
qmp_fd_vsend_raw(s->qmp_fd, fmt, ap);
va_end(ap);