diff mbox series

selftests/ftrace: Fix test to handle both old and new kernels

Message ID 20240515013620.098cb37a@rorschach.local.home
State Accepted
Commit c049acee3c71cfc26c739f82617a84e13e471a45
Headers show
Series selftests/ftrace: Fix test to handle both old and new kernels | expand

Commit Message

Steven Rostedt May 15, 2024, 5:36 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The function "scheduler_tick" was renamed to "sched_tick" and a selftest
that used that function for testing function trace filtering used that
function as part of the test.

But the change causes it to fail when run on older kernels. As tests
should not fail on older kernels, add a check to see which name is
available before testing.

Fixes: 86dd6c04ef9f2 ("sched/balancing: Rename scheduler_tick() => sched_tick()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../ftrace/test.d/ftrace/func_set_ftrace_file.tc         | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Steven Rostedt June 14, 2024, 4:43 p.m. UTC | #1
Shuah,

Can you take this through your tree?

Thanks,

-- Steve


On Wed, 15 May 2024 01:36:20 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The function "scheduler_tick" was renamed to "sched_tick" and a selftest
> that used that function for testing function trace filtering used that
> function as part of the test.
> 
> But the change causes it to fail when run on older kernels. As tests
> should not fail on older kernels, add a check to see which name is
> available before testing.
> 
> Fixes: 86dd6c04ef9f2 ("sched/balancing: Rename scheduler_tick() => sched_tick()")
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  .../ftrace/test.d/ftrace/func_set_ftrace_file.tc         | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> index 073a748b9380..263f6b798c85 100644
> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> @@ -19,7 +19,14 @@ fail() { # mesg
>  
>  FILTER=set_ftrace_filter
>  FUNC1="schedule"
> -FUNC2="sched_tick"
> +if grep '^sched_tick\b' available_filter_functions; then
> +    FUNC2="sched_tick"
> +elif grep '^scheduler_tick\b' available_filter_functions; then
> +    FUNC2="scheduler_tick"
> +else
> +    exit_unresolved
> +fi
> +
>  
>  ALL_FUNCS="#### all functions enabled ####"
>
Steven Rostedt Aug. 19, 2024, 7:20 p.m. UTC | #2
On Fri, 14 Jun 2024 12:43:22 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Shuah,
> 
> Can you take this through your tree?

Ping.

-- Steve

> 
> Thanks,
> 
> -- Steve
> 
> 
> On Wed, 15 May 2024 01:36:20 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> > From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> > 
> > The function "scheduler_tick" was renamed to "sched_tick" and a selftest
> > that used that function for testing function trace filtering used that
> > function as part of the test.
> > 
> > But the change causes it to fail when run on older kernels. As tests
> > should not fail on older kernels, add a check to see which name is
> > available before testing.
> > 
> > Fixes: 86dd6c04ef9f2 ("sched/balancing: Rename scheduler_tick() => sched_tick()")
> > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> > ---
> >  .../ftrace/test.d/ftrace/func_set_ftrace_file.tc         | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> > index 073a748b9380..263f6b798c85 100644
> > --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
> > @@ -19,7 +19,14 @@ fail() { # mesg
> >  
> >  FILTER=set_ftrace_filter
> >  FUNC1="schedule"
> > -FUNC2="sched_tick"
> > +if grep '^sched_tick\b' available_filter_functions; then
> > +    FUNC2="sched_tick"
> > +elif grep '^scheduler_tick\b' available_filter_functions; then
> > +    FUNC2="scheduler_tick"
> > +else
> > +    exit_unresolved
> > +fi
> > +
> >  
> >  ALL_FUNCS="#### all functions enabled ####"
> >    
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
index 073a748b9380..263f6b798c85 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc
@@ -19,7 +19,14 @@  fail() { # mesg
 
 FILTER=set_ftrace_filter
 FUNC1="schedule"
-FUNC2="sched_tick"
+if grep '^sched_tick\b' available_filter_functions; then
+    FUNC2="sched_tick"
+elif grep '^scheduler_tick\b' available_filter_functions; then
+    FUNC2="scheduler_tick"
+else
+    exit_unresolved
+fi
+
 
 ALL_FUNCS="#### all functions enabled ####"