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 <yangx.jy@cn.fujitsu.com> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
b87080eab4
commit
16bcd0f509
@ -10,10 +10,7 @@ if ! grep -q function_graph available_tracers; then
|
||||
exit_unsupported
|
||||
fi
|
||||
|
||||
if [ ! -f set_ftrace_filter ]; then
|
||||
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
|
||||
exit_unsupported
|
||||
fi
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
do_reset() {
|
||||
if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then
|
||||
|
@ -9,6 +9,8 @@ if ! grep -q function_graph available_tracers; then
|
||||
exit_unsupported
|
||||
fi
|
||||
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
fail() { # msg
|
||||
echo $1
|
||||
exit_fail
|
||||
|
@ -9,6 +9,8 @@ if ! grep -q function available_tracers; then
|
||||
exit_unsupported
|
||||
fi
|
||||
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
disable_tracing
|
||||
clear_trace
|
||||
|
||||
|
@ -15,10 +15,7 @@ if [ ! -f set_ftrace_notrace_pid ]; then
|
||||
exit_unsupported
|
||||
fi
|
||||
|
||||
if [ ! -f set_ftrace_filter ]; then
|
||||
echo "set_ftrace_filter not found? Is function tracer not set?"
|
||||
exit_unsupported
|
||||
fi
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
do_function_fork=1
|
||||
|
||||
|
@ -16,10 +16,7 @@ if [ ! -f set_ftrace_pid ]; then
|
||||
exit_unsupported
|
||||
fi
|
||||
|
||||
if [ ! -f set_ftrace_filter ]; then
|
||||
echo "set_ftrace_filter not found? Is function tracer not set?"
|
||||
exit_unsupported
|
||||
fi
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
do_function_fork=1
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# description: ftrace - stacktrace filter command
|
||||
# flags: instance
|
||||
|
||||
[ ! -f set_ftrace_filter ] && exit_unsupported
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
echo _do_fork:stacktrace >> set_ftrace_filter
|
||||
|
||||
|
@ -11,10 +11,7 @@
|
||||
#
|
||||
|
||||
# The triggers are set within the set_ftrace_filter file
|
||||
if [ ! -f set_ftrace_filter ]; then
|
||||
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
|
||||
exit_unsupported
|
||||
fi
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
do_reset() {
|
||||
reset_ftrace_filter
|
||||
|
@ -2,7 +2,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# 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"
|
||||
echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter
|
||||
|
@ -18,10 +18,7 @@ if ! grep -q function_graph available_tracers; then
|
||||
exit_unsupported;
|
||||
fi
|
||||
|
||||
if [ ! -f set_ftrace_filter ]; then
|
||||
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
|
||||
exit_unsupported
|
||||
fi
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
if [ ! -f function_profile_enabled ]; then
|
||||
echo "function_profile_enabled not found, function profiling enabled?"
|
||||
|
@ -10,10 +10,7 @@
|
||||
#
|
||||
|
||||
# The triggers are set within the set_ftrace_filter file
|
||||
if [ ! -f set_ftrace_filter ]; then
|
||||
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
|
||||
exit_unsupported
|
||||
fi
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
fail() { # mesg
|
||||
echo $1
|
||||
|
@ -8,6 +8,8 @@ if [ ! -f stack_trace ]; then
|
||||
exit_unsupported
|
||||
fi
|
||||
|
||||
check_filter_file stack_trace_filter
|
||||
|
||||
echo > stack_trace_filter
|
||||
echo 0 > stack_max_size
|
||||
echo 1 > /proc/sys/kernel/stack_tracer_enabled
|
||||
|
@ -11,10 +11,7 @@
|
||||
#
|
||||
|
||||
# The triggers are set within the set_ftrace_filter file
|
||||
if [ ! -f set_ftrace_filter ]; then
|
||||
echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
|
||||
exit_unsupported
|
||||
fi
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
fail() { # mesg
|
||||
echo $1
|
||||
|
@ -1,3 +1,9 @@
|
||||
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
|
||||
echo > trace
|
||||
|
@ -5,6 +5,8 @@
|
||||
[ -f kprobe_events ] || exit_unsupported # this is configurable
|
||||
grep "function" available_tracers || exit_unsupported # this is configurable
|
||||
|
||||
check_filter_file set_ftrace_filter
|
||||
|
||||
# prepare
|
||||
echo nop > current_tracer
|
||||
echo _do_fork > set_ftrace_filter
|
||||
|
Loading…
x
Reference in New Issue
Block a user