Skip to content

Commit 16bcd0f

Browse files
yangx-jyshuahkh
authored andcommitted
selftests/ftrace: Check required filter files before running test
Without CONFIG_DYNAMIC_FTRACE, some tests get failure because required filter files(set_ftrace_filter/available_filter_functions/stack_trace_filter) are missing. So implement check_filter_file() and make all related tests check required filter files by it. BTW: set_ftrace_filter and available_filter_functions are introduced together so just check either of them. Signed-off-by: Xiao Yang <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent b87080e commit 16bcd0f

14 files changed

+23
-30
lines changed

tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ if ! grep -q function_graph available_tracers; then
1010
exit_unsupported
1111
fi
1212

13-
if [ ! -f set_ftrace_filter ]; then
14-
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
15-
exit_unsupported
16-
fi
13+
check_filter_file set_ftrace_filter
1714

1815
do_reset() {
1916
if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then

tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ if ! grep -q function_graph available_tracers; then
99
exit_unsupported
1010
fi
1111

12+
check_filter_file set_ftrace_filter
13+
1214
fail() { # msg
1315
echo $1
1416
exit_fail

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ if ! grep -q function available_tracers; then
99
exit_unsupported
1010
fi
1111

12+
check_filter_file set_ftrace_filter
13+
1214
disable_tracing
1315
clear_trace
1416

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ if [ ! -f set_ftrace_notrace_pid ]; then
1515
exit_unsupported
1616
fi
1717

18-
if [ ! -f set_ftrace_filter ]; then
19-
echo "set_ftrace_filter not found? Is function tracer not set?"
20-
exit_unsupported
21-
fi
18+
check_filter_file set_ftrace_filter
2219

2320
do_function_fork=1
2421

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ if [ ! -f set_ftrace_pid ]; then
1616
exit_unsupported
1717
fi
1818

19-
if [ ! -f set_ftrace_filter ]; then
20-
echo "set_ftrace_filter not found? Is function tracer not set?"
21-
exit_unsupported
22-
fi
19+
check_filter_file set_ftrace_filter
2320

2421
do_function_fork=1
2522

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# description: ftrace - stacktrace filter command
44
# flags: instance
55

6-
[ ! -f set_ftrace_filter ] && exit_unsupported
6+
check_filter_file set_ftrace_filter
77

88
echo _do_fork:stacktrace >> set_ftrace_filter
99

tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
#
1212

1313
# The triggers are set within the set_ftrace_filter file
14-
if [ ! -f set_ftrace_filter ]; then
15-
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
16-
exit_unsupported
17-
fi
14+
check_filter_file set_ftrace_filter
1815

1916
do_reset() {
2017
reset_ftrace_filter

tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: GPL-2.0
33
# description: ftrace - function trace on module
44

5-
[ ! -f set_ftrace_filter ] && exit_unsupported
5+
check_filter_file set_ftrace_filter
66

77
: "mod: allows to filter a non exist function"
88
echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter

tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ if ! grep -q function_graph available_tracers; then
1818
exit_unsupported;
1919
fi
2020

21-
if [ ! -f set_ftrace_filter ]; then
22-
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
23-
exit_unsupported
24-
fi
21+
check_filter_file set_ftrace_filter
2522

2623
if [ ! -f function_profile_enabled ]; then
2724
echo "function_profile_enabled not found, function profiling enabled?"

tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
#
1111

1212
# The triggers are set within the set_ftrace_filter file
13-
if [ ! -f set_ftrace_filter ]; then
14-
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
15-
exit_unsupported
16-
fi
13+
check_filter_file set_ftrace_filter
1714

1815
fail() { # mesg
1916
echo $1

0 commit comments

Comments
 (0)