aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.h
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-02-16 22:44:02 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-18 08:39:09 -0600
commitb73cf9e93f1c7fd6e949f71172c49848b4d70aa9 (patch)
tree388aade6f78e3cefa2d88088779cd86873cdfcfd /tests/libqtest.h
parent6acf801de5a6e299c02ab3efe3e0dcd75ae678e0 (diff)
downloadqemu-b73cf9e93f1c7fd6e949f71172c49848b4d70aa9.zip
qemu-b73cf9e93f1c7fd6e949f71172c49848b4d70aa9.tar.gz
qemu-b73cf9e93f1c7fd6e949f71172c49848b4d70aa9.tar.bz2
libqtest: Introduce qtest_qmpv() and convert remaining macro
In order to convert qmp() macro to an inline function, expose a qtest_qmpv() function, reused by qtest_qmp(). We can't apply GCC_FMT_ATTR() since fdc-test is using zero-length format strings, which would result in warnings treated as errors. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1361051043-27944-3-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'tests/libqtest.h')
-rw-r--r--tests/libqtest.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/libqtest.h b/tests/libqtest.h
index a111c9c..f5c6e21 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -17,6 +17,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <stdarg.h>
#include <sys/types.h>
typedef struct QTestState QTestState;
@@ -49,6 +50,16 @@ void qtest_quit(QTestState *s);
void qtest_qmp(QTestState *s, const char *fmt, ...);
/**
+ * qtest_qmpv:
+ * @s: #QTestState instance to operate on.
+ * @fmt: QMP message to send to QEMU
+ * @ap: QMP message arguments
+ *
+ * Sends a QMP message to QEMU.
+ */
+void qtest_qmpv(QTestState *s, const char *fmt, va_list ap);
+
+/**
* qtest_get_irq:
* @s: #QTestState instance to operate on.
* @num: Interrupt to observe.
@@ -227,7 +238,14 @@ static inline QTestState *qtest_start(const char *args)
*
* Sends a QMP message to QEMU
*/
-#define qmp(fmt, ...) qtest_qmp(global_qtest, fmt, ## __VA_ARGS__)
+static inline void qmp(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ qtest_qmpv(global_qtest, fmt, ap);
+ va_end(ap);
+}
/**
* get_irq: