qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] libqtest: dump child invocation when QTEST_LOG set
@ 2016-04-13 13:34 Alex Bennée
  2016-04-19 13:03 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Bennée @ 2016-04-13 13:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru, Alex Bennée

The QTEST_LOG environment is used for debugging qtest interactions with
a child process. When it is defined we now also dump the invocation line
to stderr to make it easier for people to see how QEMU was invoked.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/libqtest.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/libqtest.c b/tests/libqtest.c
index b12a9e4..dd94abf 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -171,6 +171,7 @@ QTestState *qtest_init(const char *extra_args)
 
     s->qemu_pid = fork();
     if (s->qemu_pid == 0) {
+        bool qtest_log = getenv("QTEST_LOG");
         setenv("QEMU_AUDIO_DRV", "none", true);
         command = g_strdup_printf("exec %s "
                                   "-qtest unix:%s,nowait "
@@ -179,9 +180,12 @@ QTestState *qtest_init(const char *extra_args)
                                   "-machine accel=qtest "
                                   "-display none "
                                   "%s", qemu_binary, socket_path,
-                                  getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
+                                  qtest_log ? "/dev/fd/2" : "/dev/null",
                                   qmp_socket_path,
                                   extra_args ?: "");
+        if (qtest_log) {
+            fprintf(stderr, "%s\n", command);
+        }
         execlp("/bin/sh", "sh", "-c", command, NULL);
         exit(1);
     }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [RFC] libqtest: dump child invocation when QTEST_LOG set
  2016-04-13 13:34 [Qemu-devel] [RFC] libqtest: dump child invocation when QTEST_LOG set Alex Bennée
@ 2016-04-19 13:03 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2016-04-19 13:03 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel, armbru

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

On Wed, Apr 13, 2016 at 02:34:17PM +0100, Alex Bennée wrote:
> The QTEST_LOG environment is used for debugging qtest interactions with
> a child process. When it is defined we now also dump the invocation line
> to stderr to make it easier for people to see how QEMU was invoked.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/libqtest.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-19 13:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13 13:34 [Qemu-devel] [RFC] libqtest: dump child invocation when QTEST_LOG set Alex Bennée
2016-04-19 13:03 ` Stefan Hajnoczi

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).