2019-02-20 15:39:38

by Juerg Haefliger

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Juerg Haefliger <[email protected]>
---
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



2019-02-20 19:48:30

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Handle the absence of tput

On Wed, 20 Feb 2019 16:37:06 +0100
Juerg Haefliger <[email protected]> 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 <[email protected]>

Acked-by: Steven Rostedt (VMware) <[email protected]>

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


2019-02-22 00:06:41

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Handle the absence of tput

On Wed, 20 Feb 2019 16:37:06 +0100
Juerg Haefliger <[email protected]> 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 <[email protected]>

Looks good to me.

Acked-by: Masami Hiramatsu <[email protected]>

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 <[email protected]>

2019-02-22 00:25:34

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] selftests/ftrace: Handle the absence of tput

On Fri, 22 Feb 2019 09:05:34 +0900
Masami Hiramatsu <[email protected]> wrote:

> On Wed, 20 Feb 2019 16:37:06 +0100
> Juerg Haefliger <[email protected]> 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 <[email protected]>
>
> Looks good to me.
>
> Acked-by: Masami Hiramatsu <[email protected]>

Acked-by: Steven Rostedt (VMware) <[email protected]>

Shuah,

Want to take this?

https://lore.kernel.org/lkml/[email protected]/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
> >
>
>


2019-02-25 13:17:45

by Juerg Haefliger

[permalink] [raw]
Subject: [RESEND PATCH] 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]>
---
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


2019-02-25 14:52:04

by Shuah Khan

[permalink] [raw]
Subject: Re: [RESEND PATCH] selftests/ftrace: Handle the absence of tput

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) <[email protected]>
> Acked-by: Masami Hiramatsu <[email protected]>
> Signed-off-by: Juerg Haefliger <[email protected]>
> ---
> 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

2019-02-25 15:03:41

by Juerg Haefliger

[permalink] [raw]
Subject: Re: [RESEND PATCH] selftests/ftrace: Handle the absence of tput

On Mon, 25 Feb 2019 07:51:13 -0700
shuah <[email protected]> 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) <[email protected]>
> > Acked-by: Masami Hiramatsu <[email protected]>
> > Signed-off-by: Juerg Haefliger <[email protected]>
> > ---
> > 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


Attachments:
(No filename) (849.00 B)
OpenPGP digital signature