selftests/ftrace: Handle the absence of tput
PATCH 1/1 selftests/ftrace: Handle the absence of tput
In environments where tput is not availbale, 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.
--- tools/testing/selftests/ftrace/ftracetest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/ftracetest +2 -2
@@ -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"
Signature · 1 line
2.19.1
Quoted 1 line · On Wed, 20 Feb 2019 16:37:06 +0100 Juerg Haefliger…
In environments where tput is not availbale, we get the following
available
Quoted 6 lines
error
$ ./ftracetest: 163: [: Illegal number: because ncolors is an empty string. Fix that by setting it to 0 if the tput command fails.Signed-off-by Juerg Haefliger <[email protected]>
-- Steve
Quoted 24 lines
--- tools/testing/selftests/ftrace/ftracetest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/ftrace/ftracetest +2
-2@@ -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"
Quoted 7 lines · On Wed, 20 Feb 2019 16:37:06 +0100 Juerg Haefliger…
In environments where tput is not availbale, 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.Signed-off-by Juerg Haefliger <[email protected]>
Looks good to me.
Thank you!
Quoted 27 lines
--- tools/testing/selftests/ftrace/ftracetest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/ftrace/ftracetest +2
-2@@ -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"Signature · 1 line
2.19.1
Signature · 1 line
Masami Hiramatsu <[email protected]>
Quoted 9 lines · On Fri, 22 Feb 2019 09:05:34 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 6 lines · On Wed, 20 Feb 2019 16:37:06 +0100 Juerg Haefliger…
In environments where tput is not availbale, 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.
Quoted 5 lines
Quoted 1 line
Signed-off-by Juerg Haefliger <[email protected]>Looks good to me.
Acked-by Masami Hiramatsu <[email protected]>
Shuah,
Want to take this?
https://lore.kernel.org/lkml/[email protected]/T/#u
-- Steve
Quoted 32 lines
Thank you!
Quoted 27 lines
--- tools/testing/selftests/ftrace/ftracetest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/ftrace/ftracetest +2
-2@@ -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"Signature · 1 line
2.19.1
PATCH RESEND 1/1 selftests/ftrace: Handle the absence of tput
In reply to Juerg HaefligerIn 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.
--- tools/testing/selftests/ftrace/ftracetest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/ftracetest +2 -2
@@ -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"
Signature · 1 line
2.19.1
shuah
maintainerQuoted 24 lines · Juerg Haefliger
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(-)tools/testing/selftests/ftrace/ftracetest +1
-1@@ -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`
tools/testing/selftests/ftrace/ftracetest fi · line 166
Quoted 10 lines
tools/testing/selftests/ftrace/ftracetest +1
-1color_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"
Juerg!
Thanks for the resend. Applied to linux-kselftest next for 5.1-rc1.
Since I applied this patch out of order, I had to resolve minor merge conflict. Please review.
thanks,
-- Shuah
Quoted 38 lines · On Mon, 25 Feb 2019 07:51:13 -0700 shuah <[email protected]> wrote:
Quoted 24 lines · Juerg Haefliger
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(-)tools/testing/selftests/ftrace/ftracetest +1
-1@@ -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`tools/testing/selftests/ftrace/ftracetest fi · line 166
Quoted 10 lines
tools/testing/selftests/ftrace/ftracetest +1
-1color_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"Juerg!
Quoted 4 lines
Thanks for the resend. Applied to linux-kselftest next for 5.1-rc1.
Since I applied this patch out of order, I had to resolve minor merge conflict. Please review.
Looks good.
Thanks Shuah!
..Juerg
Quoted 2 lines
thanks,
-- Shuah
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linaro.org/pipermail/linux-kselftest-mirror/attachments/20190225/7ddcf672/attachment-0001.sig>