Skip to contentSkip to conversation

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

PATCH In review Steven Rostedt 2 participants 4 messages May 15, 2024 – Aug 21, 2024

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

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

From: "Steven Rostedt (Google)" <[email protected]>

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()")
---
 .../ftrace/test.d/ftrace/func_set_ftrace_file.tc         | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc +8 -1
index 073a748b9380..263f6b798c85 100644
@@ -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 ####"
 
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

Shuah,

Can you take this through your tree?

Thanks,

-- Steve

Quoted 36 lines · On Wed, 15 May 2024 01:36:20 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Google)" <[email protected]>

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()")
---
 .../ftrace/test.d/ftrace/func_set_ftrace_file.tc         | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc +8 -1
index 073a748b9380..263f6b798c85 100644
@@ -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 ####"
 
author maintainer
#2 lore raw
Quoted 3 lines · On Fri, 14 Jun 2024 12:43:22 -0400 Steven Rostedt <[email protected]> wrote:

Shuah,

Can you take this through your tree?

Ping.

-- Steve

Quoted 46 lines

Thanks,

-- Steve

Quoted 36 lines · On Wed, 15 May 2024 01:36:20 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Google)" <[email protected]>

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()")
---
 .../ftrace/test.d/ftrace/func_set_ftrace_file.tc         | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc +8 -1
index 073a748b9380..263f6b798c85 100644
@@ -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 ####"
 
maintainer
#3 lore raw
Quoted 32 lines · Steven Rostedt
Quoted 3 lines · On Fri, 14 Jun 2024 12:43:22 -0400 Steven Rostedt <[email protected]> wrote:

Shuah,

Can you take this through your tree?

Ping.

-- Steve

Quoted 21 lines

Thanks,

-- Steve

Quoted 12 lines · On Wed, 15 May 2024 01:36:20 -0400 Steven Rostedt <[email protected]> wrote:

From: "Steven Rostedt (Google)" <[email protected]>

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()")

Sorry about the delay.

It is now applied to liniux-kselftest next for Linux 6.12-rc1.

thanks,
-- Shuah