From 1304afa672b0b4626de986f9c47e29fc3e63a5a4 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 28 Jul 2023 16:18:33 +0200 Subject: [PATCH] Squash to "selftests: mptcp: join: colored results" New env var to force using colours. Most CIs these days support colours in the serial but they will execute scripts in a non interactive mode and colours will then not be displayed by default. So we need a way to force displaying them when we are in this mode: SELFTESTS_MPTCP_LIB_COLOR_FORCE=1 Note that it is still possible to force disabling them if needed via the standard NO_COLOR=1 env var way. Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 1080d5d2430bfd..92a5befe803940 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -10,8 +10,9 @@ readonly KSFT_TEST=$(basename "${0}" | sed 's/\.sh$//g') MPTCP_LIB_SUBTESTS=() -# only if supported and not disabled, see no-color.org -if [ -t 1 ] && [ "${NO_COLOR:-}" != "1" ]; then +# only if supported (or forced) and not disabled, see no-color.org +if { [ -t 1 ] || [ "${SELFTESTS_MPTCP_LIB_COLOR_FORCE:-}" = "1" ]; } && + [ "${NO_COLOR:-}" != "1" ]; then readonly MPTCP_LIB_COLOR_RED="\E[1;31m" readonly MPTCP_LIB_COLOR_GREEN="\E[1;32m" readonly MPTCP_LIB_COLOR_YELLOW="\E[1;33m"