From ae74f18782d83c249e8bb9566bf5a2ad501ab82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Mar=C3=AD?= Date: Tue, 12 Aug 2014 13:41:48 +0200 Subject: libqtest: add QTEST_LOG for debugging qtest testcases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paolo Bonzini Signed-off-by: Marc MarĂ­ Signed-off-by: Stefan Hajnoczi --- tests/libqtest.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/libqtest.c b/tests/libqtest.c index 0bf17aa..ed55686 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -402,10 +402,14 @@ QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap) /* No need to send anything for an empty QObject. */ if (qobj) { + int log = getenv("QTEST_LOG") != NULL; QString *qstr = qobject_to_json(qobj); const char *str = qstring_get_str(qstr); size_t size = qstring_get_length(qstr); + if (log) { + fprintf(stderr, "%s", str); + } /* Send QMP request */ socket_send(s->qmp_fd, str, size); -- cgit v1.1