Commit 27c27605 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-kselftest-5.8-rc2' of...

Merge tag 'linux-kselftest-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest cleanups from Shuah Khan:

 - ftrace "requires:" list for simplifying and unifying requirement
   checks for each test case, adding "requires:" line instead of
   checking required ftrace interfaces in each test case.

 - a minor spelling correction patch

* tag 'linux-kselftest-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/ftrace: Support ":README" suffix for requires
  selftests/ftrace: Support ":tracer" suffix for requires
  selftests/ftrace: Convert check_filter_file() with requires list
  selftests/ftrace: Convert required interface checks into requires list
  selftests/ftrace: Add "requires:" list support
  selftests/ftrace: Return unsupported for the unconfigured features
  selftests/ftrace: Allow ":" in description
  tools: testing: ftrace: trigger: fix spelling mistake
parents 5481fc6e 1b8eec51
...@@ -263,10 +263,16 @@ CASENO=0 ...@@ -263,10 +263,16 @@ CASENO=0
testcase() { # testfile testcase() { # testfile
CASENO=$((CASENO+1)) CASENO=$((CASENO+1))
desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:` desc=`grep "^#[ \t]*description:" $1 | cut -f2- -d:`
prlog -n "[$CASENO]$INSTANCE$desc" prlog -n "[$CASENO]$INSTANCE$desc"
} }
checkreq() { # testfile
requires=`grep "^#[ \t]*requires:" $1 | cut -f2- -d:`
# Use eval to pass quoted-patterns correctly.
eval check_requires "$requires"
}
test_on_instance() { # testfile test_on_instance() { # testfile
grep -q "^#[ \t]*flags:.*instance" $1 grep -q "^#[ \t]*flags:.*instance" $1
} }
...@@ -356,7 +362,8 @@ trap 'SIG_RESULT=$XFAIL' $SIG_XFAIL ...@@ -356,7 +362,8 @@ trap 'SIG_RESULT=$XFAIL' $SIG_XFAIL
__run_test() { # testfile __run_test() { # testfile
# setup PID and PPID, $$ is not updated. # setup PID and PPID, $$ is not updated.
(cd $TRACING_DIR; read PID _ < /proc/self/stat; set -e; set -x; initialize_ftrace; . $1) (cd $TRACING_DIR; read PID _ < /proc/self/stat; set -e; set -x;
checkreq $1; initialize_ftrace; . $1)
[ $? -ne 0 ] && kill -s $SIG_FAIL $SIG_PID [ $? -ne 0 ] && kill -s $SIG_FAIL $SIG_PID
} }
......
#!/bin/sh #!/bin/sh
# description: Snapshot and tracing setting # description: Snapshot and tracing setting
# requires: snapshot
# flags: instance # flags: instance
[ ! -f snapshot ] && exit_unsupported
echo "Set tracing off" echo "Set tracing off"
echo 0 > tracing_on echo 0 > tracing_on
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: trace_pipe and trace_marker # description: trace_pipe and trace_marker
# requires: trace_marker
# flags: instance # flags: instance
[ ! -f trace_marker ] && exit_unsupported
echo "test input 1" > trace_marker echo "test input 1" > trace_marker
: "trace interface never consume the ring buffer" : "trace interface never consume the ring buffer"
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Test ftrace direct functions against kprobes # description: Test ftrace direct functions against kprobes
# requires: kprobe_events
rmmod ftrace-direct ||: rmmod ftrace-direct ||:
if ! modprobe ftrace-direct ; then if ! modprobe ftrace-direct ; then
...@@ -8,11 +9,6 @@ if ! modprobe ftrace-direct ; then ...@@ -8,11 +9,6 @@ if ! modprobe ftrace-direct ; then
exit_unresolved; exit_unresolved;
fi fi
if [ ! -f kprobe_events ]; then
echo "No kprobe_events file -please build CONFIG_KPROBE_EVENTS"
exit_unresolved;
fi
echo "Let the module run a little" echo "Let the module run a little"
sleep 1 sleep 1
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Generic dynamic event - add/remove kprobe events # description: Generic dynamic event - add/remove kprobe events
# requires: dynamic_events "place: [<module>:]<symbol>":README "place (kretprobe): [<module>:]<symbol>":README
[ -f dynamic_events ] || exit_unsupported
grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported
echo 0 > events/enable echo 0 > events/enable
echo > dynamic_events echo > dynamic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Generic dynamic event - add/remove synthetic events # description: Generic dynamic event - add/remove synthetic events
# requires: dynamic_events "s:[synthetic/]":README
[ -f dynamic_events ] || exit_unsupported
grep -q "s:\[synthetic/\]" README || exit_unsupported
echo 0 > events/enable echo 0 > events/enable
echo > dynamic_events echo > dynamic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Generic dynamic event - selective clear (compatibility) # description: Generic dynamic event - selective clear (compatibility)
# requires: dynamic_events kprobe_events synthetic_events "place: [<module>:]<symbol>":README "place (kretprobe): [<module>:]<symbol>":README "s:[synthetic/]":README
[ -f dynamic_events ] || exit_unsupported
grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported
grep -q "s:\[synthetic/\]" README || exit_unsupported
[ -f synthetic_events ] || exit_unsupported
[ -f kprobe_events ] || exit_unsupported
echo 0 > events/enable echo 0 > events/enable
echo > dynamic_events echo > dynamic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Generic dynamic event - generic clear event # description: Generic dynamic event - generic clear event
# requires: dynamic_events "place: [<module>:]<symbol>":README "place (kretprobe): [<module>:]<symbol>":README "s:[synthetic/]":README
[ -f dynamic_events ] || exit_unsupported
grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported
grep -q "s:\[synthetic/\]" README || exit_unsupported
echo 0 > events/enable echo 0 > events/enable
echo > dynamic_events echo > dynamic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event tracing - enable/disable with event level files # description: event tracing - enable/disable with event level files
# requires: set_event events/sched
# flags: instance # flags: instance
do_reset() { do_reset() {
...@@ -13,11 +14,6 @@ fail() { #msg ...@@ -13,11 +14,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
echo 'sched:sched_switch' > set_event echo 'sched:sched_switch' > set_event
yield yield
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event tracing - restricts events based on pid notrace filtering # description: event tracing - restricts events based on pid notrace filtering
# requires: set_event events/sched set_event_pid set_event_notrace_pid
# flags: instance # flags: instance
do_reset() { do_reset() {
...@@ -56,16 +57,6 @@ enable_events() { ...@@ -56,16 +57,6 @@ enable_events() {
echo 1 > tracing_on echo 1 > tracing_on
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f set_event_pid -o ! -f set_event_notrace_pid ]; then
echo "event pid notrace filtering is not supported"
exit_unsupported
fi
echo 0 > options/event-fork echo 0 > options/event-fork
do_reset do_reset
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event tracing - restricts events based on pid # description: event tracing - restricts events based on pid
# requires: set_event set_event_pid events/sched
# flags: instance # flags: instance
do_reset() { do_reset() {
...@@ -16,16 +17,6 @@ fail() { #msg ...@@ -16,16 +17,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f set_event_pid ]; then
echo "event pid filtering is not supported"
exit_unsupported
fi
echo 0 > options/event-fork echo 0 > options/event-fork
echo 1 > events/sched/sched_switch/enable echo 1 > events/sched/sched_switch/enable
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event tracing - enable/disable with subsystem level files # description: event tracing - enable/disable with subsystem level files
# requires: set_event events/sched/enable
# flags: instance # flags: instance
do_reset() { do_reset() {
...@@ -13,11 +14,6 @@ fail() { #msg ...@@ -13,11 +14,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
echo 'sched:*' > set_event echo 'sched:*' > set_event
yield yield
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event tracing - enable/disable with top level files # description: event tracing - enable/disable with top level files
# requires: available_events set_event events/enable
do_reset() { do_reset() {
echo > set_event echo > set_event
...@@ -12,11 +13,6 @@ fail() { #msg ...@@ -12,11 +13,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then
echo "event tracing is not supported"
exit_unsupported
fi
echo '*:*' > set_event echo '*:*' > set_event
yield yield
......
#!/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 set_ftrace_filter function_graph:tracer
# 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)
if ! grep -q function_graph available_tracers; then
echo "no function graph tracer configured"
exit_unsupported
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
...@@ -37,12 +31,6 @@ fi ...@@ -37,12 +31,6 @@ fi
echo function_graph > current_tracer echo function_graph > current_tracer
if [ ! -f stack_trace ]; then
echo "Stack tracer not configured"
do_reset
exit_unsupported;
fi
echo "Now testing with stack tracer" echo "Now testing with stack tracer"
echo 1 > /proc/sys/kernel/stack_tracer_enabled echo 1 > /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 function_graph:tracer
# Make sure that function graph filtering works # Make sure that function graph filtering works
if ! grep -q function_graph available_tracers; then
echo "no function graph tracer configured"
exit_unsupported
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 function:tracer
# Make sure that function glob matching filter works. # Make sure that function glob matching filter works.
if ! grep -q function available_tracers; then
echo "no function tracer configured"
exit_unsupported
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 set_ftrace_filter function:tracer
# flags: instance # flags: instance
# Make sure that function pid matching filter with notrace works. # Make sure that function pid matching filter with notrace works.
if ! grep -q function available_tracers; then
echo "no function tracer configured"
exit_unsupported
fi
if [ ! -f set_ftrace_notrace_pid ]; then
echo "set_ftrace_notrace_pid not found? Is function tracer not set?"
exit_unsupported
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 set_ftrace_filter function:tracer
# flags: instance # flags: instance
# Make sure that function pid matching filter works. # Make sure that function pid matching filter works.
# Also test it on an instance directory # Also test it on an instance directory
if ! grep -q function available_tracers; then
echo "no function tracer configured"
exit_unsupported
fi
if [ ! -f set_ftrace_pid ]; then
echo "set_ftrace_pid not found? Is function tracer not set?"
exit_unsupported
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
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - function trace with cpumask # description: ftrace - function trace with cpumask
# requires: function:tracer
if ! which nproc ; then if ! which nproc ; then
nproc() { nproc() {
...@@ -15,11 +16,6 @@ if [ $NP -eq 1 ] ;then ...@@ -15,11 +16,6 @@ if [ $NP -eq 1 ] ;then
exit_unresolved exit_unresolved
fi fi
if ! grep -q "function" available_tracers ; then
echo "Function trace is not enabled"
exit_unsupported
fi
ORIG_CPUMASK=`cat tracing_cpumask` ORIG_CPUMASK=`cat tracing_cpumask`
do_reset() { do_reset() {
......
...@@ -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 profiling # description: ftrace - function profiling
# requires: function_profile_enabled
[ ! -f function_profile_enabled ] && exit_unsupported
: "Enable function profile" : "Enable function profile"
echo 1 > function_profile_enabled echo 1 > function_profile_enabled
......
#!/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 set_ftrace_filter function_graph:tracer
# 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
...@@ -13,17 +14,6 @@ ...@@ -13,17 +14,6 @@
# This test triggers those bugs on those kernels. # This test triggers those bugs on those kernels.
# #
# We need function_graph and profiling to to run this test # We need function_graph and profiling to to run this test
if ! grep -q function_graph available_tracers; then
echo "no function graph tracer configured"
exit_unsupported;
fi
check_filter_file set_ftrace_filter
if [ ! -f function_profile_enabled ]; then
echo "function_profile_enabled not found, function profiling enabled?"
exit_unsupported
fi
fail() { # mesg fail() { # mesg
echo $1 echo $1
......
...@@ -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 stack_trace_filter
# Test the basic function of max-stack usage tracing # Test the basic function of max-stack usage tracing
if [ ! -f stack_trace ]; then
echo "Max stack tracer is not supported - please make CONFIG_STACK_TRACER=y"
exit_unsupported
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
......
...@@ -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
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: ftrace - test tracing error log support # description: ftrace - test tracing error log support
# event tracing is currently the only ftrace tracer that uses the
# tracing error_log, hence this check
# requires: set_event error_log
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
# event tracing is currently the only ftrace tracer that uses the
# tracing error_log, hence this check
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
[ -f error_log ] || exit_unsupported
ftrace_errlog_check 'event filter parse error' '((sig >= 10 && sig < 15) || dsig ^== 17) && comm != bash' 'events/signal/signal_generate/filter' ftrace_errlog_check 'event filter parse error' '((sig >= 10 && sig < 15) || dsig ^== 17) && comm != bash' 'events/signal/signal_generate/filter'
exit 0 exit 0
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
} }
...@@ -113,6 +106,27 @@ initialize_ftrace() { # Reset ftrace to initial-state ...@@ -113,6 +106,27 @@ initialize_ftrace() { # Reset ftrace to initial-state
enable_tracing enable_tracing
} }
check_requires() { # Check required files and tracers
for i in "$@" ; do
r=${i%:README}
t=${i%:tracer}
if [ $t != $i ]; then
if ! grep -wq $t available_tracers ; then
echo "Required tracer $t is not configured."
exit_unsupported
fi
elif [ $r != $i ]; then
if ! grep -Fq "$r" README ; then
echo "Required feature pattern \"$r\" is not in README."
exit_unsupported
fi
elif [ ! -e $i ]; then
echo "Required feature interface $i doesn't exist."
exit_unsupported
fi
done
}
LOCALHOST=127.0.0.1 LOCALHOST=127.0.0.1
yield() { yield() {
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Test creation and deletion of trace instances while setting an event # description: Test creation and deletion of trace instances while setting an event
# requires: instances
if [ ! -d instances ] ; then
echo "no instance directory with this kernel"
exit_unsupported;
fi
fail() { # mesg fail() { # mesg
rmdir foo 2>/dev/null rmdir foo 2>/dev/null
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Test creation and deletion of trace instances # description: Test creation and deletion of trace instances
# requires: instances
if [ ! -d instances ] ; then
echo "no instance directory with this kernel"
exit_unsupported;
fi
fail() { # mesg fail() { # mesg
rmdir x y z 2>/dev/null rmdir x y z 2>/dev/null
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe dynamic event - adding and removing # description: Kprobe dynamic event - adding and removing
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
echo p:myevent _do_fork > kprobe_events echo p:myevent _do_fork > kprobe_events
grep myevent kprobe_events grep myevent kprobe_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe dynamic event - busy event check # description: Kprobe dynamic event - busy event check
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported
echo p:myevent _do_fork > kprobe_events echo p:myevent _do_fork > kprobe_events
test -d events/kprobes/myevent test -d events/kprobes/myevent
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe dynamic event with arguments # description: Kprobe dynamic event with arguments
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
echo 'p:testprobe _do_fork $stack $stack0 +0($stack)' > kprobe_events echo 'p:testprobe _do_fork $stack $stack0 +0($stack)' > kprobe_events
grep testprobe kprobe_events | grep -q 'arg1=\$stack arg2=\$stack0 arg3=+0(\$stack)' grep testprobe kprobe_events | grep -q 'arg1=\$stack arg2=\$stack0 arg3=+0(\$stack)'
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe event with comm arguments # description: Kprobe event with comm arguments
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
grep -A1 "fetcharg:" README | grep -q "\$comm" || exit_unsupported # this is too old grep -A1 "fetcharg:" README | grep -q "\$comm" || exit_unsupported # this is too old
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe event string type argument # description: Kprobe event string type argument
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
case `uname -m` in case `uname -m` in
x86_64) x86_64)
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe event symbol argument # description: Kprobe event symbol argument
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
SYMBOL="linux_proc_banner" SYMBOL="linux_proc_banner"
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe event argument syntax # description: Kprobe event argument syntax
# requires: kprobe_events "x8/16/32/64":README
[ -f kprobe_events ] || exit_unsupported # this is configurable
grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
PROBEFUNC="vfs_read" PROBEFUNC="vfs_read"
GOODREG= GOODREG=
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobes event arguments with types # description: Kprobes event arguments with types
# requires: kprobe_events "x8/16/32/64":README
[ -f kprobe_events ] || exit_unsupported # this is configurable
grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
gen_event() { # Bitsize gen_event() { # Bitsize
echo "p:testprobe _do_fork \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1" echo "p:testprobe _do_fork \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1"
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe event user-memory access # description: Kprobe event user-memory access
# requires: kprobe_events '$arg<N>':README
[ -f kprobe_events ] || exit_unsupported # this is configurable
grep -q '\$arg<N>' README || exit_unresolved # depends on arch
grep -A10 "fetcharg:" README | grep -q 'ustring' || exit_unsupported grep -A10 "fetcharg:" README | grep -q 'ustring' || exit_unsupported
grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe event auto/manual naming # description: Kprobe event auto/manual naming
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
:;: "Add an event on function without name" ;: :;: "Add an event on function without name" ;:
......
#!/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 stack_trace_filter function:tracer
[ -f kprobe_events ] || 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
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe dynamic event - probing module # description: Kprobe dynamic event - probing module
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
rmmod trace-printk ||: rmmod trace-printk ||:
if ! modprobe trace-printk ; then if ! modprobe trace-printk ; then
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Create/delete multiprobe on kprobe event # description: Create/delete multiprobe on kprobe event
# requires: kprobe_events "Create/append/":README
[ -f kprobe_events ] || exit_unsupported
grep -q "Create/append/" README || exit_unsupported
# Choose 2 symbols for target # Choose 2 symbols for target
SYM1=_do_fork SYM1=_do_fork
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe event parser error log check # description: Kprobe event parser error log check
# requires: kprobe_events error_log
[ -f kprobe_events ] || exit_unsupported # this is configurable
[ -f error_log ] || exit_unsupported
check_error() { # command-with-error-pos-by-^ check_error() { # command-with-error-pos-by-^
ftrace_errlog_check 'trace_kprobe' "$1" 'kprobe_events' ftrace_errlog_check 'trace_kprobe' "$1" 'kprobe_events'
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kretprobe dynamic event with arguments # description: Kretprobe dynamic event with arguments
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
# Add new kretprobe event # Add new kretprobe event
echo 'r:testprobe2 _do_fork $retval' > kprobe_events echo 'r:testprobe2 _do_fork $retval' > kprobe_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kretprobe dynamic event with maxactive # description: Kretprobe dynamic event with maxactive
# requires: kprobe_events 'r[maxactive]':README
[ -f kprobe_events ] || exit_unsupported # this is configurable
grep -q 'r\[maxactive\]' README || exit_unsupported # this is older version
# Test if we successfully reject unknown messages # Test if we successfully reject unknown messages
if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Register/unregister many kprobe events # description: Register/unregister many kprobe events
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
# ftrace fentry skip size depends on the machine architecture. # ftrace fentry skip size depends on the machine architecture.
# Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc64le # Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc64le
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe events - probe points # description: Kprobe events - probe points
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
TARGET_FUNC=tracefs_create_dir TARGET_FUNC=tracefs_create_dir
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Kprobe dynamic event - adding and removing # description: Kprobe dynamic event - adding and removing
# requires: kprobe_events
[ -f kprobe_events ] || exit_unsupported # this is configurable
! grep -q 'myevent' kprobe_profile ! grep -q 'myevent' kprobe_profile
echo p:myevent _do_fork > kprobe_events echo p:myevent _do_fork > kprobe_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Uprobe event parser error log check # description: Uprobe event parser error log check
# requires: uprobe_events error_log
[ -f uprobe_events ] || exit_unsupported # this is configurable
[ -f error_log ] || exit_unsupported
check_error() { # command-with-error-pos-by-^ check_error() { # command-with-error-pos-by-^
ftrace_errlog_check 'trace_uprobe' "$1" 'uprobe_events' ftrace_errlog_check 'trace_uprobe' "$1" 'uprobe_events'
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: test for the preemptirqsoff tracer # description: test for the preemptirqsoff tracer
# requires: preemptoff:tracer irqsoff:tracer
MOD=preemptirq_delay_test MOD=preemptirq_delay_test
...@@ -27,9 +28,6 @@ unres() { #msg ...@@ -27,9 +28,6 @@ unres() { #msg
modprobe $MOD || unres "$MOD module not available" modprobe $MOD || unres "$MOD module not available"
rmmod $MOD rmmod $MOD
grep -q "preemptoff" available_tracers || unsup "preemptoff tracer not enabled"
grep -q "irqsoff" available_tracers || unsup "irqsoff tracer not enabled"
reset_tracer reset_tracer
# Simulate preemptoff section for half a second couple of times # Simulate preemptoff section for half a second couple of times
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: %HERE DESCRIBE WHAT THIS DOES% # description: %HERE DESCRIBE WHAT THIS DOES%
# requires: %HERE LIST THE REQUIRED FILES, TRACERS OR README-STRINGS%
# The required tracer needs :tracer suffix, e.g. function:tracer
# The required README string needs :README suffix, e.g. "x8/16/32/64":README
# and the README string is treated as a fixed-string instead of regexp pattern.
# you have to add ".tc" extention for your testcase file # you have to add ".tc" extention for your testcase file
# Note that all tests are run with "errexit" option. # Note that all tests are run with "errexit" option.
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Test wakeup tracer # description: Test wakeup tracer
# requires: wakeup:tracer
if ! which chrt ; then if ! which chrt ; then
echo "chrt is not found. This test requires nice command." echo "chrt is not found. This test requires nice command."
exit_unresolved exit_unresolved
fi fi
if ! grep -wq "wakeup" available_tracers ; then
echo "wakeup tracer is not supported"
exit_unsupported
fi
echo wakeup > current_tracer echo wakeup > current_tracer
echo 1 > tracing_on echo 1 > tracing_on
echo 0 > tracing_max_latency echo 0 > tracing_max_latency
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: Test wakeup RT tracer # description: Test wakeup RT tracer
# requires: wakeup_rt:tracer
if ! which chrt ; then if ! which chrt ; then
echo "chrt is not found. This test requires chrt command." echo "chrt is not found. This test requires chrt command."
exit_unresolved exit_unresolved
fi fi
if ! grep -wq "wakeup_rt" available_tracers ; then
echo "wakeup_rt tracer is not supported"
exit_unsupported
fi
echo wakeup_rt > current_tracer echo wakeup_rt > current_tracer
echo 1 > tracing_on echo 1 > tracing_on
echo 0 > tracing_max_latency echo 0 > tracing_max_latency
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger expected fail actions # description: event trigger - test inter-event histogram trigger expected fail actions
# requires: set_event snapshot "snapshot()":README
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f snapshot ]; then
echo "snapshot is not supported"
exit_unsupported
fi
grep -q "snapshot()" README || exit_unsupported # version issue
echo "Test expected snapshot action failure" echo "Test expected snapshot action failure"
echo 'hist:keys=comm:onmatch(sched.sched_wakeup).snapshot()' >> events/sched/sched_waking/trigger && exit_fail echo 'hist:keys=comm:onmatch(sched.sched_wakeup).snapshot()' >> events/sched/sched_waking/trigger && exit_fail
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test field variable support # description: event trigger - test field variable support
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test field variable support" echo "Test field variable support"
echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event combined histogram trigger # description: event trigger - test inter-event combined histogram trigger
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'waking_latency u64 lat pid_t pid' > synthetic_events echo 'waking_latency u64 lat pid_t pid' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test multiple actions on hist trigger # description: event trigger - test multiple actions on hist trigger
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test multiple actions on hist trigger" echo "Test multiple actions on hist trigger"
echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events
TRIGGER1=events/sched/sched_wakeup/trigger TRIGGER1=events/sched/sched_wakeup/trigger
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onchange action # description: event trigger - test inter-event histogram trigger onchange action
# requires: set_event "onchange(var)":README
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
grep -q "onchange(var)" README || exit_unsupported # version issue
echo "Test onchange action" echo "Test onchange action"
echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio) if comm=="ping"' >> events/sched/sched_waking/trigger echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio) if comm=="ping"' >> events/sched/sched_waking/trigger
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onmatch action # description: event trigger - test inter-event histogram trigger onmatch action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onmatch-onmax action # description: event trigger - test inter-event histogram trigger onmatch-onmax action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger onmax action # description: event trigger - test inter-event histogram trigger onmax action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger snapshot action # description: event trigger - test inter-event histogram trigger snapshot action
# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
if [ ! -f snapshot ]; then
echo "snapshot is not supported"
exit_unsupported
fi
grep -q "onchange(var)" README || exit_unsupported # version issue
grep -q "snapshot()" README || exit_unsupported # version issue
echo "Test snapshot action" echo "Test snapshot action"
echo 1 > events/sched/enable echo 1 > events/sched/enable
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test synthetic event create remove # description: event trigger - test synthetic event create remove
# requires: set_event synthetic_events
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test synthetic_events syntax parser # description: event trigger - test synthetic_events syntax parser
# requires: set_event synthetic_events
do_reset() { do_reset() {
reset_trigger reset_trigger
...@@ -14,16 +15,6 @@ fail() { #msg ...@@ -14,16 +15,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
reset_tracer reset_tracer
do_reset do_reset
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger trace action # description: event trigger - test inter-event histogram trigger trace action
# requires: set_event synthetic_events events/sched/sched_process_fork/hist "trace(<synthetic_event>":README
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic event is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
grep -q "trace(<synthetic_event>" README || exit_unsupported # version issue
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test event enable/disable trigger # description: event trigger - test event enable/disable trigger
# requires: set_event events/sched/sched_process_fork/trigger
# flags: instance # flags: instance
fail() { #msg fail() { #msg
...@@ -8,16 +9,6 @@ fail() { #msg ...@@ -8,16 +9,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
FEATURE=`grep enable_event events/sched/sched_process_fork/trigger` FEATURE=`grep enable_event events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then if [ -z "$FEATURE" ]; then
echo "event enable/disable trigger is not supported" echo "event enable/disable trigger is not supported"
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test trigger filter # description: event trigger - test trigger filter
# requires: set_event events/sched/sched_process_fork/trigger
# flags: instance # flags: instance
fail() { #msg fail() { #msg
...@@ -8,16 +9,6 @@ fail() { #msg ...@@ -8,16 +9,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
echo "Test trigger filter" echo "Test trigger filter"
echo 1 > tracing_on echo 1 > tracing_on
echo 'traceoff if child_pid == 0' > events/sched/sched_process_fork/trigger echo 'traceoff if child_pid == 0' > events/sched/sched_process_fork/trigger
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test histogram modifiers # description: event trigger - test histogram modifiers
# requires: set_event events/sched/sched_process_fork/trigger events/sched/sched_process_fork/hist
# flags: instance # flags: instance
fail() { #msg fail() { #msg
...@@ -8,21 +9,6 @@ fail() { #msg ...@@ -8,21 +9,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test histogram with execname modifier" echo "Test histogram with execname modifier"
echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test histogram parser errors # description: event trigger - test histogram parser errors
# requires: set_event events/kmem/kmalloc/trigger events/kmem/kmalloc/hist error_log
if [ ! -f set_event -o ! -d events/kmem ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/kmem/kmalloc/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/kmem/kmalloc/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
[ -f error_log ] || exit_unsupported
check_error() { # command-with-error-pos-by-^ check_error() { # command-with-error-pos-by-^
ftrace_errlog_check 'hist:kmem:kmalloc' "$1" 'events/kmem/kmalloc/trigger' ftrace_errlog_check 'hist:kmem:kmalloc' "$1" 'events/kmem/kmalloc/trigger'
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test histogram trigger # description: event trigger - test histogram trigger
# requires: set_event events/sched/sched_process_fork/trigger events/sched/sched_process_fork/hist
# flags: instance # flags: instance
fail() { #msg fail() { #msg
...@@ -8,22 +9,7 @@ fail() { #msg ...@@ -8,22 +9,7 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then echo "Test histogram basic trigger"
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test histogram basic tigger"
echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger
for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test multiple histogram triggers # description: event trigger - test multiple histogram triggers
# requires: set_event events/sched/sched_process_fork/trigger events/sched/sched_process_fork/hist
# flags: instance # flags: instance
fail() { #msg fail() { #msg
...@@ -8,21 +9,6 @@ fail() { #msg ...@@ -8,21 +9,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test histogram multiple triggers" echo "Test histogram multiple triggers"
echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test snapshot-trigger # description: event trigger - test snapshot-trigger
# requires: set_event events/sched/sched_process_fork/trigger snapshot
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f snapshot ]; then
echo "snapshot is not supported"
exit_unsupported
fi
FEATURE=`grep snapshot events/sched/sched_process_fork/trigger` FEATURE=`grep snapshot events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then if [ -z "$FEATURE" ]; then
echo "snapshot trigger is not supported" echo "snapshot trigger is not supported"
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test stacktrace-trigger # description: event trigger - test stacktrace-trigger
# requires: set_event events/sched/sched_process_fork/trigger
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
FEATURE=`grep stacktrace events/sched/sched_process_fork/trigger` FEATURE=`grep stacktrace events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then if [ -z "$FEATURE" ]; then
echo "stacktrace trigger is not supported" echo "stacktrace trigger is not supported"
exit_unsupported exit_unsupported
fi fi
echo "Test stacktrace tigger" echo "Test stacktrace trigger"
echo 0 > trace echo 0 > trace
echo 0 > options/stacktrace echo 0 > options/stacktrace
echo 'stacktrace' > events/sched/sched_process_fork/trigger echo 'stacktrace' > events/sched/sched_process_fork/trigger
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: trace_marker trigger - test histogram trigger # description: trace_marker trigger - test histogram trigger
# requires: set_event events/ftrace/print/trigger events/ftrace/print/hist
# flags: instance # flags: instance
fail() { #msg fail() { #msg
...@@ -8,27 +9,7 @@ fail() { #msg ...@@ -8,27 +9,7 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event ]; then echo "Test histogram trace_marker trigger"
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -d events/ftrace/print ]; then
echo "event trace_marker is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test histogram trace_marker tigger"
echo 'hist:keys=common_pid' > events/ftrace/print/trigger echo 'hist:keys=common_pid' > events/ftrace/print/trigger
for i in `seq 1 10` ; do echo "hello" > trace_marker; done for i in `seq 1 10` ; do echo "hello" > trace_marker; done
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: trace_marker trigger - test snapshot trigger # description: trace_marker trigger - test snapshot trigger
# requires: set_event snapshot events/ftrace/print/trigger
# flags: instance # flags: instance
fail() { #msg fail() { #msg
...@@ -8,26 +9,6 @@ fail() { #msg ...@@ -8,26 +9,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f snapshot ]; then
echo "snapshot is not supported"
exit_unsupported
fi
if [ ! -d events/ftrace/print ]; then
echo "event trace_marker is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
test_trace() { test_trace() {
file=$1 file=$1
x=$2 x=$2
...@@ -46,7 +27,7 @@ test_trace() { ...@@ -46,7 +27,7 @@ test_trace() {
done done
} }
echo "Test snapshot trace_marker tigger" echo "Test snapshot trace_marker trigger"
echo 'snapshot' > events/ftrace/print/trigger echo 'snapshot' > events/ftrace/print/trigger
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: trace_marker trigger - test histogram with synthetic event against kernel event # description: trace_marker trigger - test histogram with synthetic event against kernel event
# requires: set_event synthetic_events events/sched/sched_waking events/ftrace/print/trigger events/ftrace/print/hist
# flags: # flags:
fail() { #msg fail() { #msg
...@@ -8,36 +9,6 @@ fail() { #msg ...@@ -8,36 +9,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic events not supported"
exit_unsupported
fi
if [ ! -d events/ftrace/print ]; then
echo "event trace_marker is not supported"
exit_unsupported
fi
if [ ! -d events/sched/sched_waking ]; then
echo "event sched_waking is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test histogram kernel event to trace_marker latency histogram trigger" echo "Test histogram kernel event to trace_marker latency histogram trigger"
echo 'latency u64 lat' > synthetic_events echo 'latency u64 lat' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: trace_marker trigger - test histogram with synthetic event # description: trace_marker trigger - test histogram with synthetic event
# requires: set_event synthetic_events events/ftrace/print/trigger events/ftrace/print/hist
# flags: # flags:
fail() { #msg fail() { #msg
...@@ -8,31 +9,6 @@ fail() { #msg ...@@ -8,31 +9,6 @@ fail() { #msg
exit_fail exit_fail
} }
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic events not supported"
exit_unsupported
fi
if [ ! -d events/ftrace/print ]; then
echo "event trace_marker is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo "Test histogram trace_marker to trace_marker latency histogram trigger"
echo 'latency u64 lat' > synthetic_events echo 'latency u64 lat' > synthetic_events
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test traceon/off trigger # description: event trigger - test traceon/off trigger
# requires: set_event events/sched/sched_process_fork/trigger
fail() { #msg fail() { #msg
echo $1 echo $1
exit_fail exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
echo "Test traceoff trigger" echo "Test traceoff trigger"
echo 1 > tracing_on echo 1 > tracing_on
echo 'traceoff' > events/sched/sched_process_fork/trigger echo 'traceoff' > events/sched/sched_process_fork/trigger
......
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