linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Shuah Khan <shuah@kernel.org>, <linux-kselftest@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Tom Zanussi <tom.zanussi@linux.intel.com>,
	Li Philip <philip.li@intel.com>,
	Liu Yiding <yidingx.liu@intel.com>
Subject: Re: [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo
Date: Mon, 11 May 2020 15:22:25 +0800	[thread overview]
Message-ID: <5EB8FD31.9020906@cn.fujitsu.com> (raw)
In-Reply-To: <20200507181505.3e8369ee39f14d9c74ec986b@kernel.org>

On 2020/5/7 17:15, Masami Hiramatsu wrote:
> On Thu, 7 May 2020 14:45:16 +0800
> Xiao Yang<yangx.jy@cn.fujitsu.com>  wrote:
>
>> On 2020/5/1 21:38, Masami Hiramatsu 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<yidingx.liu@intel.com>
>>> Signed-off-by: Masami Hiramatsu<mhiramat@kernel.org>
>>> ---
>>>    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(-)
>>>
>>> diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
>>> index 5d4550591ff9..ea59b6ea2c3e 100644
>>> --- a/tools/testing/selftests/ftrace/test.d/functions
>>> +++ b/tools/testing/selftests/ftrace/test.d/functions
>>> @@ -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?
>
> 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
>
> Thank you,
>
>>
>> Best Regards,
>> Xiao Yang
>>
>>>
>>>    clear_trace() { # reset trace output
>>>        echo>   trace
>>> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc
>>> index ab6bedb25736..b3f70f53ee69 100644
>>> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc
>>> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc
>>> @@ -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"
>>> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc
>>> index 18b4d1c2807e..c1625d945f4d 100644
>>> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc
>>> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic-kernel.tc
>>> @@ -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
>>>
>>> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc
>>> index dd262d6d0db6..23e52c8d71de 100644
>>> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc
>>> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc
>>> @@ -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
>>>
>>>
>>>
>>> .
>>>
>>
>>
>>
>
>




  reply	other threads:[~2020-05-11  7:22 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 13:37 [PATCH 0/3] selftests/ftrace: Fix ftracetest testcases for dash, etc Masami Hiramatsu
2020-05-01 13:37 ` [PATCH 1/3] selftests/ftrace: Make XFAIL green color Masami Hiramatsu
2020-05-01 14:15   ` Steven Rostedt
2020-05-01 13:37 ` [PATCH 2/3] selftests/ftrace: Pick only the first kprobe event to test Masami Hiramatsu
2020-05-01 14:17   ` Steven Rostedt
2020-05-01 15:38     ` shuah
2020-05-01 16:20       ` Steven Rostedt
2020-05-01 16:30         ` Shuah Khan
2020-05-02  3:05       ` Masami Hiramatsu
2020-05-01 13:38 ` [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo Masami Hiramatsu
2020-05-01 14:19   ` Steven Rostedt
2020-05-02  3:08     ` Masami Hiramatsu
2020-05-07 13:12       ` Steven Rostedt
2020-05-07 15:50         ` Masami Hiramatsu
2020-05-07 17:25           ` Steven Rostedt
2020-05-07 20:32             ` Zanussi, Tom
2020-05-08  7:11               ` Masami Hiramatsu
2020-05-07  6:45   ` Xiao Yang
2020-05-07  9:15     ` Masami Hiramatsu
2020-05-11  7:22       ` Xiao Yang [this message]
2020-05-11  9:27         ` Masami Hiramatsu
2020-05-11 10:34           ` David Laight
2020-05-11 12:01           ` [PATCH] selftests/ftrace: Use /bin/echo for backslash included command Masami Hiramatsu
2020-05-11 12:19             ` Andreas Schwab
2020-05-11 13:36               ` [PATCH v2] selftests/ftrace: Use printf " Masami Hiramatsu
2020-05-11 13:38                 ` Masami Hiramatsu
2020-05-11 13:46                   ` David Laight
2020-05-11 14:05                     ` Masami Hiramatsu
2020-05-11 14:59                   ` David Laight
2020-05-11 20:28                     ` Steven Rostedt
2020-05-11 13:42                 ` Andreas Schwab
2020-05-11 13:58                   ` Masami Hiramatsu
2020-05-25  9:59                 ` Masami Hiramatsu
2020-05-28 16:24                   ` Shuah Khan
2020-05-07  9:22   ` [PATCH 3/3] selftests/ftrace: Use /bin/echo instead of built-in echo Andreas Schwab
2020-05-07 15:52     ` Masami Hiramatsu
2020-05-01 14:21 ` [PATCH 0/3] selftests/ftrace: Fix ftracetest testcases for dash, etc Steven Rostedt
2020-05-01 14:28   ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5EB8FD31.9020906@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=philip.li@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=tom.zanussi@linux.intel.com \
    --cc=yidingx.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).