提交 16bcd0f5 编写于 作者: X Xiao Yang 提交者: Shuah Khan

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: NXiao Yang <yangx.jy@cn.fujitsu.com>
Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
上级 b87080ea
...@@ -10,10 +10,7 @@ if ! grep -q function_graph available_tracers; then ...@@ -10,10 +10,7 @@ if ! grep -q function_graph available_tracers; then
exit_unsupported exit_unsupported
fi fi
if [ ! -f set_ftrace_filter ]; then check_filter_file set_ftrace_filter
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
exit_unsupported
fi
do_reset() { do_reset() {
if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then
......
...@@ -9,6 +9,8 @@ if ! grep -q function_graph available_tracers; then ...@@ -9,6 +9,8 @@ if ! grep -q function_graph available_tracers; then
exit_unsupported exit_unsupported
fi fi
check_filter_file set_ftrace_filter
fail() { # msg fail() { # msg
echo $1 echo $1
exit_fail exit_fail
......
...@@ -9,6 +9,8 @@ if ! grep -q function available_tracers; then ...@@ -9,6 +9,8 @@ if ! grep -q function available_tracers; then
exit_unsupported exit_unsupported
fi fi
check_filter_file set_ftrace_filter
disable_tracing disable_tracing
clear_trace clear_trace
......
...@@ -15,10 +15,7 @@ if [ ! -f set_ftrace_notrace_pid ]; then ...@@ -15,10 +15,7 @@ if [ ! -f set_ftrace_notrace_pid ]; then
exit_unsupported exit_unsupported
fi fi
if [ ! -f set_ftrace_filter ]; then check_filter_file set_ftrace_filter
echo "set_ftrace_filter not found? Is function tracer not set?"
exit_unsupported
fi
do_function_fork=1 do_function_fork=1
......
...@@ -16,10 +16,7 @@ if [ ! -f set_ftrace_pid ]; then ...@@ -16,10 +16,7 @@ if [ ! -f set_ftrace_pid ]; then
exit_unsupported exit_unsupported
fi fi
if [ ! -f set_ftrace_filter ]; then check_filter_file set_ftrace_filter
echo "set_ftrace_filter not found? Is function tracer not set?"
exit_unsupported
fi
do_function_fork=1 do_function_fork=1
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# description: ftrace - stacktrace filter command # description: ftrace - stacktrace filter command
# flags: instance # flags: instance
[ ! -f set_ftrace_filter ] && exit_unsupported check_filter_file set_ftrace_filter
echo _do_fork:stacktrace >> set_ftrace_filter echo _do_fork:stacktrace >> set_ftrace_filter
......
...@@ -11,10 +11,7 @@ ...@@ -11,10 +11,7 @@
# #
# The triggers are set within the set_ftrace_filter file # The triggers are set within the set_ftrace_filter file
if [ ! -f set_ftrace_filter ]; then check_filter_file set_ftrace_filter
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
exit_unsupported
fi
do_reset() { do_reset() {
reset_ftrace_filter reset_ftrace_filter
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function trace on module # description: ftrace - function trace on module
[ ! -f set_ftrace_filter ] && exit_unsupported check_filter_file set_ftrace_filter
: "mod: allows to filter a non exist function" : "mod: allows to filter a non exist function"
echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter
......
...@@ -18,10 +18,7 @@ if ! grep -q function_graph available_tracers; then ...@@ -18,10 +18,7 @@ if ! grep -q function_graph available_tracers; then
exit_unsupported; exit_unsupported;
fi fi
if [ ! -f set_ftrace_filter ]; then check_filter_file set_ftrace_filter
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
exit_unsupported
fi
if [ ! -f function_profile_enabled ]; then if [ ! -f function_profile_enabled ]; then
echo "function_profile_enabled not found, function profiling enabled?" echo "function_profile_enabled not found, function profiling enabled?"
......
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
# #
# The triggers are set within the set_ftrace_filter file # The triggers are set within the set_ftrace_filter file
if [ ! -f set_ftrace_filter ]; then check_filter_file set_ftrace_filter
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
exit_unsupported
fi
fail() { # mesg fail() { # mesg
echo $1 echo $1
......
...@@ -8,6 +8,8 @@ if [ ! -f stack_trace ]; then ...@@ -8,6 +8,8 @@ if [ ! -f stack_trace ]; then
exit_unsupported exit_unsupported
fi fi
check_filter_file stack_trace_filter
echo > stack_trace_filter echo > stack_trace_filter
echo 0 > stack_max_size echo 0 > stack_max_size
echo 1 > /proc/sys/kernel/stack_tracer_enabled echo 1 > /proc/sys/kernel/stack_tracer_enabled
......
...@@ -11,10 +11,7 @@ ...@@ -11,10 +11,7 @@
# #
# The triggers are set within the set_ftrace_filter file # The triggers are set within the set_ftrace_filter file
if [ ! -f set_ftrace_filter ]; then check_filter_file set_ftrace_filter
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
exit_unsupported
fi
fail() { # mesg fail() { # mesg
echo $1 echo $1
......
check_filter_file() { # check filter file introduced by dynamic ftrace
if [ ! -f "$1" ]; then
echo "$1 not found? Is dynamic ftrace not set?"
exit_unsupported
fi
}
clear_trace() { # reset trace output clear_trace() { # reset trace output
echo > trace echo > trace
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
grep "function" available_tracers || exit_unsupported # this is configurable grep "function" available_tracers || exit_unsupported # this is configurable
check_filter_file set_ftrace_filter
# prepare # prepare
echo nop > current_tracer echo nop > current_tracer
echo _do_fork > set_ftrace_filter echo _do_fork > set_ftrace_filter
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册