Skip to content

Commit

Permalink
Squash to "selftests: mptcp: join: colored results"
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
matttbe authored and intel-lab-lkp committed Jul 28, 2023
1 parent 18d38b0 commit 1304afa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/testing/selftests/net/mptcp/mptcp_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1304afa

Please sign in to comment.