mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-08 16:07:39 -06:00
tests: New helper qtest_qmp_receive_success()
Commit b21373d071
copied wait_command() from tests/migration-test.c
to tests/tpm-util.c. Replace both copies by new libqtest helper
qtest_qmp_receive_success(). Also use it to simplify
qtest_qmp_device_del().
Bonus: gets rid of a non-literal format string. A step towards
compile-time format string checking without triggering
-Wformat-nonliteral.
Cc: Thomas Huth <thuth@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180806065344.7103-17-armbru@redhat.com>
This commit is contained in:
parent
e145416524
commit
3cd46d42fe
4 changed files with 80 additions and 67 deletions
|
@ -146,6 +146,23 @@ void qtest_qmp_eventwait(QTestState *s, const char *event);
|
|||
*/
|
||||
QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);
|
||||
|
||||
/**
|
||||
* qtest_qmp_receive_success:
|
||||
* @s: #QTestState instance to operate on
|
||||
* @event_cb: Event callback
|
||||
* @opaque: Argument for @event_cb
|
||||
*
|
||||
* Poll QMP messages until a command success response is received.
|
||||
* If @event_cb, call it for each event received, passing @opaque,
|
||||
* the event's name and data.
|
||||
* Return the success response's "return" member.
|
||||
*/
|
||||
QDict *qtest_qmp_receive_success(QTestState *s,
|
||||
void (*event_cb)(void *opaque,
|
||||
const char *name,
|
||||
QDict *data),
|
||||
void *opaque);
|
||||
|
||||
/**
|
||||
* qtest_hmp:
|
||||
* @s: #QTestState instance to operate on.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue