summaryrefslogtreecommitdiff
path: root/tests/libqtest.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-08-06 08:53:25 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-08-16 08:42:06 +0200
commit055a1efc7c5a30ca0993720da57ba70179d28c7b (patch)
treea64a16a0cf3cc6e3f1f8dff8289b20d6b10549d6 /tests/libqtest.c
parentbe62e1724f383c9e5012732af6c4dce587a917ee (diff)
downloadqemu-055a1efc7c5a30ca0993720da57ba70179d28c7b.zip
libqtest: Remove qtest_qmp_discard_response() & friends
qtest_qmp_discard_response(...) is shorthand for qobject_unref(qtest_qmp(...), except it's not actually shorter. Moreover, the presence of these functions encourage sloppy testing. Remove them from libqtest. Add them as macros to the tests that use them, with a TODO comment asking for cleanup. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-5-armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/libqtest.c')
-rw-r--r--tests/libqtest.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c
index c2c08a890c..2fe0f4dc29 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -254,7 +254,7 @@ QTestState *qtest_init(const char *extra_args)
/* Read the QMP greeting and then do the handshake */
greeting = qtest_qmp_receive(s);
qobject_unref(greeting);
- qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }");
+ qobject_unref(qtest_qmp(s, "{ 'execute': 'qmp_capabilities' }"));
return s;
}
@@ -591,23 +591,6 @@ void qtest_qmp_send(QTestState *s, const char *fmt, ...)
va_end(ap);
}
-void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap)
-{
- QDict *response = qtest_qmpv(s, fmt, ap);
- qobject_unref(response);
-}
-
-void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...)
-{
- va_list ap;
- QDict *response;
-
- va_start(ap, fmt);
- response = qtest_qmpv(s, fmt, ap);
- va_end(ap);
- qobject_unref(response);
-}
-
QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event)
{
QDict *response;
@@ -979,14 +962,6 @@ void qmp_send(const char *fmt, ...)
va_end(ap);
}
-void qmp_discard_response(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- qtest_qmpv_discard_response(global_qtest, fmt, ap);
- va_end(ap);
-}
char *hmp(const char *fmt, ...)
{
va_list ap;