From: Thomas Huth <thuth@redhat.com>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Emanuele Giuseppe Esposito" <e.emanuelegiuseppe@gmail.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Greg Kurz" <groug@kaod.org>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v4 04/12] libqos/qgraph: add qos_dump_graph()
Date: Wed, 28 Oct 2020 06:51:00 +0100 [thread overview]
Message-ID: <11a4d5e3-cb5d-b74d-df7e-6e5a659c63a4@redhat.com> (raw)
In-Reply-To: <6217010.FX5ceaG2Km@silver>
On 24/10/2020 13.24, Christian Schoenebeck wrote:
> On Samstag, 24. Oktober 2020 08:04:20 CEST Thomas Huth wrote:
>> On 08/10/2020 20.34, Christian Schoenebeck wrote:
>>> This new function is purely for debugging purposes. It prints the
>>> current qos graph to stdout and allows to identify problems in the
>>> created qos graph e.g. when writing new qos tests.
>>>
>>> Coloured output is used to mark available nodes in green colour,
>>> whereas unavailable nodes are marked in red colour.
>>>
>>> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
>>> ---
>>>
>>> tests/qtest/libqos/qgraph.c | 56 +++++++++++++++++++++++++++++++++++++
>>> tests/qtest/libqos/qgraph.h | 20 +++++++++++++
>>> 2 files changed, 76 insertions(+)
>>>
>>> diff --git a/tests/qtest/libqos/qgraph.c b/tests/qtest/libqos/qgraph.c
>>> index 61faf6b27d..af93e38dcb 100644
>>> --- a/tests/qtest/libqos/qgraph.c
>>> +++ b/tests/qtest/libqos/qgraph.c
>>> @@ -805,3 +805,59 @@ void qos_delete_cmd_line(const char *name)
>>>
>>> node->command_line = NULL;
>>>
>>> }
>>>
>>> }
>>>
>>> +
>>> +#define RED(txt) ( \
>>> + "\033[0;91m" txt \
>>> + "\033[0m" \
>>> +)
>>> +
>>> +#define GREEN(txt) ( \
>>> + "\033[0;92m" txt \
>>> + "\033[0m" \
>>> +)
>>
>> I don't think this is very portable - and it will only make logs ugly to
>> read in text editors. Could you please simply drop these macros?
>>
>> Thomas
>
> The precise way I did it here is definitely unclean. And the use case is
> trivial, so on doubt I could just drop it of course.
>
> But allow me one attempt to promote coloured terminal output in general: These
> are ANSI color escape sequences, a standard with its youngest revision dating
> back to 1991. It is a well supported standard on all major platforms nowadays:
>
> https://en.wikipedia.org/wiki/ANSI_escape_code
>
> It works on macOS's standard terminal for at least 20 years, with cmd.exe on
> Windows 10, on essentially all Linux and BSD distros, and even on many web
> based CI platforms.
>
> So what about introducing some globally shared macros for coloured output
> instead? Then there would be one central place for changing coloured output
> support for the entire code base; and I would change the macros to fallback to
> plain text output if there is any doubt the terminal would not support it.
>
> Besides, QEMU just switched to meson which uses coloured output as well, as do
> clang, GCC, git and many other tools in your build chain.
Sure, colored output is nice, but we certainly also need a way to disable
it, e.g. if you want to collect the log in a file and then have a look at it
in a text editor.
Thomas
next prev parent reply other threads:[~2020-10-28 5:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-08 18:49 [PATCH v4 00/12] 9pfs: add tests using local fs driver Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 10/12] tests/9pfs: wipe local 9pfs test directory Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 04/12] libqos/qgraph: add qos_dump_graph() Christian Schoenebeck
2020-10-24 6:04 ` Thomas Huth
2020-10-24 11:24 ` Christian Schoenebeck
2020-10-28 5:51 ` Thomas Huth [this message]
2020-10-28 13:00 ` Eric Blake
2020-10-28 13:28 ` Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 07/12] tests/qtest/qos-test: dump QEMU command if verbose Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 06/12] tests/qtest/qos-test: dump environment variables " Christian Schoenebeck
2020-10-24 5:56 ` Thomas Huth
2020-10-24 10:57 ` Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 02/12] libqos/qgraph: add qos_node_create_driver_named() Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 05/12] tests/qtest/qos-test: dump qos graph if verbose Christian Schoenebeck
2020-10-24 6:01 ` Thomas Huth
2020-10-24 11:34 ` Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 09/12] tests/9pfs: introduce local tests Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 12/12] tests/9pfs: add local Tmkdir test Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 01/12] libqos/qgraph: add qemu_name to QOSGraphNode Christian Schoenebeck
2020-10-19 10:35 ` Christian Schoenebeck
2020-10-24 6:08 ` Thomas Huth
2020-10-24 10:39 ` Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 11/12] tests/9pfs: add virtio_9p_test_path() Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 08/12] tests/9pfs: change qtest name prefix to synth Christian Schoenebeck
2020-10-14 15:25 ` Christian Schoenebeck
2020-10-14 19:38 ` Greg Kurz
2020-10-15 9:16 ` Christian Schoenebeck
2020-10-08 18:34 ` [PATCH v4 03/12] libqos/qgraph_internal: add qos_printf() and qos_printf_literal() Christian Schoenebeck
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=11a4d5e3-cb5d-b74d-df7e-6e5a659c63a4@redhat.com \
--to=thuth@redhat.com \
--cc=berrange@redhat.com \
--cc=e.emanuelegiuseppe@gmail.com \
--cc=groug@kaod.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.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).