diff options
author | Andreas Färber <afaerber@suse.de> | 2014-02-21 20:55:30 +0100 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-03-31 22:36:16 +0200 |
commit | 66e0c7b187e130f5059e45e12832951deda31668 (patch) | |
tree | 4a346f9aaabe814e512bf811a6ea85728c075a77 /tests/libqtest.c | |
parent | abc53733f34a8a29cc49c1ecb6475a11a44dcb7a (diff) |
qtest: Factor out qtest_qmp_receive()
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'tests/libqtest.c')
-rw-r--r-- | tests/libqtest.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c index d9e3a33817..8155695848 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -345,14 +345,10 @@ static void qmp_response(JSONMessageParser *parser, QList *tokens) qmp->response = (QDict *)obj; } -QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap) +QDict *qtest_qmp_receive(QTestState *s) { QMPResponseParser qmp; - /* Send QMP request */ - socket_sendf(s->qmp_fd, fmt, ap); - - /* Receive reply */ qmp.response = NULL; json_message_parser_init(&qmp.parser, qmp_response); while (!qmp.response) { @@ -376,6 +372,15 @@ QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap) return qmp.response; } +QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap) +{ + /* Send QMP request */ + socket_sendf(s->qmp_fd, fmt, ap); + + /* Receive reply */ + return qtest_qmp_receive(s); +} + QDict *qtest_qmp(QTestState *s, const char *fmt, ...) { va_list ap; |