aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.c
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.c
parentdebaaa114a8877a939533ba846e64168fb287b7b (diff)
downloadqemu-8fe941f749b2db3735abade1c298552de4eab496.zip
qemu-8fe941f749b2db3735abade1c298552de4eab496.tar.gz
qemu-8fe941f749b2db3735abade1c298552de4eab496.tar.bz2
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.c')
-rw-r--r--tests/libqtest.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 12d65bd..e2d01b4 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -450,6 +450,22 @@ void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...)
QDECREF(response);
}
+void qtest_qmp_eventwait(QTestState *s, const char *event)
+{
+ QDict *response;
+
+ for (;;) {
+ response = qtest_qmp_receive(s);
+ if ((qdict_haskey(response, "event")) &&
+ (strcmp(qdict_get_str(response, "event"), event) == 0)) {
+ QDECREF(response);
+ break;
+ }
+ QDECREF(response);
+ }
+}
+
+
const char *qtest_get_arch(void)
{
const char *qemu = getenv("QTEST_QEMU_BINARY");