From 8fe941f749b2db3735abade1c298552de4eab496 Mon Sep 17 00:00:00 2001 From: John Snow Date: Tue, 28 Apr 2015 15:27:51 -0400 Subject: libqtest: add qmp_eventwait Allow the user to poll until a desired interrupt occurs. Signed-off-by: John Snow Message-id: 1426018503-821-4-git-send-email-jsnow@redhat.com --- tests/libqtest.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/libqtest.h') diff --git a/tests/libqtest.h b/tests/libqtest.h index 03469b8781..30009ca5c9 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -91,6 +91,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. @@ -428,6 +437,17 @@ static inline QDict *qmp_receive(void) return qtest_qmp_receive(global_qtest); } +/** + * 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. -- cgit v1.2.3