From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VapvA-0007Ok-V2 for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vapv2-0000MO-IM for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:44:04 -0400 Received: from mail-qc0-x233.google.com ([2607:f8b0:400d:c01::233]:36340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vapv2-0000MK-Ei for qemu-devel@nongnu.org; Mon, 28 Oct 2013 12:43:56 -0400 Received: by mail-qc0-f179.google.com with SMTP id k18so3988892qcv.10 for ; Mon, 28 Oct 2013 09:43:56 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 28 Oct 2013 17:43:19 +0100 Message-Id: <1382978620-16641-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1382978620-16641-1-git-send-email-pbonzini@redhat.com> References: <1382978620-16641-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 03/24] libqtest: add QTEST_LOG for debugging qtest testcases List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com Signed-off-by: Paolo Bonzini --- tests/libqtest.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index 5205a43..6e42d01 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -129,11 +129,12 @@ QTestState *qtest_init(const char *extra_args) if (pid == 0) { command = g_strdup_printf("%s " "-qtest unix:%s,nowait " - "-qtest-log /dev/null " + "-qtest-log %s " "-qmp unix:%s,nowait " "-pidfile %s " "-machine accel=qtest " "%s", qemu_binary, s->socket_path, + getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null", s->qmp_socket_path, pid_file, extra_args ?: ""); execlp("/bin/sh", "sh", "-c", command, NULL); @@ -295,6 +296,7 @@ bool qtest_qmpv(QTestState *s, const char *fmt, va_list ap) { bool has_reply = false; int nesting = 0; + int log = getenv("QTEST_LOG") != NULL; /* Send QMP request */ socket_sendf(s->qmp_fd, fmt, ap); @@ -314,6 +316,9 @@ bool qtest_qmpv(QTestState *s, const char *fmt, va_list ap) exit(1); } + if (log) { + len = write(2, &c, 1); + } switch (c) { case '{': nesting++; -- 1.8.3.1