aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/libqmp.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-03-30 13:34:11 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-05-03 15:17:08 +0400
commitc6d3bcb4b91e9ebf08f3afb8759760a9dbb2b744 (patch)
treedad8990c20672c901ac97f96035b66ba87484a1f /tests/qtest/libqmp.h
parent907b5105f1b9e1af1abbdbb4f2039c7ab105c001 (diff)
downloadqemu-c6d3bcb4b91e9ebf08f3afb8759760a9dbb2b744.zip
qemu-c6d3bcb4b91e9ebf08f3afb8759760a9dbb2b744.tar.gz
qemu-c6d3bcb4b91e9ebf08f3afb8759760a9dbb2b744.tar.bz2
libqtest: split QMP part in libqmp
This will help moving QAPI/QMP in a common subproject. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/libqmp.h')
-rw-r--r--tests/qtest/libqmp.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/qtest/libqmp.h b/tests/qtest/libqmp.h
new file mode 100644
index 0000000..94aa973
--- /dev/null
+++ b/tests/qtest/libqmp.h
@@ -0,0 +1,50 @@
+/*
+ * libqmp test unit
+ *
+ * Copyright IBM, Corp. 2012
+ * Copyright Red Hat, Inc. 2012
+ * Copyright SUSE LINUX Products GmbH 2013
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ * Paolo Bonzini <pbonzini@redhat.com>
+ * Andreas Färber <afaerber@suse.de>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+#ifndef LIBQMP_H_
+#define LIBQMP_H_
+
+#include "qapi/qmp/qdict.h"
+
+QDict *qmp_fd_receive(int fd);
+void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num,
+ const char *fmt, va_list ap) G_GNUC_PRINTF(4, 0);
+void qmp_fd_vsend(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+void qmp_fd_send(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+void qmp_fd_send_raw(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+QDict *qmp_fdv(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+QDict *qmp_fd(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+
+/**
+ * qmp_rsp_is_err:
+ * @rsp: QMP response to check for error
+ *
+ * Test @rsp for error and discard @rsp.
+ * Returns 'true' if there is error in @rsp and 'false' otherwise.
+ */
+bool qmp_rsp_is_err(QDict *rsp);
+
+/**
+ * qmp_expect_error_and_unref:
+ * @rsp: QMP response to check for error
+ * @class: an error class
+ *
+ * Assert the response has the given error class and discard @rsp.
+ */
+void qmp_expect_error_and_unref(QDict *rsp, const char *class);
+
+#endif /* LIBQMP_H_ */