From: "Marc Marí" <marc.mari.barcelo@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Marc Marí" <marc.mari.barcelo@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v2 3/7] libqtest: add QTEST_LOG for debugging qtest testcases
Date: Fri, 25 Jul 2014 23:37:39 +0200 [thread overview]
Message-ID: <1406324263-2450-4-git-send-email-marc.mari.barcelo@gmail.com> (raw)
In-Reply-To: <1406324263-2450-1-git-send-email-marc.mari.barcelo@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com>
---
tests/libqtest.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 98e8f4b..fbd600d 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -167,11 +167,12 @@ QTestState *qtest_init(const char *extra_args)
if (s->qemu_pid == 0) {
command = g_strdup_printf("exec %s "
"-qtest unix:%s,nowait "
- "-qtest-log /dev/null "
+ "-qtest-log %s "
"-qmp unix:%s,nowait "
"-machine accel=qtest "
"-display none "
"%s", qemu_binary, socket_path,
+ getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
qmp_socket_path,
extra_args ?: "");
execlp("/bin/sh", "sh", "-c", command, NULL);
@@ -397,10 +398,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);
--
1.7.10.4
next prev parent reply other threads:[~2014-07-25 21:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 21:37 [Qemu-devel] [PATCH v2 0/7] Virtio PCI libqos driver Marc Marí
2014-07-25 21:37 ` [Qemu-devel] [PATCH v2 1/7] tests: Functions bus_foreach and device_find from libqos virtio API Marc Marí
2014-07-25 21:37 ` [Qemu-devel] [PATCH v2 2/7] tests: Add virtio device initialization Marc Marí
2014-07-25 21:37 ` Marc Marí [this message]
2014-07-25 21:37 ` [Qemu-devel] [PATCH v2 4/7] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc Marc Marí
2014-07-25 21:37 ` [Qemu-devel] [PATCH v2 5/7] libqos: Change free function called in malloc Marc Marí
2014-07-25 21:37 ` [Qemu-devel] [PATCH v2 6/7] virtio-blk: Correct bug in support for flexible descriptor layout Marc Marí
2014-07-25 21:37 ` [Qemu-devel] [PATCH v2 7/7] libqos: Added basic virtqueue support to virtio implementation Marc Marí
2014-07-28 10:16 ` Marc Marí
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406324263-2450-4-git-send-email-marc.mari.barcelo@gmail.com \
--to=marc.mari.barcelo@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).