Commit 74e60728 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Shuah Khan

selftests/ftrace: Convert check_filter_file() with requires list

Since check_filter_file() is basically checking the filter
tracefs file, we can convert it into requires list.
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 3591e90f
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function graph filters with stack tracer # description: ftrace - function graph filters with stack tracer
# requires: stack_trace # requires: stack_trace set_ftrace_filter
# Make sure that function graph filtering works, and is not # Make sure that function graph filtering works, and is not
# affected by other tracers enabled (like stack tracer) # affected by other tracers enabled (like stack tracer)
...@@ -11,8 +11,6 @@ if ! grep -q function_graph available_tracers; then ...@@ -11,8 +11,6 @@ if ! grep -q function_graph available_tracers; then
exit_unsupported exit_unsupported
fi fi
check_filter_file set_ftrace_filter
do_reset() { do_reset() {
if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then
echo 0 > /proc/sys/kernel/stack_tracer_enabled echo 0 > /proc/sys/kernel/stack_tracer_enabled
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function graph filters # description: ftrace - function graph filters
# requires: set_ftrace_filter
# Make sure that function graph filtering works # Make sure that function graph filtering works
...@@ -9,8 +10,6 @@ if ! grep -q function_graph available_tracers; then ...@@ -9,8 +10,6 @@ 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
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function glob filters # description: ftrace - function glob filters
# requires: set_ftrace_filter
# Make sure that function glob matching filter works. # Make sure that function glob matching filter works.
...@@ -9,8 +10,6 @@ if ! grep -q function available_tracers; then ...@@ -9,8 +10,6 @@ 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
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function pid notrace filters # description: ftrace - function pid notrace filters
# requires: set_ftrace_notrace_pid # requires: set_ftrace_notrace_pid set_ftrace_filter
# flags: instance # flags: instance
# Make sure that function pid matching filter with notrace works. # Make sure that function pid matching filter with notrace works.
...@@ -11,8 +11,6 @@ if ! grep -q function available_tracers; then ...@@ -11,8 +11,6 @@ if ! grep -q function available_tracers; then
exit_unsupported exit_unsupported
fi fi
check_filter_file set_ftrace_filter
do_function_fork=1 do_function_fork=1
if [ ! -f options/function-fork ]; then if [ ! -f options/function-fork ]; then
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function pid filters # description: ftrace - function pid filters
# requires: set_ftrace_pid # requires: set_ftrace_pid set_ftrace_filter
# flags: instance # flags: instance
# Make sure that function pid matching filter works. # Make sure that function pid matching filter works.
...@@ -12,8 +12,6 @@ if ! grep -q function available_tracers; then ...@@ -12,8 +12,6 @@ if ! grep -q function available_tracers; then
exit_unsupported exit_unsupported
fi fi
check_filter_file set_ftrace_filter
do_function_fork=1 do_function_fork=1
if [ ! -f options/function-fork ]; then if [ ! -f options/function-fork ]; then
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - stacktrace filter command # description: ftrace - stacktrace filter command
# requires: set_ftrace_filter
# flags: instance # flags: instance
check_filter_file set_ftrace_filter
echo _do_fork:stacktrace >> set_ftrace_filter echo _do_fork:stacktrace >> set_ftrace_filter
grep -q "_do_fork:stacktrace:unlimited" set_ftrace_filter grep -q "_do_fork:stacktrace:unlimited" set_ftrace_filter
......
...@@ -3,15 +3,14 @@ ...@@ -3,15 +3,14 @@
# description: ftrace - test for function event triggers # description: ftrace - test for function event triggers
# flags: instance # flags: instance
# #
# The triggers are set within the set_ftrace_filter file
# requires: set_ftrace_filter
#
# Ftrace allows to add triggers to functions, such as enabling or disabling # Ftrace allows to add triggers to functions, such as enabling or disabling
# tracing, enabling or disabling trace events, or recording a stack trace # tracing, enabling or disabling trace events, or recording a stack trace
# within the ring buffer. # within the ring buffer.
# #
# This test is designed to test event triggers # This test is designed to test event triggers
#
# The triggers are set within the set_ftrace_filter file
check_filter_file set_ftrace_filter
do_reset() { do_reset() {
reset_ftrace_filter reset_ftrace_filter
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function trace on module # description: ftrace - function trace on module
# requires: set_ftrace_filter
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
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function profiler with function tracing # description: ftrace - function profiler with function tracing
# requires: function_profile_enabled # requires: function_profile_enabled set_ftrace_filter
# There was a bug after a rewrite of the ftrace infrastructure that # There was a bug after a rewrite of the ftrace infrastructure that
# caused the function_profiler not to be able to run with the function # caused the function_profiler not to be able to run with the function
...@@ -19,8 +19,6 @@ if ! grep -q function_graph available_tracers; then ...@@ -19,8 +19,6 @@ if ! grep -q function_graph available_tracers; then
exit_unsupported; exit_unsupported;
fi fi
check_filter_file set_ftrace_filter
fail() { # mesg fail() { # mesg
echo $1 echo $1
exit_fail exit_fail
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - test reading of set_ftrace_filter # description: ftrace - test reading of set_ftrace_filter
# #
# The triggers are set within the set_ftrace_filter file
# requires: set_ftrace_filter
#
# The set_ftrace_filter file of ftrace is used to list functions as well as # The set_ftrace_filter file of ftrace is used to list functions as well as
# triggers (probes) attached to functions. The code to read this file is not # triggers (probes) attached to functions. The code to read this file is not
# straight forward and has had various bugs in the past. This test is designed # straight forward and has had various bugs in the past. This test is designed
...@@ -9,9 +12,6 @@ ...@@ -9,9 +12,6 @@
# file in various ways (cat vs dd). # file in various ways (cat vs dd).
# #
# The triggers are set within the set_ftrace_filter file
check_filter_file set_ftrace_filter
fail() { # mesg fail() { # mesg
echo $1 echo $1
exit_fail exit_fail
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - Max stack tracer # description: ftrace - Max stack tracer
# requires: stack_trace # requires: stack_trace stack_trace_filter
# Test the basic function of max-stack usage tracing # Test the basic function of max-stack usage tracing
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
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
# description: ftrace - test for function traceon/off triggers # description: ftrace - test for function traceon/off triggers
# flags: instance # flags: instance
# #
# The triggers are set within the set_ftrace_filter file
# requires: set_ftrace_filter
#
# Ftrace allows to add triggers to functions, such as enabling or disabling # Ftrace allows to add triggers to functions, such as enabling or disabling
# tracing, enabling or disabling trace events, or recording a stack trace # tracing, enabling or disabling trace events, or recording a stack trace
# within the ring buffer. # within the ring buffer.
...@@ -10,9 +13,6 @@ ...@@ -10,9 +13,6 @@
# This test is designed to test enabling and disabling tracing triggers # This test is designed to test enabling and disabling tracing triggers
# #
# The triggers are set within the set_ftrace_filter file
check_filter_file set_ftrace_filter
fail() { # mesg fail() { # mesg
echo $1 echo $1
exit_fail exit_fail
......
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
} }
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe dynamic event with function tracer # description: Kprobe dynamic event with function tracer
# requires: kprobe_events # requires: kprobe_events stack_trace_filter
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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment