qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: qemu_oss--- via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Huth <thuth@redhat.com>
Subject: [PATCH 2/5] libqos/qgraph_internal: add qos_printf() and qos_printf_literal()
Date: Wed, 27 Jan 2021 00:04:22 +0100	[thread overview]
Message-ID: <653a5ef61c5e7d160e4d6294e542c57ea324cee4.1611704181.git.qemu_oss@crudebyte.com> (raw)
In-Reply-To: <cover.1611704181.git.qemu_oss@crudebyte.com>

These two are macros wrapping regular printf() call. They are intended
to be used instead of calling printf() directly in order to avoid
breaking TAP output format.

TAP output format is enabled by using --tap command line argument.
Starting with glib 2.62 it is enabled by default.

Unfortunately there is currently no public glib API available to check
whether TAP output format is enabled. For that reason qos_printf()
simply always prepends a '#' character for now.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
 tests/qtest/libqos/qgraph_internal.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/qtest/libqos/qgraph_internal.h b/tests/qtest/libqos/qgraph_internal.h
index 974985dce9..c0025f5ab9 100644
--- a/tests/qtest/libqos/qgraph_internal.h
+++ b/tests/qtest/libqos/qgraph_internal.h
@@ -255,4 +255,15 @@ void qos_delete_cmd_line(const char *name);
  */
 void qos_graph_node_set_availability(const char *node, bool av);
 
+/*
+ * Prepends a '#' character in front for not breaking TAP output format.
+ */
+#define qos_printf(...) printf("# " __VA_ARGS__)
+
+/*
+ * Intended for printing something literally, i.e. for appending text as is
+ * to a line already been started by qos_printf() before.
+ */
+#define qos_printf_literal printf
+
 #endif
-- 
2.20.1



  parent reply	other threads:[~2021-01-27  0:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 23:36 [PATCH 0/5] enhance debugging with qtest framework qemu_oss--- via
2021-01-26 23:00 ` [PATCH 1/5] libqos/qgraph: add qos_node_create_driver_named() qemu_oss--- via
2021-01-26 23:04 ` qemu_oss--- via [this message]
2021-01-28 10:13   ` [PATCH 2/5] libqos/qgraph_internal: add qos_printf() and qos_printf_literal() Thomas Huth
2021-02-09 13:36     ` Christian Schoenebeck
2021-01-26 23:08 ` [PATCH 3/5] tests/qtest/qos-test: dump qos graph if verbose qemu_oss--- via
2021-01-26 23:17 ` [PATCH 4/5] tests/qtest/qos-test: dump environment variables " qemu_oss--- via
2021-01-26 23:26 ` [PATCH 5/5] tests/qtest/qos-test: dump QEMU command " qemu_oss--- via
2021-02-09 13:57 ` [PATCH 0/5] enhance debugging with qtest framework Paolo Bonzini

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=653a5ef61c5e7d160e4d6294e542c57ea324cee4.1611704181.git.qemu_oss@crudebyte.com \
    --to=qemu-devel@nongnu.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu_oss@crudebyte.com \
    --cc=thuth@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).