diff mbox series

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

Message ID 157457134852.25666.7660419621672440723.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. 24, 2019, 4:55 a.m. UTC
Since function tracer can be disabled, set_ftrace_filter can be
disappeared. The test cases must check whether the set_ftrace_filter
exists or not before testing and if not, return it as unsupported.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.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. 24, 2019, 9:39 p.m. UTC | #1
On Sun, 24 Nov 2019 13:55:48 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Since function tracer can be disabled, set_ftrace_filter can be
> disappeared. The test cases must check whether the set_ftrace_filter
> exists or not before testing and if not, return it as unsupported.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  .../ftrace/test.d/ftrace/func-filter-stacktrace.tc |    2 ++
>  .../selftests/ftrace/test.d/ftrace/func_cpumask.tc |    5 +++++
>  2 files changed, 7 insertions(+)
> 
> 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

This change is not described in the change log.

-- Steve

> +
>  ORIG_CPUMASK=`cat tracing_cpumask`
>  
>  do_reset() {
Masami Hiramatsu (Google) Nov. 24, 2019, 11:36 p.m. UTC | #2
On Sun, 24 Nov 2019 16:39:57 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Sun, 24 Nov 2019 13:55:48 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > Since function tracer can be disabled, set_ftrace_filter can be
> > disappeared. The test cases must check whether the set_ftrace_filter
> > exists or not before testing and if not, return it as unsupported.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  .../ftrace/test.d/ftrace/func-filter-stacktrace.tc |    2 ++
> >  .../selftests/ftrace/test.d/ftrace/func_cpumask.tc |    5 +++++
> >  2 files changed, 7 insertions(+)
> > 
> > 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
> 
> This change is not described in the change log.

Oops, my mistake. Thanks!

> 
> -- Steve
> 
> > +
> >  ORIG_CPUMASK=`cat tracing_cpumask`
> >  
> >  do_reset() {
>
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() {