]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
testsuite: Fix colorize
authorPetr Vorel <pvorel@suse.cz>
Tue, 18 Dec 2018 19:29:04 +0000 (20:29 +0100)
committerStephen Hemminger <sthemmin@microsoft.com>
Fri, 21 Dec 2018 04:16:28 +0000 (20:16 -0800)
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>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
testsuite/Makefile

index 9b0f1c157a3980a3ac80b8489d316128622698aa..7f247bbc1c80331f6dfd7a2157e310a47f22720d 100644 (file)
@@ -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; \