diff mbox series

[BUGFIX,v4,2/4] selftests/ftrace: Fix ftrace test cases to check unsupported

Message ID 157475726452.3389.3778488615487716476.stgit@devnote2 (mailing list archive)
State New
Headers show
Series selftests/ftrace: Fix ftracetest testcases for non-function tracer case | expand

Commit Message

Masami Hiramatsu (Google) Nov. 26, 2019, 8:34 a.m. UTC
Since dynamic function tracer can be disabled, set_ftrace_filter
can be disappeared. Test cases which depends on it, must check
whether the set_ftrace_filter exists or not before testing
and if not, return as unsupported.

Also, if the function tracer itself is disabled, we can not
set "function" to current_tracer. Test cases must check it
before testing, and return as unsupported.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 .../ftrace/test.d/ftrace/func-filter-stacktrace.tc |    2 ++
 .../selftests/ftrace/test.d/ftrace/func_cpumask.tc |    5 +++++
 2 files changed, 7 insertions(+)

Comments

Steven Rostedt Nov. 26, 2019, 5:49 p.m. UTC | #1
On Tue, 26 Nov 2019 17:34:24 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
> @@ -15,6 +15,11 @@ if [ $NP -eq 1 ] ;then
>    exit_unresolved
>  fi
>  
> +if ! grep -q function available_tracers ; then
> +  echo "Function trace is not enabled"
> +  exit_unsupported
> +fi
> +
>  ORIG_CPUMASK=`cat tracing_cpumask`

Strange, but the bashism test failed:

++ checkbashisms /work/git-local/linux.git/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
possible bashism in /work/git-local/linux.git/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc line 18 ('function' is useless):
if ! grep -q function available_tracers ; then

Not sure why it did not like that line. Maybe my bashism check got
confused by the key word "function"?

Yep!

By adding quotes around "function" it doesn't complain:

	if ! grep -q "function" available_tracers ; then

May need to add that.

-- Steve
Masami Hiramatsu (Google) Nov. 26, 2019, 11:31 p.m. UTC | #2
On Tue, 26 Nov 2019 12:49:01 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 26 Nov 2019 17:34:24 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
> > @@ -15,6 +15,11 @@ if [ $NP -eq 1 ] ;then
> >    exit_unresolved
> >  fi
> >  
> > +if ! grep -q function available_tracers ; then
> > +  echo "Function trace is not enabled"
> > +  exit_unsupported
> > +fi
> > +
> >  ORIG_CPUMASK=`cat tracing_cpumask`
> 
> Strange, but the bashism test failed:
> 
> ++ checkbashisms /work/git-local/linux.git/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
> possible bashism in /work/git-local/linux.git/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc line 18 ('function' is useless):
> if ! grep -q function available_tracers ; then
> 
> Not sure why it did not like that line. Maybe my bashism check got
> confused by the key word "function"?
> 
> Yep!
> 
> By adding quotes around "function" it doesn't complain:
> 
> 	if ! grep -q "function" available_tracers ; then
> 
> May need to add that.

Thanks! Shuah, can I update this patch?
I'll send it asap.

Thank you,
Shuah Nov. 26, 2019, 11:50 p.m. UTC | #3
On 11/26/19 4:31 PM, Masami Hiramatsu wrote:
> On Tue, 26 Nov 2019 12:49:01 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
>> On Tue, 26 Nov 2019 17:34:24 +0900
>> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>>
>>> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
>>> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
>>> @@ -15,6 +15,11 @@ if [ $NP -eq 1 ] ;then
>>>     exit_unresolved
>>>   fi
>>>   
>>> +if ! grep -q function available_tracers ; then
>>> +  echo "Function trace is not enabled"
>>> +  exit_unsupported
>>> +fi
>>> +
>>>   ORIG_CPUMASK=`cat tracing_cpumask`
>>
>> Strange, but the bashism test failed:
>>
>> ++ checkbashisms /work/git-local/linux.git/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
>> possible bashism in /work/git-local/linux.git/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc line 18 ('function' is useless):
>> if ! grep -q function available_tracers ; then
>>
>> Not sure why it did not like that line. Maybe my bashism check got
>> confused by the key word "function"?
>>
>> Yep!
>>
>> By adding quotes around "function" it doesn't complain:
>>
>> 	if ! grep -q "function" available_tracers ; then
>>
>> May need to add that.
> 
> Thanks! Shuah, can I update this patch?
> I'll send it asap.
> 
> Thank you,
> 

No worries. Take your time. I won't pull in until things settle down.
I noticed Steve gave you review comments.

thanks,
-- Shuah
Steven Rostedt Nov. 27, 2019, 2:15 a.m. UTC | #4
On Tue, 26 Nov 2019 16:50:54 -0700
shuah <shuah@kernel.org> wrote:

> No worries. Take your time. I won't pull in until things settle down.
> I noticed Steve gave you review comments.

Masami's last patch should be good to go.

Thanks Shuah,

-- Steve
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc
index 36fb59f886ea..1a52f2883fe0 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc
@@ -3,6 +3,8 @@ 
 # description: ftrace - stacktrace filter command
 # flags: instance
 
+[ ! -f set_ftrace_filter ] && exit_unsupported
+
 echo _do_fork:stacktrace >> set_ftrace_filter
 
 grep -q "_do_fork:stacktrace:unlimited" set_ftrace_filter
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
index 86a1f07ef2ca..7757b549f0b6 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
@@ -15,6 +15,11 @@  if [ $NP -eq 1 ] ;then
   exit_unresolved
 fi
 
+if ! grep -q function available_tracers ; then
+  echo "Function trace is not enabled"
+  exit_unsupported
+fi
+
 ORIG_CPUMASK=`cat tracing_cpumask`
 
 do_reset() {