Commit 0e27ded1 authored by Juerg Haefliger's avatar Juerg Haefliger Committed by Shuah Khan

selftests/ftrace: Handle the absence of tput

In environments where tput is not available, we get the following
error
$ ./ftracetest: 163: [: Illegal number:
because ncolors is an empty string. Fix that by setting it to 0 if the
tput command fails.
Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
parent 4ce55a9c
......@@ -154,13 +154,13 @@ fi
# Define text colors
# Check available colors on the terminal, if any
ncolors=`tput colors 2>/dev/null`
ncolors=`tput colors 2>/dev/null || echo 0`
color_reset=
color_red=
color_green=
color_blue=
# If stdout exists and number of colors is eight or more, use them
if [ -t 1 -a "$ncolors" -a "$ncolors" -ge 8 ]; then
if [ -t 1 -a "$ncolors" -ge 8 ]; then
color_reset="\033[0m"
color_red="\033[31m"
color_green="\033[32m"
......
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