diff options
author | Juerg Haefliger <[email protected]> | 2019-02-25 14:14:50 +0100 |
---|---|---|
committer | Shuah Khan <[email protected]> | 2019-02-25 07:48:01 -0700 |
commit | 0e27ded1159f62ab1a4e723796246bd5b1793b93 (patch) | |
tree | ee1b8c0d95d430195f3cf3c1265d5b6c3dec23fb | |
parent | 4ce55a9ce18ed7649eed0e2dcb9f187891bcdf07 (diff) |
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: Steven Rostedt (VMware) <[email protected]>
Acked-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Juerg Haefliger <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
-rwxr-xr-x | tools/testing/selftests/ftrace/ftracetest | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index 316f2bf7099c..136387422b00 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest @@ -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" |