mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
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
This commit is contained in:
parent
debaaa114a
commit
8fe941f749
3 changed files with 37 additions and 10 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue