qmp-test: New, covering basic QMP protocol

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1488544368-30622-4-git-send-email-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2017-03-03 13:32:23 +01:00
parent 13420ef837
commit f66e7ac88c
5 changed files with 164 additions and 6 deletions

View file

@ -149,7 +149,7 @@ void qtest_add_abrt_handler(GHookFunc fn, const void *data)
g_hook_prepend(&abrt_hooks, hook);
}
QTestState *qtest_init(const char *extra_args)
QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
{
QTestState *s;
int sock, qmpsock, i;
@ -204,10 +204,6 @@ QTestState *qtest_init(const char *extra_args)
s->irq_level[i] = false;
}
/* Read the QMP greeting and then do the handshake */
qtest_qmp_discard_response(s, "");
qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }");
if (getenv("QTEST_STOP")) {
kill(s->qemu_pid, SIGSTOP);
}
@ -219,6 +215,17 @@ QTestState *qtest_init(const char *extra_args)
return s;
}
QTestState *qtest_init(const char *extra_args)
{
QTestState *s = qtest_init_without_qmp_handshake(extra_args);
/* Read the QMP greeting and then do the handshake */
qtest_qmp_discard_response(s, "");
qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }");
return s;
}
void qtest_quit(QTestState *s)
{
qtest_instances = g_list_remove(qtest_instances, s);