* [PATCH iproute2 1/1] testsuite: Fix colorize
@ 2018-12-18 19:29 Petr Vorel
2018-12-21 4:17 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2018-12-18 19:29 UTC (permalink / raw)
To: netdev; +Cc: Petr Vorel, Stephen Hemminger
bash and dash require for escape sequence to use 'echo -e' or printf
(but working on zsh). Choosing printf as it's implementation is IMHO
more portable than echo implementations.
dash also require to use \033[0; as escape sequence instead of \e[0;
NOTE: \e[0; kept in lib/color.c as it's not problematic for C code
(working when run ip on various shells).
Fixes: 7e2f71b4 ("testsuite: colorize test result output")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testsuite/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testsuite/Makefile b/testsuite/Makefile
index 9b0f1c15..7f247bbc 100644
--- a/testsuite/Makefile
+++ b/testsuite/Makefile
@@ -85,11 +85,11 @@ endif
TC="$$i/tc/tc" IP="$$i/ip/ip" SS=$$i/misc/ss DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
ERRF="$(RESULTS_DIR)/$@.$$o.err" $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \
if [ "$$?" = "127" ]; then \
- echo "\e[1;35mSKIPPED\e[0m"; \
+ printf "\033[1;35mSKIPPED\033[0m\n"; \
elif [ -e "$(RESULTS_DIR)/$@.$$o.err" ]; then \
- echo "\e[0;31mFAILED\e[0m"; \
+ printf "\033[0;31mFAILED\033[0m\n"; \
else \
- echo "\e[0;32mPASS\e[0m"; \
+ printf "\033[0;32mPASS\033[0m\n"; \
fi; \
rm "$$TMP_ERR" "$$TMP_OUT"; \
sudo dmesg > $(RESULTS_DIR)/$@.$$o.dmesg; \
--
2.19.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2 1/1] testsuite: Fix colorize
2018-12-18 19:29 [PATCH iproute2 1/1] testsuite: Fix colorize Petr Vorel
@ 2018-12-21 4:17 ` Stephen Hemminger
2018-12-21 13:04 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2018-12-21 4:17 UTC (permalink / raw)
To: Petr Vorel; +Cc: netdev
On Tue, 18 Dec 2018 20:29:04 +0100
Petr Vorel <pvorel@suse.cz> wrote:
> bash and dash require for escape sequence to use 'echo -e' or printf
> (but working on zsh). Choosing printf as it's implementation is IMHO
> more portable than echo implementations.
> dash also require to use \033[0; as escape sequence instead of \e[0;
>
> NOTE: \e[0; kept in lib/color.c as it's not problematic for C code
> (working when run ip on various shells).
>
> Fixes: 7e2f71b4 ("testsuite: colorize test result output")
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Sure applied. Not sure why people expect tests to work without
bash. Next they will want it to work with clang on BSD...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2 1/1] testsuite: Fix colorize
2018-12-21 4:17 ` Stephen Hemminger
@ 2018-12-21 13:04 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2018-12-21 13:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Hi Stephen,
> On Tue, 18 Dec 2018 20:29:04 +0100
> Petr Vorel <pvorel@suse.cz> wrote:
> > bash and dash require for escape sequence to use 'echo -e' or printf
> > (but working on zsh). Choosing printf as it's implementation is IMHO
> > more portable than echo implementations.
> > dash also require to use \033[0; as escape sequence instead of \e[0;
> > NOTE: \e[0; kept in lib/color.c as it's not problematic for C code
> > (working when run ip on various shells).
> > Fixes: 7e2f71b4 ("testsuite: colorize test result output")
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> Sure applied. Not sure why people expect tests to work without
> bash. Next they will want it to work with clang on BSD...
Understand your frustration about useless fixes, but actually the reason for me
to fail this patch was that it does not work on bash on Tumbleweed:
Now testing on Debian and it's working.
Not sure what causes that as echo "\e[0;32mPASS\e[0m" run in bash is broken on
both (both distros have bash version 4.4.23(1)-release):
$ echo "\e[0;32mPASS\e[0m"
\e[0;32mPASS\e[0m
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-21 13:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-18 19:29 [PATCH iproute2 1/1] testsuite: Fix colorize Petr Vorel
2018-12-21 4:17 ` Stephen Hemminger
2018-12-21 13:04 ` Petr Vorel
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).