aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.c
diff options
context:
space:
mode:
authorMarc MarĂ­ <marc.mari.barcelo@gmail.com>2014-08-12 13:41:48 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-08-15 18:03:14 +0100
commitae74f18782d83c249e8bb9566bf5a2ad501ab82c (patch)
tree87faa8df96f806be1dc59eaf4a4745af3095bce3 /tests/libqtest.c
parentf7f3ff1da0c451befc8d32f977f9c352d1303f40 (diff)
libqtest: add QTEST_LOG for debugging qtest testcases
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marc MarĂ­ <marc.mari.barcelo@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/libqtest.c')
-rw-r--r--tests/libqtest.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 0bf17aa8cd..ed55686ce0 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);