linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/ftrace: Handle the absence of tput
@ 2019-02-20 15:37 Juerg Haefliger
  2019-02-20 19:47 ` Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Juerg Haefliger @ 2019-02-20 15:37 UTC (permalink / raw)
  To: linux-kernel, rostedt, mingo; +Cc: 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 <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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/ftrace: Handle the absence of tput
  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-25 13:14 ` [RESEND PATCH] " Juerg Haefliger
  2 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2019-02-20 19:47 UTC (permalink / raw)
  To: Juerg Haefliger
  Cc: linux-kernel, mingo, Juerg Haefliger, Masami Hiramatsu, Shuah Khan

On Wed, 20 Feb 2019 16:37:06 +0100
Juerg Haefliger <juerg.haefliger@canonical.com> wrote:

> In environments where tput is not availbale, we get the following

				    available

> 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 <juergh@canonical.com>

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> ---
>  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"


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/ftrace: Handle the absence of tput
  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 ` [RESEND PATCH] " Juerg Haefliger
  2 siblings, 1 reply; 7+ messages in thread
From: Masami Hiramatsu @ 2019-02-22  0:05 UTC (permalink / raw)
  To: Juerg Haefliger
  Cc: linux-kernel, rostedt, mingo, Juerg Haefliger, Masami Hiramatsu

On Wed, 20 Feb 2019 16:37:06 +0100
Juerg Haefliger <juerg.haefliger@canonical.com> wrote:

> 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 <juergh@canonical.com>

Looks good to me.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you!

> ---
>  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
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/ftrace: Handle the absence of tput
  2019-02-22  0:05 ` Masami Hiramatsu
@ 2019-02-22  0:24   ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2019-02-22  0:24 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Masami Hiramatsu, Juerg Haefliger, linux-kernel, mingo, Juerg Haefliger

On Fri, 22 Feb 2019 09:05:34 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> On Wed, 20 Feb 2019 16:37:06 +0100
> Juerg Haefliger <juerg.haefliger@canonical.com> wrote:
> 
> > 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 <juergh@canonical.com>  
> 
> Looks good to me.
> 
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Shuah,

Want to take this?

 https://lore.kernel.org/lkml/20190220153706.24686-1-juergh@canonical.com/T/#u

-- Steve

> 
> Thank you!
> 
> > ---
> >  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
> >   
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RESEND PATCH] selftests/ftrace: Handle the absence of tput
  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-25 13:14 ` Juerg Haefliger
  2019-02-25 14:51   ` shuah
  2 siblings, 1 reply; 7+ messages in thread
From: Juerg Haefliger @ 2019-02-25 13:14 UTC (permalink / raw)
  To: rostedt, mingo, shuah, linux-kselftest, linux-kernel; +Cc: 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@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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RESEND PATCH] selftests/ftrace: Handle the absence of tput
  2019-02-25 13:14 ` [RESEND PATCH] " Juerg Haefliger
@ 2019-02-25 14:51   ` shuah
  2019-02-25 15:02     ` Juerg Haefliger
  0 siblings, 1 reply; 7+ messages in thread
From: shuah @ 2019-02-25 14:51 UTC (permalink / raw)
  To: Juerg Haefliger, rostedt, mingo, linux-kselftest, linux-kernel
  Cc: Juerg Haefliger, shuah

On 2/25/19 6:14 AM, Juerg Haefliger wrote:
> 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"
> 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RESEND PATCH] selftests/ftrace: Handle the absence of tput
  2019-02-25 14:51   ` shuah
@ 2019-02-25 15:02     ` Juerg Haefliger
  0 siblings, 0 replies; 7+ messages in thread
From: Juerg Haefliger @ 2019-02-25 15:02 UTC (permalink / raw)
  To: shuah; +Cc: Juerg Haefliger, rostedt, mingo, linux-kselftest, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

On Mon, 25 Feb 2019 07:51:13 -0700
shuah <shuah@kernel.org> wrote:

> On 2/25/19 6:14 AM, Juerg Haefliger wrote:
> > 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"
> >   
> 
> 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.

Looks good.

Thanks Shuah!
..Juerg


> thanks,
> -- Shuah


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-02-25 15:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [RESEND PATCH] " Juerg Haefliger
2019-02-25 14:51   ` shuah
2019-02-25 15:02     ` Juerg Haefliger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).