RE: [PATCH] Adds colors to kselftest output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Marcelo Moreira <marcelomoreira1905@xxxxxxxxx>
> This commit improves the readability of kselftest results by adding
> ANSI color codes to the [ OK ] and FAIL messages.
> 
> Signed-off-by: Marcelo Moreira <marcelomoreira1905@xxxxxxxxx>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> index 051e289d7967..7b55855ff788 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> @@ -83,7 +83,7 @@ mptcp_lib_print_err() {
> 
>  # shellcheck disable=SC2120 # parameters are optional
>  mptcp_lib_pr_ok() {
> -	mptcp_lib_print_ok "[ OK ]${1:+ ${*}}"
> +	mptcp_lib_print_ok "\033[32m[ OK ]\033[0m${1:+ ${*}}"
>  }

This should not be done unconditionally, but based on the controlling
and COLOR variables for this library.  You should also re-used the existing
color print helper function.

IOW, why is this not using MPTCP_LIB_COLOR_GREEN?
or the helper function mptcp_lib_print_color()?

>  mptcp_lib_pr_skip() {
> @@ -97,7 +97,7 @@ mptcp_lib_pr_fail() {
>  		title="IGNO"
>  		cmt=" (flaky)"
>  	else
> -		title="FAIL"
> +		title="\033[31mFAIL\033[0m"

Why not use the helper function and the MPTCP_LIB_COLOR_RED here?

 -- Tim





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux