selftests/ftrace: Fix ftracetest testcases for dash, etc.
Masami Hiramatsu
maintainercover selftests/ftrace: Fix ftracetest testcases for dash, etc.
Hi,
Here are some patches to update ftracetest to fix some issues.
- [1/3] Fix coloring of XFAIL
- [2/3] Fix a testcase not to expect just one event entry
- [3/3] Do not use built-in echo because the behavior is different on dash and bash. (Thanks Liu for reporting!)
Thank you,
---
Masami Hiramatsu (3):
selftests/ftrace: Make XFAIL green color selftests/ftrace: Pick only the first kprobe event to test selftests/ftrace: Use /bin/echo instead of built-in echo
tools/testing/selftests/ftrace/ftracetest | 2 +- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 6 files changed, 12 insertions(+), 5 deletions(-)
--
Masami Hiramatsu (Linaro) <[email protected]>
Masami Hiramatsu
maintainerPATCH 1/3 selftests/ftrace: Make XFAIL green color
Since XFAIL (Expected Failure) is expected to fail the test, which means that test case works as we expected. IOW, XFAIL is same as PASS. So make it green.
--- tools/testing/selftests/ftrace/ftracetest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/ftracetest +1 -1
@@ -273,7 +273,7 @@ eval_result() { # sigval return $UNSUPPORTED_RESULT # depends on use case ;; $XFAIL) - prlog " [${color_red}XFAIL${color_reset}]" + prlog " [${color_green}XFAIL${color_reset}]" XFAILED_CASES="$XFAILED_CASES $CASENO" return 0 ;;
Steven Rostedt
maintainerRe: [PATCH 1/3] selftests/ftrace: Make XFAIL green color
Quoted 3 lines · On Fri, 1 May 2020 22:37:41 +0900 Masami Hiramatsu <[email protected]> wrote:
Since XFAIL (Expected Failure) is expected to fail the test, which means that test case works as we expected. IOW, XFAIL is same as PASS. So make it green.
THANK YOU!!!! That's been annoying me for some time ;-)
BIG Acked-by: Steven Rostedt (VMware) <[email protected]>
-- Steve
Quoted 19 lines
Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/ftracetest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/ftracetest +1
-1@@ -273,7 +273,7 @@ eval_result() { # sigval return $UNSUPPORTED_RESULT # depends on use case ;; $XFAIL) - prlog " [${color_red}XFAIL${color_reset}]" + prlog " [${color_green}XFAIL${color_reset}]" XFAILED_CASES="$XFAILED_CASES $CASENO" return 0 ;;
Masami Hiramatsu
maintainerPATCH 2/3 selftests/ftrace: Pick only the first kprobe event to test
In reply to Masami HiramatsuSince the kprobe/kprobe_args_type.tc reads out all event logs from the trace buffer, the test can fail if there is another fork event happens.
Use head command to pick only the first kprobe event from the trace buffer to test the argument types.
--- .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1 -1
@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $width : "Clear event for next loop"
Re: [PATCH 2/3] selftests/ftrace: Pick only the first kprobe event to test
Quoted 16 lines · On Fri, 1 May 2020 22:37:51 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the kprobe/kprobe_args_type.tc reads out all event logs from the trace buffer, the test can fail if there is another fork event happens.
Use head command to pick only the first kprobe event from the trace buffer to test the argument types.Signed-off-by Masami Hiramatsu <[email protected]>--- .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +0
-0
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc for width in 64 32 16 8; do · line 44
Quoted 8 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1
-1@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $width : "Clear event for next loop"
I think I've manually added this exact change to my tests to keep it from failing.
-- Steve
shuah
maintainerRe: [PATCH 2/3] selftests/ftrace: Pick only the first kprobe event to test
Quoted 26 lines · Steven Rostedt
Quoted 23 lines · On Fri, 1 May 2020 22:37:51 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the kprobe/kprobe_args_type.tc reads out all event logs from the trace buffer, the test can fail if there is another fork event happens.
Use head command to pick only the first kprobe event from the trace buffer to test the argument types.Signed-off-by Masami Hiramatsu <[email protected]>--- .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1
-1@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $width
Quoted 7 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc for width in 64 32 16 8; do · line 44
Quoted 1 line
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +0
-0: "Clear event for next loop"I think I've manually added this exact change to my tests to keep it from failing.
Reviewed-by Steven Rostedt (VMware) <[email protected]>
Does this conflict with:
Author: Xiao Yang <[email protected]> Date: Tue Apr 7 14:34:19 2020 +0800
selftests/ftrace: Check the first record for kprobe_args_type.tc
I went into mainline yesterday in my rc4 pull request.
Exact change it appears.
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1 -1
@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $width : "Clear event for next loop"
thanks,
-- Shuah
Steven Rostedt
maintainerRe: [PATCH 2/3] selftests/ftrace: Pick only the first kprobe event to test
Quoted 40 lines · On Fri, 1 May 2020 09:38:59 -0600 shuah <[email protected]> wrote:
Quoted 26 lines · Steven Rostedt
Quoted 23 lines · On Fri, 1 May 2020 22:37:51 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the kprobe/kprobe_args_type.tc reads out all event logs from the trace buffer, the test can fail if there is another fork event happens.
Use head command to pick only the first kprobe event from the trace buffer to test the argument types.Signed-off-by Masami Hiramatsu <[email protected]>--- .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1
-1@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $widthQuoted 7 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc for width in 64 32 16 8; do · line 44
Quoted 1 line
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +0
-0: "Clear event for next loop"I think I've manually added this exact change to my tests to keep it from failing.
Reviewed-by Steven Rostedt (VMware) <[email protected]>Does this conflict with:
Author: Xiao Yang <[email protected]> Date: Tue Apr 7 14:34:19 2020 +0800
Quoted 7 lines
selftests/ftrace: Check the first record for kprobe_args_type.tc
I went into mainline yesterday in my rc4 pull request.
Exact change it appears.
Ah, then I guess we don't need this patch ;-)
-- Steve
Quoted 21 lines
(quoted diff) +0
-0a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc index
1bcb67dcae26..81490ecaaa92100644tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +0
-1@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\)arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
+ ARGS=grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'check_types$ARGS $width: "Clear event for next loop"
thanks,
-- Shuah
Shuah Khan
maintainerRe: [PATCH 2/3] selftests/ftrace: Pick only the first kprobe event to test
Quoted 45 lines · Steven Rostedt
Quoted 42 lines · On Fri, 1 May 2020 09:38:59 -0600 shuah <[email protected]> wrote:
Quoted 26 lines · Steven Rostedt
Quoted 23 lines · On Fri, 1 May 2020 22:37:51 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the kprobe/kprobe_args_type.tc reads out all event logs from the trace buffer, the test can fail if there is another fork event happens.
Use head command to pick only the first kprobe event from the trace buffer to test the argument types.Signed-off-by Masami Hiramatsu <[email protected]>--- .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1
-1@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $widthQuoted 7 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc for width in 64 32 16 8; do · line 44
Quoted 1 line
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +0
-0: "Clear event for next loop"I think I've manually added this exact change to my tests to keep it from failing.
Reviewed-by Steven Rostedt (VMware) <[email protected]>Does this conflict with:
Author: Xiao Yang <[email protected]> Date: Tue Apr 7 14:34:19 2020 +0800selftests/ftrace: Check the first record for kprobe_args_type.tc
Quoted 8 lines
Quoted 5 lines
I went into mainline yesterday in my rc4 pull request.
Exact change it appears.
Ah, then I guess we don't need this patch ;-)
I took the first one. Will wait for patch 3 to finalize.
thanks,
-- Shuah
Masami Hiramatsu
maintainerRe: [PATCH 2/3] selftests/ftrace: Pick only the first kprobe event to test
In reply to shuahQuoted 64 lines · On Fri, 1 May 2020 09:38:59 -0600 shuah <[email protected]> wrote:
Quoted 26 lines · Steven Rostedt
Quoted 23 lines · On Fri, 1 May 2020 22:37:51 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the kprobe/kprobe_args_type.tc reads out all event logs from the trace buffer, the test can fail if there is another fork event happens.
Use head command to pick only the first kprobe event from the trace buffer to test the argument types.Signed-off-by Masami Hiramatsu <[email protected]>--- .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1
-1@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` + ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'` check_types $ARGS $widthQuoted 7 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc for width in 64 32 16 8; do · line 44
Quoted 1 line
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +0
-0: "Clear event for next loop"I think I've manually added this exact change to my tests to keep it from failing.
Reviewed-by Steven Rostedt (VMware) <[email protected]>Does this conflict with:
Author: Xiao Yang <[email protected]> Date: Tue Apr 7 14:34:19 2020 +0800selftests/ftrace: Check the first record for kprobe_args_type.tc
I went into mainline yesterday in my rc4 pull request.
Exact change it appears.
(quoted diff) +0
-0a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc index
1bcb67dcae26..81490ecaaa92100644tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +0
-1@@ -38,7 +38,7 @@ for width in 64 32 16 8; do echo 0 > events/kprobes/testprobe/enable : "Confirm the arguments is recorded in given types correctly" - ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\)arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
+ ARGS=grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'check_types$ARGS $width
Quoted 1 line
: "Clear event for next loop"
Oops, yes, please drop this patch.
Thank you,
Quoted 3 lines
thanks,
-- Shuah
Signature · 1 line
Masami Hiramatsu <[email protected]>
Masami Hiramatsu
maintainerPATCH 3/3 selftests/ftrace: Use /bin/echo instead of built-in echo
In reply to Masami HiramatsuSince the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use /bin/echo -E (not interpret backslash escapes) by default.
This also fixes some test cases which expects built-in echo command.
--- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-)
tools/testing/selftests/ftrace/test.d/functions +3 -0
@@ -1,3 +1,6 @@ +# Since the built-in echo has different behavior in POSIX shell (dash) and +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). +alias echo="/bin/echo -E" clear_trace() { # reset trace output echo > trace
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1 -1
@@ -30,7 +30,7 @@ fi echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid' > events/ftrace/print/trigger +echo 'hist:keys=ip' > events/ftrace/print/trigger for i in `seq 1 10` ; do echo "hello" > trace_marker; done grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \ fail "hist trigger did not trigger correct times on trace_marker"
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc +4 -0
@@ -44,6 +44,10 @@ echo 'latency u64 lat' > synthetic_events echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)' > events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger + +# We have to use the built-in echo here because waking up pid must be same +# as echoing pid. +alias echo=echo sleep 1 echo "hello" > trace_marker
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +2 -2
@@ -36,8 +36,8 @@ fi echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo 'latency u64 lat' > synthetic_events -echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger +echo 'hist:keys=ip:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger +echo 'hist:keys=ip:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger echo -n "start" > trace_marker echo -n "end" > trace_marker
Steven Rostedt
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 32 lines · On Fri, 1 May 2020 22:38:00 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.This also fixes some test cases which expects built-in echo command.
Reported-by Liu Yiding <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-)tools/testing/selftests/ftrace/test.d/functions +3
-0@@ -1,3 +1,6 @@ +# Since the built-in echo has different behavior in POSIX shell (dash) and +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). +alias echo="/bin/echo -E" clear_trace() { # reset trace output echo > tracetools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +0
-0
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc fi · line 33
Quoted 5 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1
-1@@ -30,7 +30,7 @@ fi echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid' > events/ftrace/print/trigger +echo 'hist:keys=ip' > events/ftrace/print/trigger
This is doing more than just changing the echo being used. It's changing the test being done.
Quoted 23 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +0
-0for i in `seq 1 10` ; do echo "hello" > trace_marker; done grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \ fail "hist trigger did not trigger correct times on trace_marker"tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc +4
-0@@ -44,6 +44,10 @@ echo 'latency u64 lat' > synthetic_events echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)' > events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger + +# We have to use the built-in echo here because waking up pid must be same +# as echoing pid. +alias echo=echo sleep 1 echo "hello" > trace_markertools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +0
-0
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc fi · line 40
Quoted 7 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +2
-2@@ -36,8 +36,8 @@ fi echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo 'latency u64 lat' > synthetic_events -echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger +echo 'hist:keys=ip:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger +echo 'hist:keys=ip:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger
This too. And it's not explained in the change log why. In fact, these changes look like they belong in a separate patch.
-- Steve
Quoted 3 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +0
-0echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger echo -n "start" > trace_marker echo -n "end" > trace_marker
Masami Hiramatsu
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 36 lines · On Fri, 1 May 2020 10:19:42 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 33 lines · On Fri, 1 May 2020 22:38:00 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.This also fixes some test cases which expects built-in echo command.
Reported-by Liu Yiding <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-)tools/testing/selftests/ftrace/test.d/functions +3
-0@@ -1,3 +1,6 @@ +# Since the built-in echo has different behavior in POSIX shell (dash) and +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). +alias echo="/bin/echo -E" clear_trace() { # reset trace output echo > tracetools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +0
-0@@ -30,7 +30,7 @@ fi
Quoted 7 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc fi · line 33
Quoted 4 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1
-1echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid' > events/ftrace/print/trigger +echo 'hist:keys=ip' > events/ftrace/print/triggerThis is doing more than just changing the echo being used. It's changing the test being done.
Yes, I need Tom's review for this change. As far as I can test, this fixes the test failure. If this isn't acceptable, we can use "alias echo=echo" for this test case.
Thank you,
Quoted 41 lines
Quoted 24 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +0
-0for i in `seq 1 10` ; do echo "hello" > trace_marker; done grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \ fail "hist trigger did not trigger correct times on trace_marker"tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc +4
-0@@ -44,6 +44,10 @@ echo 'latency u64 lat' > synthetic_events echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)' > events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger + +# We have to use the built-in echo here because waking up pid must be same +# as echoing pid. +alias echo=echo sleep 1 echo "hello" > trace_markertools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +0
-0tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc fi · line 40
Quoted 7 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +2
-2@@ -36,8 +36,8 @@ fi echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo 'latency u64 lat' > synthetic_events -echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger +echo 'hist:keys=ip:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger +echo 'hist:keys=ip:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/triggerThis too. And it's not explained in the change log why. In fact, these changes look like they belong in a separate patch.
-- Steve
Quoted 3 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +0
-0echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger echo -n "start" > trace_marker echo -n "end" > trace_marker
Signature · 1 line
Masami Hiramatsu <[email protected]>
Steven Rostedt
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 14 lines · On Sat, 2 May 2020 12:08:42 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 6 lines
Quoted 6 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +0
-0@@ -30,7 +30,7 @@ fiQuoted 7 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc fi · line 33
Quoted 4 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1
-1echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid' > events/ftrace/print/trigger +echo 'hist:keys=ip' > events/ftrace/print/triggerThis is doing more than just changing the echo being used. It's changing the test being done.
Quoted 4 lines
Yes, I need Tom's review for this change. As far as I can test, this fixes the test failure. If this isn't acceptable, we can use "alias echo=echo" for this test case.
I still don't see how changing "keys=common_pid" to "keys=ip" has anything to do with the echo patch. If that is a problem, it should be a different patch with explanation to why "keys=common_pid" is broken.
-- Steve
Masami Hiramatsu
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 17 lines · On Thu, 7 May 2020 09:12:07 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 14 lines · On Sat, 2 May 2020 12:08:42 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 13 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc fi · line 33
Quoted 10 lines
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1
-1@@ -30,7 +30,7 @@ fi echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid' > events/ftrace/print/trigger +echo 'hist:keys=ip' > events/ftrace/print/triggerThis is doing more than just changing the echo being used. It's changing the test being done.
Quoted 8 lines
Quoted 4 lines
Yes, I need Tom's review for this change. As far as I can test, this fixes the test failure. If this isn't acceptable, we can use "alias echo=echo" for this test case.
I still don't see how changing "keys=common_pid" to "keys=ip" has anything to do with the echo patch. If that is a problem, it should be a different patch with explanation to why "keys=common_pid" is broken.
This test case uses a trace_marker event to make a histogram with the common_pid key, and it expects the "echo" command is built-in command so that the pid is same while writing several events to trace_marker. I changed it to "ip" which is always same if trace_marker interface is used.
Thank you,
Quoted 3 lines
-- Steve
Signature · 1 line
Masami Hiramatsu <[email protected]>
Steven Rostedt
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 9 lines · On Fri, 8 May 2020 00:50:28 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Yes, I need Tom's review for this change. As far as I can test, this fixes the test failure. If this isn't acceptable, we can use "alias echo=echo" for this test case.
I still don't see how changing "keys=common_pid" to "keys=ip" has anything to do with the echo patch. If that is a problem, it should be a different patch with explanation to why "keys=common_pid" is broken.
Quoted 5 lines
This test case uses a
trace_markerevent to make a histogram with thecommon_pidkey, and it expects the "echo" command is built-in command so that the pid is same while writing several events totrace_marker. I changed it to "ip" which is always same iftrace_markerinterface is used.
Can you explicitly state that in your change log? It wasn't obvious from what you meant with:
"This also fixes some test cases which expects built-in echo command."
Thanks!
-- Steve
Zanussi, Tom
Reviewed-byRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Hi,
Quoted 18 lines · Steven Rostedt
Quoted 9 lines · On Fri, 8 May 2020 00:50:28 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Yes, I need Tom's review for this change. As far as I can test, this fixes the test failure. If this isn't acceptable, we can use "alias echo=echo" for this test case.
I still don't see how changing "keys=common_pid" to "keys=ip" has anything to do with the echo patch. If that is a problem, it should be a different patch with explanation to why "keys=common_pid" is broken.
Quoted 5 lines
This test case uses a
trace_markerevent to make a histogram with thecommon_pidkey, and it expects the "echo" command is built-in command so that the pid is same while writing several events totrace_marker. I changed it to "ip" which is always same iftrace_markerinterface is used.
Quoted 5 lines
Can you explicitly state that in your change log? It wasn't obvious from what you meant with:
"This also fixes some test cases which expects built-in echo command."
With that change,
Thanks,
Tom
Quoted 4 lines
Thanks!
-- Steve
Masami Hiramatsu
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 25 lines · Tom
Hi,
Quoted 22 lines · Steven Rostedt
Quoted 9 lines · On Fri, 8 May 2020 00:50:28 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Yes, I need Tom's review for this change. As far as I can test, this fixes the test failure. If this isn't acceptable, we can use "alias echo=echo" for this test case.
I still don't see how changing "keys=common_pid" to "keys=ip" has anything to do with the echo patch. If that is a problem, it should be a different patch with explanation to why "keys=common_pid" is broken.
Quoted 5 lines
This test case uses a
trace_markerevent to make a histogram with thecommon_pidkey, and it expects the "echo" command is built-in command so that the pid is same while writing several events totrace_marker. I changed it to "ip" which is always same iftrace_markerinterface is used.Can you explicitly state that in your change log? It wasn't obvious from what you meant with:
"This also fixes some test cases which expects built-in echo command."
OK, will add the description.
Quoted 5 lines
Quoted 1 line
With that change,
Reviewed-by Tom Zanussi <[email protected]>
Thanks Tom!
Quoted 9 lines
Thanks,
Tom
Quoted 4 lines
Thanks!
-- Steve
Signature · 1 line
Masami Hiramatsu <[email protected]>
Re: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
In reply to Masami HiramatsuQuoted 21 lines · Masami Hiramatsu
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.This also fixes some test cases which expects built-in echo command.
Reported-by Liu Yiding<[email protected]>Signed-off-by Masami Hiramatsu<[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-)tools/testing/selftests/ftrace/test.d/functions +0
-0
tools/testing/selftests/ftrace/test.d/functions line 3
Quoted 3 lines
tools/testing/selftests/ftrace/test.d/functions +3
-0@@ -1,3 +1,6 @@ +# Since the built-in echo has different behavior in POSIX shell (dash) and +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). +alias echo="/bin/echo -E"
Hi Masami, Steven
It seems that only kprobe_syntax_errors.tc is impacted by the issue currently. Is it necessary for all tests to use /bin/echo and could we just make kprobe_syntax_errors.tc use /bin/echo?
Best Regards,
Xiao Yang
Quoted 51 lines
tools/testing/selftests/ftrace/test.d/functions +0
-0clear_trace() { # reset trace output echo> tracetools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1
-1@@ -30,7 +30,7 @@ fi echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid'> events/ftrace/print/trigger +echo 'hist:keys=ip'> events/ftrace/print/trigger for i in `seq 1 10` ; do echo "hello"> trace_marker; done grep 'hitcount: *10$' events/ftrace/print/hist> /dev/null || \ fail "hist trigger did not trigger correct times on trace_marker"tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc +4
-0@@ -44,6 +44,10 @@ echo 'latency u64 lat'> synthetic_events echo 'hist:keys=pid:ts0=common_timestamp.usecs'> events/sched/sched_waking/trigger echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)'> events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger + +# We have to use the built-in echo here because waking up pid must be same +# as echoing pid. +alias echo=echo sleep 1 echo "hello"> trace_markertools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +2
-2@@ -36,8 +36,8 @@ fi echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo 'latency u64 lat'> synthetic_events -echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger +echo 'hist:keys=ip:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger +echo 'hist:keys=ip:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger echo -n "start"> trace_marker echo -n "end"> trace_marker.
Masami Hiramatsu
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 27 lines · On Thu, 7 May 2020 14:45:16 +0800 Xiao Yang <[email protected]> wrote:
Quoted 21 lines · Masami Hiramatsu
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.This also fixes some test cases which expects built-in echo command.
Reported-by Liu Yiding<[email protected]>Signed-off-by Masami Hiramatsu<[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-)tools/testing/selftests/ftrace/test.d/functions +0
-0tools/testing/selftests/ftrace/test.d/functions line 3
Quoted 3 lines
tools/testing/selftests/ftrace/test.d/functions +3
-0@@ -1,3 +1,6 @@ +# Since the built-in echo has different behavior in POSIX shell (dash) and +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). +alias echo="/bin/echo -E"Hi Masami, Steven
Quoted 3 lines
It seems that only kprobe_syntax_errors.tc is impacted by the issue currently. Is it necessary for all tests to use
/bin/echoand could we just make kprobe_syntax_errors.tc use/bin/echo?
Yes, I would like to unify the "echo"'s behavior among the testcases instead of patching each failure in the future.
Or would you have any concern on it?
Thank you,
Quoted 58 lines
Best Regards,
Xiao YangQuoted 51 lines
tools/testing/selftests/ftrace/test.d/functions +0
-0clear_trace() { # reset trace output echo> tracetools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1
-1@@ -30,7 +30,7 @@ fi echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid'> events/ftrace/print/trigger +echo 'hist:keys=ip'> events/ftrace/print/trigger for i in `seq 1 10` ; do echo "hello"> trace_marker; done grep 'hitcount: *10$' events/ftrace/print/hist> /dev/null || \ fail "hist trigger did not trigger correct times on trace_marker"tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc +4
-0@@ -44,6 +44,10 @@ echo 'latency u64 lat'> synthetic_events echo 'hist:keys=pid:ts0=common_timestamp.usecs'> events/sched/sched_waking/trigger echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)'> events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger + +# We have to use the built-in echo here because waking up pid must be same +# as echoing pid. +alias echo=echo sleep 1 echo "hello"> trace_markertools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +2
-2@@ -36,8 +36,8 @@ fi echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo 'latency u64 lat'> synthetic_events -echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger +echo 'hist:keys=ip:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger +echo 'hist:keys=ip:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger echo -n "start"> trace_marker echo -n "end"> trace_marker.
Signature · 1 line
Masami Hiramatsu <[email protected]>
Re: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 30 lines · Masami Hiramatsu
Quoted 27 lines · On Thu, 7 May 2020 14:45:16 +0800 Xiao Yang<[email protected]> wrote:
Quoted 21 lines · Masami Hiramatsu
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.This also fixes some test cases which expects built-in echo command.
Reported-by Liu Yiding<[email protected]>Signed-off-by Masami Hiramatsu<[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-)tools/testing/selftests/ftrace/test.d/functions +0
-0tools/testing/selftests/ftrace/test.d/functions line 3
Quoted 3 lines
tools/testing/selftests/ftrace/test.d/functions +3
-0@@ -1,3 +1,6 @@ +# Since the built-in echo has different behavior in POSIX shell (dash) and +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). +alias echo="/bin/echo -E"Hi Masami, Steven
Quoted 7 lines
Quoted 3 lines
It seems that only kprobe_syntax_errors.tc is impacted by the issue currently. Is it necessary for all tests to use
/bin/echoand could we just make kprobe_syntax_errors.tc use/bin/echo?Yes, I would like to unify the "echo"'s behavior among the testcases instead of patching each failure in the future.
Or would you have any concern on it?
Hi Masami,
Very sorry for the late reply.
We may not avoid fixing related failures after your change:
1) We have to reuse built-in echo (do alias echo=echo) if we want to test common_pid for histogram.
2) We have to reuse built-in echo if some new tests want to interpret backslash escapes in future.
Is it simple to provide two implementations of echo?(built-in echo and echo command?) and then just apply echo command for kprobe_syntax_errors.tc?
BTW: My suggestion may not be correct.
Best Regards,
Xiao Yang
Quoted 63 lines
Thank you,
Quoted 58 lines
Best Regards,
Xiao YangQuoted 51 lines
tools/testing/selftests/ftrace/test.d/functions +0
-0clear_trace() { # reset trace output echo> tracetools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc +1
-1@@ -30,7 +30,7 @@ fi echo "Test histogram trace_marker tigger" -echo 'hist:keys=common_pid'> events/ftrace/print/trigger +echo 'hist:keys=ip'> events/ftrace/print/trigger for i in `seq 1 10` ; do echo "hello"> trace_marker; done grep 'hitcount: *10$' events/ftrace/print/hist> /dev/null || \ fail "hist trigger did not trigger correct times on trace_marker"tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc +4
-0@@ -44,6 +44,10 @@ echo 'latency u64 lat'> synthetic_events echo 'hist:keys=pid:ts0=common_timestamp.usecs'> events/sched/sched_waking/trigger echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)'> events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger + +# We have to use the built-in echo here because waking up pid must be same +# as echoing pid. +alias echo=echo sleep 1 echo "hello"> trace_markertools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +2
-2@@ -36,8 +36,8 @@ fi echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo 'latency u64 lat'> synthetic_events -echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger +echo 'hist:keys=ip:ts0=common_timestamp.usecs if buf == "start"'> events/ftrace/print/trigger +echo 'hist:keys=ip:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"'>> events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat'> events/synthetic/latency/trigger echo -n "start"> trace_marker echo -n "end"> trace_marker.
Masami Hiramatsu
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 40 lines · On Mon, 11 May 2020 15:22:25 +0800 Xiao Yang <[email protected]> wrote:
Quoted 30 lines · Masami Hiramatsu
Quoted 27 lines · On Thu, 7 May 2020 14:45:16 +0800 Xiao Yang<[email protected]> wrote:
Quoted 21 lines · Masami Hiramatsu
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.This also fixes some test cases which expects built-in echo command.
Reported-by Liu Yiding<[email protected]>Signed-off-by Masami Hiramatsu<[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-)tools/testing/selftests/ftrace/test.d/functions +0
-0tools/testing/selftests/ftrace/test.d/functions line 3
Quoted 3 lines
tools/testing/selftests/ftrace/test.d/functions +3
-0@@ -1,3 +1,6 @@ +# Since the built-in echo has different behavior in POSIX shell (dash) and +# bash, we forcibly use /bin/echo -E (not interpret backslash escapes). +alias echo="/bin/echo -E"Hi Masami, Steven
Quoted 7 lines
Quoted 3 lines
It seems that only kprobe_syntax_errors.tc is impacted by the issue currently. Is it necessary for all tests to use
/bin/echoand could we just make kprobe_syntax_errors.tc use/bin/echo?Yes, I would like to unify the "echo"'s behavior among the testcases instead of patching each failure in the future.
Or would you have any concern on it?Hi Masami,
Quoted 7 lines
Very sorry for the late reply.
We may not avoid fixing related failures after your change:
1) We have to reuse built-in echo (do alias echo=echo) if we want to testcommon_pidfor histogram.
2) We have to reuse built-in echo if some new tests want to interpret backslash escapes in future.
1) yes, that's what I need to do for avoiding "pid" key histogram (but I think we should have better way to test it)
2) No, in that case you should use "/bin/echo -e" explicitly. dash's built-in echo doesn't support it.
Quoted 2 lines
Is it simple to provide two implementations of echo?(built-in echo and echo command?) and then just apply echo command for kprobe_syntax_errors.tc?
Hmm, OK, there might be another reason we reconsider this patch.
- Alisasing echo (this patch) can avoid dash related issues but this also makes "echo" running in another process implicitly.
- Using /bin/echo for backslash explicitly will be missed unless user runs it on dash, but it will keep "echo" in same process.
So both have pros/cons, but your idea will be locally effected. OK, I'll retry it.
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
RE: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
From: Masami Hiramatsu
Quoted 1 line
Sent: 11 May 2020 10:28
...
Quoted 14 lines
Quoted 5 lines
We may not avoid fixing related failures after your change:
1) We have to reuse built-in echo (do alias echo=echo) if we want to testcommon_pidfor histogram.
2) We have to reuse built-in echo if some new tests want to interpret backslash escapes in future.1) yes, that's what I need to do for avoiding "pid" key histogram (but I think we should have better way to test it)
2) No, in that case you should use "/bin/echo-e" explicitly. dash's built-in echo doesn't support it.Quoted 2 lines
Is it simple to provide two implementations of echo?(built-in echo and echo command?) and then just apply echo command for kprobe_syntax_errors.tc?
Quoted 7 lines
Hmm, OK, there might be another reason we reconsider this patch.
- Alisasing echo (this patch) can avoid dash related issues but this also makes "echo" running in another process implicitly.
- Using
/bin/echofor backslash explicitly will be missed unless user runs it on dash, but it will keep "echo" in same process.
Why not change to use printf - probably a builtin in both shells?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Masami Hiramatsu
maintainerPATCH 1/1 selftests/ftrace: Use /bin/echo for backslash included command
In reply to Masami HiramatsuSince the built-in echo has different behavior in POSIX shell (dash) and bash, kprobe_syntax_errors.tc can fail on dash which interpret backslash escape automatically.
To fix this issue, we explicitly use /bin/echo -E (not interpret backslash escapes) if the command string can include backslash.
--- tools/testing/selftests/ftrace/test.d/functions | 8 +++++--- .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/test.d/functions +5 -3
@@ -119,12 +119,14 @@ yield() { ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1 } +# Since probe event command may include backslash, explicitly use /bin/echo -E +# to NOT interpret it. ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file - pos=$(echo -n "${2%^*}" | wc -c) # error position - command=$(echo "$2" | tr -d ^) + pos=$(/bin/echo -En "${2%^*}" | wc -c) # error position + command=$(/bin/echo -E "$2" | tr -d ^) echo "Test command: $command" echo > error_log - (! echo "$command" >> "$3" ) 2> /dev/null + (! /bin/echo -E "$command" >> "$3" ) 2> /dev/null grep "$1: error:" -A 3 error_log N=$(tail -n 1 error_log | wc -c) # " Command: " and "^\n" => 13
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +3 -1
@@ -91,7 +91,9 @@ esac if grep -q "Create/append/" README && grep -q "imm-value" README; then echo 'p:kprobes/testevent _do_fork' > kprobe_events check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE -echo 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events + +# Explicitly use /bin/echo -E to not interpret \1 +/bin/echo -E 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events check_error 'p:kprobes/testevent _do_fork ^bcd=\1' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\1:u8' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\"foo"' # DIFF_ARG_TYPE
Re: [PATCH] selftests/ftrace: Use /bin/echo for backslash included command
Quoted 2 lines · Masami Hiramatsu
To fix this issue, we explicitly use
/bin/echo-E (not interpret backslash escapes) if the command string can include backslash.
Please use printf instead.
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Masami Hiramatsu
maintainerPATCH v2 1/1 selftests/ftrace: Use printf for backslash included command
Since the built-in echo has different behavior in POSIX shell (dash) and bash, kprobe_syntax_errors.tc can fail on dash which interpret backslash escape automatically.
To fix this issue, we explicitly use printf "%s" (not interpret backslash escapes) if the command string can include backslash.
--- tools/testing/selftests/ftrace/test.d/functions | 8 +++++--- .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/test.d/functions +5 -3
@@ -119,12 +119,14 @@ yield() { ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1 } +# Since probe event command may include backslash, explicitly use printf "%s" +# to NOT interpret it. ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file - pos=$(echo -n "${2%^*}" | wc -c) # error position - command=$(echo "$2" | tr -d ^) + pos=$(printf "%s" "${2%^*}" | wc -c) # error position + command=$(printf "%s" "$2" | tr -d ^) echo "Test command: $command" echo > error_log - (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/null grep "$1: error:" -A 3 error_log N=$(tail -n 1 error_log | wc -c) # " Command: " and "^\n" => 13
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +3 -1
@@ -91,7 +91,9 @@ esac if grep -q "Create/append/" README && grep -q "imm-value" README; then echo 'p:kprobes/testevent _do_fork' > kprobe_events check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE -echo 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events + +# Explicitly use printf "%s" to not interpret \1 +printf "%s" 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events check_error 'p:kprobes/testevent _do_fork ^bcd=\1' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\1:u8' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\"foo"' # DIFF_ARG_TYPE
Masami Hiramatsu
maintainerRe: [PATCH v2] selftests/ftrace: Use printf for backslash included command
Hi Andreas and David,
OK, what about this fix?
Quoted 53 lines · On Mon, 11 May 2020 22:36:27 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the built-in echo has different behavior in POSIX shell (dash) and bash, kprobe_syntax_errors.tc can fail on dash which interpret backslash escape automatically.
To fix this issue, we explicitly use printf "%s" (not interpret backslash escapes) if the command string can include backslash.
Reported-by Liu Yiding <[email protected]>Suggested-by Xiao Yang <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 8 +++++--- .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-)tools/testing/selftests/ftrace/test.d/functions +5
-3@@ -119,12 +119,14 @@ yield() { ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1 } +# Since probe event command may include backslash, explicitly use printf "%s" +# to NOT interpret it. ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file - pos=$(echo -n "${2%^*}" | wc -c) # error position - command=$(echo "$2" | tr -d ^) + pos=$(printf "%s" "${2%^*}" | wc -c) # error position + command=$(printf "%s" "$2" | tr -d ^) echo "Test command: $command" echo > error_log - (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/null grep "$1: error:" -A 3 error_log N=$(tail -n 1 error_log | wc -c) # " Command: " and "^\n" => 13tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +3
-1@@ -91,7 +91,9 @@ esac if grep -q "Create/append/" README && grep -q "imm-value" README; then echo 'p:kprobes/testevent _do_fork' > kprobe_events check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE -echo 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events + +# Explicitly use printf "%s" to not interpret \1 +printf "%s" 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events check_error 'p:kprobes/testevent _do_fork ^bcd=\1' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\1:u8' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\"foo"' # DIFF_ARG_TYPE
Signature · 1 line
Masami Hiramatsu <[email protected]>
RE: [PATCH v2] selftests/ftrace: Use printf for backslash included command
From: Masami Hiramatsu
Quoted 5 lines
Sent: 11 May 2020 14:38
Hi Andreas and David,
OK, what about this fix?
No idea what it is trying to do or why.
Just a way of avoiding the differences between SYSV and BSD /bin/echo.
IIRC Posix allows both behaviours (and probably others).
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Masami Hiramatsu
maintainerRe: [PATCH v2] selftests/ftrace: Use printf for backslash included command
Quoted 11 lines · On Mon, 11 May 2020 13:46:35 +0000 David Laight <[email protected]> wrote:
From: Masami Hiramatsu
Quoted 5 lines
Sent: 11 May 2020 14:38
Hi Andreas and David,
OK, what about this fix?
No idea what it is trying to do or why.
Just a way of avoiding the differences between SYSV and BSD/bin/echo.IIRC Posix allows both behaviours (and probably others).
Ah, I got it. That's why POSIX said "the results are implementation-defined."
https://pubs.opengroup.org/onlinepubs/009695399/utilities/echo.html
Thank you!
Signature · 1 line
Masami Hiramatsu <[email protected]>
RE: [PATCH v2] selftests/ftrace: Use printf for backslash included command
In reply to Masami HiramatsuQuoted 2 lines
tools/testing/selftests/ftrace/test.d/functions yield() { · line 126
Quoted 2 lines
tools/testing/selftests/ftrace/test.d/functions +2
-0+ pos=$(printf "%s" "${2%^*}" | wc -c) # error position + command=$(printf "%s" "$2" | tr -d ^)
You may want to put all the $(...) inside "" to avoid field splitting (not relevant to a shell assignment with modern shells) and filename globbing.
Quoted 4 lines
tools/testing/selftests/ftrace/test.d/functions yield() { · line 129
Quoted 4 lines
echo "Test command: $command"
echo >error_logtools/testing/selftests/ftrace/test.d/functions +1
-1- (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/null
WTF is the (! for ??
The (...) is a subshell.
And ! inverts the exit status.
Neither is needed at all.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Steven Rostedt
maintainerRe: [PATCH v2] selftests/ftrace: Use printf for backslash included command
Quoted 9 lines · On Mon, 11 May 2020 14:59:20 +0000 David Laight <[email protected]> wrote:
Quoted 4 lines
tools/testing/selftests/ftrace/test.d/functions yield() { · line 129
Quoted 4 lines
echo "Test command: $command"
echo >error_logtools/testing/selftests/ftrace/test.d/functions +1
-1- (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/nullWTF is the (! for ??
The (...) is a subshell. And ! inverts the exit status. Neither is needed at all.
This is done because the scripts are run with '-e' and will exit the script on any error.
This particular test is examining errors in the error log. The command being written into $3 is going to fail, and return an exit code. The "(! ..)" is needed, otherwise that failure will exit out the script.
-- Steve
Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command
In reply to Masami Hiramatsutools/testing/selftests/ftrace/test.d/functions yield() { · line 129
Quoted 2 lines · Masami Hiramatsu
tools/testing/selftests/ftrace/test.d/functions +1
-1- (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/null
printf %s does not print a newline, you need printf '%s\n' for that.
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Masami Hiramatsu
maintainerRe: [PATCH v2] selftests/ftrace: Use printf for backslash included command
Quoted 6 lines · On Mon, 11 May 2020 15:42:10 +0200 Andreas Schwab <[email protected]> wrote:
tools/testing/selftests/ftrace/test.d/functions yield() { · line 129
Quoted 2 lines · Masami Hiramatsu
tools/testing/selftests/ftrace/test.d/functions +1
-1- (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/nullprintf %s does not print a newline, you need printf '%s\n' for that.
Actually, ftrace doesn't need newline for single command. The reason why we had used echo instead of "echo -n" here, is just for short typing :)
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
Masami Hiramatsu
maintainerRe: [PATCH v2] selftests/ftrace: Use printf for backslash included command
In reply to Masami HiramatsuHi Shuah,
Could you pick this to kselftest-next?
Thank you,
Quoted 53 lines · On Mon, 11 May 2020 22:36:27 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the built-in echo has different behavior in POSIX shell (dash) and bash, kprobe_syntax_errors.tc can fail on dash which interpret backslash escape automatically.
To fix this issue, we explicitly use printf "%s" (not interpret backslash escapes) if the command string can include backslash.
Reported-by Liu Yiding <[email protected]>Suggested-by Xiao Yang <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 8 +++++--- .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-)tools/testing/selftests/ftrace/test.d/functions +5
-3@@ -119,12 +119,14 @@ yield() { ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1 } +# Since probe event command may include backslash, explicitly use printf "%s" +# to NOT interpret it. ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file - pos=$(echo -n "${2%^*}" | wc -c) # error position - command=$(echo "$2" | tr -d ^) + pos=$(printf "%s" "${2%^*}" | wc -c) # error position + command=$(printf "%s" "$2" | tr -d ^) echo "Test command: $command" echo > error_log - (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/null grep "$1: error:" -A 3 error_log N=$(tail -n 1 error_log | wc -c) # " Command: " and "^\n" => 13tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +3
-1@@ -91,7 +91,9 @@ esac if grep -q "Create/append/" README && grep -q "imm-value" README; then echo 'p:kprobes/testevent _do_fork' > kprobe_events check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE -echo 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events + +# Explicitly use printf "%s" to not interpret \1 +printf "%s" 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events check_error 'p:kprobes/testevent _do_fork ^bcd=\1' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\1:u8' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\"foo"' # DIFF_ARG_TYPE
Signature · 1 line
Masami Hiramatsu <[email protected]>
Shuah Khan
maintainerRe: [PATCH v2] selftests/ftrace: Use printf for backslash included command
Quoted 54 lines · Masami Hiramatsu
Hi Shuah,
Could you pick this to kselftest-next?
Thank you,
Quoted 45 lines · On Mon, 11 May 2020 22:36:27 +0900 Masami Hiramatsu <[email protected]> wrote:
Since the built-in echo has different behavior in POSIX shell (dash) and bash, kprobe_syntax_errors.tc can fail on dash which interpret backslash escape automatically.
To fix this issue, we explicitly use printf "%s" (not interpret backslash escapes) if the command string can include backslash.
Reported-by Liu Yiding <[email protected]>Suggested-by Xiao Yang <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/test.d/functions | 8 +++++--- .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-)tools/testing/selftests/ftrace/test.d/functions +5
-3@@ -119,12 +119,14 @@ yield() { ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1 } +# Since probe event command may include backslash, explicitly use printf "%s" +# to NOT interpret it. ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file - pos=$(echo -n "${2%^*}" | wc -c) # error position - command=$(echo "$2" | tr -d ^) + pos=$(printf "%s" "${2%^*}" | wc -c) # error position + command=$(printf "%s" "$2" | tr -d ^) echo "Test command: $command" echo > error_log - (! echo "$command" >> "$3" ) 2> /dev/null + (! printf "%s" "$command" >> "$3" ) 2> /dev/null grep "$1: error:" -A 3 error_log N=$(tail -n 1 error_log | wc -c) # " Command: " and "^\n" => 13tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +0
-0@@ -91,7 +91,9 @@ esac if grep -q "Create/append/" README && grep -q "imm-value" README; then echo 'p:kprobes/testevent _do_fork' > kprobe_events check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE
Quoted 10 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc esac · line 99
Quoted 8 lines
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +3
-1-echo 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events + +# Explicitly use printf "%s" to not interpret \1 +printf "%s" 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events check_error 'p:kprobes/testevent _do_fork ^bcd=\1' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\1:u8' # DIFF_ARG_TYPE check_error 'p:kprobes/testevent _do_fork ^abcd=\"foo"' # DIFF_ARG_TYPE
Applied to
git.kernel.org/pub/scm/linux/kernel/git/shuah/linux kselftest.git/ next branch for Linux 5.8-rc1
thanks,
-- Shuah
Re: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
In reply to Masami HiramatsuQuoted 3 lines · Masami Hiramatsu
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.
How about using printf instead (at least where it matters)?
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Masami Hiramatsu
maintainerRe: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Quoted 7 lines · On Thu, 07 May 2020 11:22:28 +0200 Andreas Schwab <[email protected]> wrote:
Quoted 3 lines · Masami Hiramatsu
Since the built-in echo has different behavior in POSIX shell (dash) and bash, we forcibly use
/bin/echo-E (not interpret backslash escapes) by default.How about using printf instead (at least where it matters)?
Hmm, I think replacing all echos with printf in the testcase might be much harder than this...
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
Steven Rostedt
maintainer[ FYI, Shuah responds better from her linuxfoundation.org email ]
Shuah,
Feel free to take the first two patches of this series (I acked one, and reviewed the other).
The last patch I had some issues with, and is still under discussion.
Thanks!
-- Steve
Quoted 28 lines · On Fri, 1 May 2020 22:37:31 +0900 Masami Hiramatsu <[email protected]> wrote:
Hi,
Here are some patches to update ftracetest to fix some issues.
- [1/3] Fix coloring of XFAIL
- [2/3] Fix a testcase not to expect just one event entry
- [3/3] Do not use built-in echo because the behavior is different on dash and bash. (Thanks Liu for reporting!)Thank you,
---
Masami Hiramatsu (3):
selftests/ftrace: Make XFAIL green color selftests/ftrace: Pick only the first kprobe event to test selftests/ftrace: Use/bin/echoinstead of built-in echotools/testing/selftests/ftrace/ftracetest | 2 +- tools/testing/selftests/ftrace/test.d/functions | 3 +++ .../ftrace/test.d/kprobe/kprobe_args_type.tc | 2 +- .../test.d/trigger/trigger-trace-marker-hist.tc | 2 +- .../trigger-trace-marker-synthetic-kernel.tc | 4 ++++ .../trigger/trigger-trace-marker-synthetic.tc | 4 ++-- 6 files changed, 12 insertions(+), 5 deletions(-)--
Masami Hiramatsu (Linaro) <[email protected]>
Shuah Khan
maintainerQuoted 5 lines · Steven Rostedt
[ FYI, Shuah responds better from her linuxfoundation.org email ]
Shuah,
Quoted 9 lines
Feel free to take the first two patches of this series (I acked one, and reviewed the other).
The last patch I had some issues with, and is still under discussion.
Thanks!
-- Steve
Will apply the first two.
thanks,
-- Shuah