aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-03 13:32:23 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-05 09:02:10 +0100
commitf66e7ac88c18be9f52add5e1a94de1fc6db3eefb (patch)
tree1e84c8e2fd3cbee70f84c69757e53646062ebd42 /tests/libqtest.c
parent13420ef837a217afd9f1bd4728667e1ea50d5916 (diff)
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>
Diffstat (limited to 'tests/libqtest.c')
-rw-r--r--tests/libqtest.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 951a3b4bf6..ca6b641963 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -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);