From: Juerg Haefliger <juerg.haefliger@canonical.com>
To: rostedt@goodmis.org, mingo@redhat.com, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Juerg Haefliger <juergh@canonical.com>
Subject: [RESEND PATCH] selftests/ftrace: Handle the absence of tput
Date: Mon, 25 Feb 2019 14:14:50 +0100 [thread overview]
Message-ID: <20190225131450.4775-1-juergh@canonical.com> (raw)
In-Reply-To: <20190220153706.24686-1-juergh@canonical.com>
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) <rostedt@goodmis.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
tools/testing/selftests/ftrace/ftracetest | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 75244db70331..fc755e1b50f1 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="\e[0m"
color_red="\e[31m"
color_green="\e[32m"
--
2.19.1
WARNING: multiple messages have this Message-ID (diff)
From: juerg.haefliger at canonical.com (Juerg Haefliger)
Subject: [RESEND PATCH] selftests/ftrace: Handle the absence of tput
Date: Mon, 25 Feb 2019 14:14:50 +0100 [thread overview]
Message-ID: <20190225131450.4775-1-juergh@canonical.com> (raw)
In-Reply-To: <20190220153706.24686-1-juergh@canonical.com>
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) <rostedt at goodmis.org>
Acked-by: Masami Hiramatsu <mhiramat at kernel.org>
Signed-off-by: Juerg Haefliger <juergh at canonical.com>
---
tools/testing/selftests/ftrace/ftracetest | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 75244db70331..fc755e1b50f1 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="\e[0m"
color_red="\e[31m"
color_green="\e[32m"
--
2.19.1
WARNING: multiple messages have this Message-ID (diff)
From: juerg.haefliger@canonical.com (Juerg Haefliger)
Subject: [RESEND PATCH] selftests/ftrace: Handle the absence of tput
Date: Mon, 25 Feb 2019 14:14:50 +0100 [thread overview]
Message-ID: <20190225131450.4775-1-juergh@canonical.com> (raw)
Message-ID: <20190225131450.pvm0B8tXe98O2XwapGr7tbdRl_8Tm4HO5SxoKojbh84@z> (raw)
In-Reply-To: <20190220153706.24686-1-juergh@canonical.com>
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) <rostedt at goodmis.org>
Acked-by: Masami Hiramatsu <mhiramat at kernel.org>
Signed-off-by: Juerg Haefliger <juergh at canonical.com>
---
tools/testing/selftests/ftrace/ftracetest | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 75244db70331..fc755e1b50f1 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="\e[0m"
color_red="\e[31m"
color_green="\e[32m"
--
2.19.1
next prev parent reply other threads:[~2019-02-25 13:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 15:37 [PATCH] selftests/ftrace: Handle the absence of tput Juerg Haefliger
2019-02-20 19:47 ` Steven Rostedt
2019-02-22 0:05 ` Masami Hiramatsu
2019-02-22 0:24 ` Steven Rostedt
2019-02-25 13:14 ` Juerg Haefliger [this message]
2019-02-25 13:14 ` [RESEND PATCH] " Juerg Haefliger
2019-02-25 13:14 ` juerg.haefliger
2019-02-25 14:51 ` shuah
2019-02-25 14:51 ` shuah
2019-02-25 14:51 ` shuah
2019-02-25 15:02 ` Juerg Haefliger
2019-02-25 15:02 ` Juerg Haefliger
2019-02-25 15:02 ` juerg.haefliger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190225131450.4775-1-juergh@canonical.com \
--to=juerg.haefliger@canonical.com \
--cc=juergh@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.