summaryrefslogtreecommitdiff
path: root/tests/libqtest.h
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2015-04-28 15:27:51 -0400
committerJohn Snow <jsnow@redhat.com>2015-04-28 15:27:51 -0400
commit8fe941f749b2db3735abade1c298552de4eab496 (patch)
treeb8542e58009e31de3534f84f347d56c21be5a469 /tests/libqtest.h
parentdebaaa114a8877a939533ba846e64168fb287b7b (diff)
downloadqemu-8fe941f749b2db3735abade1c298552de4eab496.tar.gz
libqtest: add qmp_eventwait
Allow the user to poll until a desired interrupt occurs. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1426018503-821-4-git-send-email-jsnow@redhat.com
Diffstat (limited to 'tests/libqtest.h')
-rw-r--r--tests/libqtest.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 03469b8781..30009ca5c9 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -92,6 +92,15 @@ QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap);
QDict *qtest_qmp_receive(QTestState *s);
/**
+ * qtest_qmp_eventwait:
+ * @s: #QTestState instance to operate on.
+ * @s: #event event to wait for.
+ *
+ * Continuosly polls for QMP responses until it receives the desired event.
+ */
+void qtest_qmp_eventwait(QTestState *s, const char *event);
+
+/**
* qtest_get_irq:
* @s: #QTestState instance to operate on.
* @num: Interrupt to observe.
@@ -429,6 +438,17 @@ static inline QDict *qmp_receive(void)
}
/**
+ * qmp_eventwait:
+ * @s: #event event to wait for.
+ *
+ * Continuosly polls for QMP responses until it receives the desired event.
+ */
+static inline void qmp_eventwait(const char *event)
+{
+ return qtest_qmp_eventwait(global_qtest, event);
+}
+
+/**
* get_irq:
* @num: Interrupt to observe.
*