Commit 2c557c7f authored by Charles Ferguson's avatar Charles Ferguson
Browse files

Update the inttest to be safe if no TERM, but force it inside GitLab CI.

tput seems to now be reporting an error, either through a change to tput
itself, or through the TERM variable not being set inside the CI.

This change makes the failure of the tput command non-fatal, but if we
are in CI, we'll instead force ANSI as we then get nice colours.
parent 306b8d9f
......@@ -149,7 +149,6 @@ sut_leaf="$(basename "${sut_exe}")"
sut_testdir="${2:-tests/invocation}"
# Set up the test suite name based on the binary we're testing.
testsuite="${sut_leaf%.*}"
if [[ "$testsuite" == "test" || \
......@@ -164,19 +163,36 @@ junitxml_ci_properties
# The files we're going to execute are in the 'invocation' directory.
files_to_test=("${sut_testdir}"/*.invoke)
# If we're inside the CI, even if we wouldn't have a TERM set, let's use one
if [[ "${CI}" != '' && "${TERM}" == '' ]] ; then
export TERM=ansi
fi
# Terminal colouring
term_red="$(tput setaf 1)"
term_green="$(tput setaf 2)"
term_yellow="$(tput setaf 3)"
term_blue="$(tput setaf 4)"
term_magenta="$(tput setaf 5)"
term_cyan="$(tput setaf 6)"
term_white="$(tput setaf 7)"
term_reset="$(tput sgr0)"
term_bright="$(tput bold || true)"
term_dim="$(tput dim || true)"
if ! tput bold > /dev/null 2> /dev/null ; then
# No terminal colouring available; so we won't use colours
term_red=""
term_green=""
term_yellow=""
term_blue=""
term_magenta=""
term_cyan=""
term_white=""
term_reset=""
term_bright=""
term_dim=""
else
term_red="$(tput setaf 1)"
term_green="$(tput setaf 2)"
term_yellow="$(tput setaf 3)"
term_blue="$(tput setaf 4)"
term_magenta="$(tput setaf 5)"
term_cyan="$(tput setaf 6)"
term_white="$(tput setaf 7)"
term_reset="$(tput sgr0)"
term_bright="$(tput bold || true)"
term_dim="$(tput dim || true)"
fi
# Check whether we have the 'colordiff' tool - if not, we'll revert to
# boring regular 'diff'.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment