Skip to contentSkip to conversation

selftests/ftrace: Fix bash specific "==" operator

PATCH In review Masami Hiramatsu (Google) 3 participants 3 messages Jan 21, 2023 – Feb 3, 2023

Subsystems (2)
lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH 1/1 selftests/ftrace: Fix bash specific "==" operator

From: Masami Hiramatsu (Google) <[email protected]>

Since commit a1d6cd88c897 ("selftests/ftrace: event_triggers: wait longer for test_event_enable") introduced bash specific "==" comparation operator, that test will fail when we run it on a posix-shell. checkbashisms warned it as below.

possible bashism in ftrace/func_event_triggers.tc line 45 (should be 'b = a'):

        if [ "$e" == $val ]; then

This replaces it with "=".

Fixes a1d6cd88c897 ("selftests/ftrace: event_triggers: wait longer for test_event_enable")
---
 .../ftrace/test.d/ftrace/func_event_triggers.tc    |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +1 -1
index 3eea2abf68f9..2ad7d4b501cc 100644
@@ -42,7 +42,7 @@ test_event_enabled() {
 
     while [ $check_times -ne 0 ]; do
 	e=`cat $EVENT_ENABLE`
-	if [ "$e" == $val ]; then
+	if [ "$e" = $val ]; then
 	    return 0
 	fi
 	sleep $SLEEP_TIME
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Sun, 22 Jan 2023 08:32:50 +0900 "Masami Hiramatsu (Google)"…

From: Masami Hiramatsu (Google) <[email protected]>

Since commit a1d6cd88c897 ("selftests/ftrace: event_triggers: wait longer for test_event_enable") introduced bash specific "==" comparation operator, that test will fail when we run it on a posix-shell. checkbashisms warned it as below.

Quoted 7 lines

possible bashism in ftrace/func_event_triggers.tc line 45 (should be 'b = a'):

        if [ "$e" == $val ]; then

This replaces it with "=".

Fixes a1d6cd88c897 ("selftests/ftrace: event_triggers: wait longer for test_event_enable")

Shuah,

Care to pull this through your tree?

-- Steve

Quoted 17 lines
---
 .../ftrace/test.d/ftrace/func_event_triggers.tc    |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +1 -1
index 3eea2abf68f9..2ad7d4b501cc 100644
@@ -42,7 +42,7 @@ test_event_enabled() {
 
     while [ $check_times -ne 0 ]; do
 	e=`cat $EVENT_ENABLE`
-	if [ "$e" == $val ]; then
+	if [ "$e" = $val ]; then
 	    return 0
 	fi
 	sleep $SLEEP_TIME
maintainer
#2 lore raw
Quoted 15 lines · Steven Rostedt
Quoted 12 lines · On Sun, 22 Jan 2023 08:32:50 +0900 "Masami Hiramatsu (Google)"…

From: Masami Hiramatsu (Google) <[email protected]>

Since commit a1d6cd88c897 ("selftests/ftrace: event_triggers: wait longer for test_event_enable") introduced bash specific "==" comparation operator, that test will fail when we run it on a posix-shell. checkbashisms warned it as below.

possible bashism in ftrace/func_event_triggers.tc line 45 (should be 'b = a'):

         if [ "$e" == $val ]; then

This replaces it with "=".

Quoted 9 lines
Quoted 2 lines
Fixes a1d6cd88c897 ("selftests/ftrace: event_triggers: wait longer for test_event_enable")

Shuah,

Care to pull this through your tree?

Yes. Will appear shortly in linux-kselftest next.

thanks,
-- Shuah