o Added kprobes on ftrace testcase o Sort test cases o Add file to hold helper functions o Use logfile name supported by busybox's mktemp o Clear trace buffer after running kprobe test o Fix show descriptions when run on dash shell o Add --verbose option for showing echo output -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJUhbSvAAoJEEjnJuOKh9ldB84H+gNuE2PPvsxmgSxFP0bdo+Uw k/8C2QBU6xLXZFZvqXnH7P0gLP2OIjpOBOTKt+yjkB/Elm+XnMVV1Xy+k7VLBiMD g+DRoIcpJL2dOy/D8t/P4SjVNXt4Btwxf/tCTabbubLc+aBmvkEG4DL2Vk/Xl5+Y XH1dBgYvI9irAxgnYpBnPlN7WIWg1+WCshdOtqkNGRuyJ1G9gn0VlxGmNF7B+0ye cjFj19loPMGzmYBDgGCa9ypQHEP1F97t+WUEDrwCZsXLtaA7Z4bumXTrxKQWsmdT bDZQTEFcQ9EYQGvqbaz+nHb94P8cyFrSNvSiAAqhuc2ZqigYWUYDEvFjYxSSGAE= =eiD2 -----END PGP SIGNATURE----- Merge tag 'ftracetest-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace Pull ftrace self-test updates from Steven Rostedt: "Updates for the ftrace self tests: - Added kprobes on ftrace testcase - Sort test cases - Add file to hold helper functions - Use logfile name supported by busybox's mktemp - Clear trace buffer after running kprobe test - Fix show descriptions when run on dash shell - Add --verbose option for showing echo output" * tag 'ftracetest-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: ftracetest: Add --verbose option for showing echo output ftracetest: Fix to show descriptions on dash ftracetest: Add basic event tracing test cases ftracetest: Clear trace buffer after running kprobe testcases ftracetest: Use logfile name supported by busybox's mktemp ftracetest: Add a couple of ftrace test cases ftracetest: Add functions file that holds helper functions ftracetest: Sort testcases ftracetest: Add kprobes on ftrace testcasetirimbino
commit
c32809521d
@ -0,0 +1,5 @@ |
||||
#!/bin/sh |
||||
# description: Basic event tracing check |
||||
test -f available_events -a -f set_event -a -d events |
||||
# check scheduler events are available |
||||
grep -q sched available_events && exit 0 || exit -1 |
@ -0,0 +1,53 @@ |
||||
#!/bin/sh |
||||
# description: event tracing - enable/disable with event level files |
||||
|
||||
do_reset() { |
||||
echo > set_event |
||||
clear_trace |
||||
} |
||||
|
||||
fail() { #msg |
||||
do_reset |
||||
echo $1 |
||||
exit -1 |
||||
} |
||||
|
||||
if [ ! -f set_event -o ! -d events/sched ]; then |
||||
echo "event tracing is not supported" |
||||
exit_unsupported |
||||
fi |
||||
|
||||
reset_tracer |
||||
do_reset |
||||
|
||||
echo 'sched:sched_switch' > set_event |
||||
usleep 1 |
||||
|
||||
count=`cat trace | grep sched_switch | wc -l` |
||||
if [ $count -eq 0 ]; then |
||||
fail "sched_switch events are not recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
echo 1 > events/sched/sched_switch/enable |
||||
usleep 1 |
||||
|
||||
count=`cat trace | grep sched_switch | wc -l` |
||||
if [ $count -eq 0 ]; then |
||||
fail "sched_switch events are not recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
echo 0 > events/sched/sched_switch/enable |
||||
usleep 1 |
||||
|
||||
count=`cat trace | grep sched_switch | wc -l` |
||||
if [ $count -ne 0 ]; then |
||||
fail "sched_switch events should not be recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
exit 0 |
@ -0,0 +1,53 @@ |
||||
#!/bin/sh |
||||
# description: event tracing - enable/disable with subsystem level files |
||||
|
||||
do_reset() { |
||||
echo > set_event |
||||
clear_trace |
||||
} |
||||
|
||||
fail() { #msg |
||||
do_reset |
||||
echo $1 |
||||
exit -1 |
||||
} |
||||
|
||||
if [ ! -f set_event -o ! -d events/sched ]; then |
||||
echo "event tracing is not supported" |
||||
exit_unsupported |
||||
fi |
||||
|
||||
reset_tracer |
||||
do_reset |
||||
|
||||
echo 'sched:*' > set_event |
||||
usleep 1 |
||||
|
||||
count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` |
||||
if [ $count -lt 3 ]; then |
||||
fail "at least fork, exec and exit events should be recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
echo 1 > events/sched/enable |
||||
usleep 1 |
||||
|
||||
count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` |
||||
if [ $count -lt 3 ]; then |
||||
fail "at least fork, exec and exit events should be recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
echo 0 > events/sched/enable |
||||
usleep 1 |
||||
|
||||
count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` |
||||
if [ $count -ne 0 ]; then |
||||
fail "any of scheduler events should not be recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
exit 0 |
@ -0,0 +1,47 @@ |
||||
#!/bin/sh |
||||
# description: event tracing - enable/disable with top level files |
||||
|
||||
do_reset() { |
||||
echo > set_event |
||||
clear_trace |
||||
} |
||||
|
||||
fail() { #msg |
||||
do_reset |
||||
echo $1 |
||||
exit -1 |
||||
} |
||||
|
||||
if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then |
||||
echo "event tracing is not supported" |
||||
exit_unsupported |
||||
fi |
||||
|
||||
reset_tracer |
||||
do_reset |
||||
|
||||
echo '*:*' > set_event |
||||
count=`cat trace | grep -v ^# | wc -l` |
||||
if [ $count -eq 0 ]; then |
||||
fail "none of events are recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
echo 1 > events/enable |
||||
count=`cat trace | grep -v ^# | wc -l` |
||||
if [ $count -eq 0 ]; then |
||||
fail "none of events are recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
echo 0 > events/enable |
||||
count=`cat trace | grep -v ^# | wc -l` |
||||
if [ $count -ne 0 ]; then |
||||
fail "any of events should not be recorded" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
exit 0 |
@ -0,0 +1,89 @@ |
||||
#!/bin/sh |
||||
# description: ftrace - function graph filters with stack tracer |
||||
|
||||
# Make sure that function graph filtering works, and is not |
||||
# 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 |
||||
|
||||
if [ ! -f set_ftrace_filter ]; then |
||||
echo "set_ftrace_filter not found? Is dynamic ftrace not set?" |
||||
exit_unsupported |
||||
fi |
||||
|
||||
do_reset() { |
||||
reset_tracer |
||||
echo 0 > /proc/sys/kernel/stack_tracer_enabled |
||||
enable_tracing |
||||
clear_trace |
||||
echo > set_ftrace_filter |
||||
} |
||||
|
||||
fail() { # msg |
||||
do_reset |
||||
echo $1 |
||||
exit -1 |
||||
} |
||||
|
||||
disable_tracing |
||||
clear_trace; |
||||
|
||||
# filter something, schedule is always good |
||||
if ! echo "schedule" > set_ftrace_filter; then |
||||
# test for powerpc 64 |
||||
if ! echo ".schedule" > set_ftrace_filter; then |
||||
fail "can not enable schedule filter" |
||||
fi |
||||
fi |
||||
|
||||
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 1 > /proc/sys/kernel/stack_tracer_enabled |
||||
|
||||
disable_tracing |
||||
clear_trace |
||||
enable_tracing |
||||
sleep 1 |
||||
|
||||
count=`cat trace | grep '()' | grep -v schedule | wc -l` |
||||
|
||||
if [ $count -ne 0 ]; then |
||||
fail "Graph filtering not working with stack tracer?" |
||||
fi |
||||
|
||||
# Make sure we did find something |
||||
count=`cat trace | grep 'schedule()' | wc -l` |
||||
if [ $count -eq 0 ]; then |
||||
fail "No schedule traces found?" |
||||
fi |
||||
|
||||
echo 0 > /proc/sys/kernel/stack_tracer_enabled |
||||
clear_trace |
||||
sleep 1 |
||||
|
||||
|
||||
count=`cat trace | grep '()' | grep -v schedule | wc -l` |
||||
|
||||
if [ $count -ne 0 ]; then |
||||
fail "Graph filtering not working after stack tracer disabled?" |
||||
fi |
||||
|
||||
count=`cat trace | grep 'schedule()' | wc -l` |
||||
if [ $count -eq 0 ]; then |
||||
fail "No schedule traces found?" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
exit 0 |
@ -0,0 +1,52 @@ |
||||
#!/bin/sh |
||||
# description: ftrace - function graph filters |
||||
|
||||
# Make sure that function graph filtering works |
||||
|
||||
if ! grep -q function_graph available_tracers; then |
||||
echo "no function graph tracer configured" |
||||
exit_unsupported |
||||
fi |
||||
|
||||
do_reset() { |
||||
reset_tracer |
||||
enable_tracing |
||||
clear_trace |
||||
} |
||||
|
||||
fail() { # msg |
||||
do_reset |
||||
echo $1 |
||||
exit -1 |
||||
} |
||||
|
||||
disable_tracing |
||||
clear_trace |
||||
|
||||
# filter something, schedule is always good |
||||
if ! echo "schedule" > set_ftrace_filter; then |
||||
# test for powerpc 64 |
||||
if ! echo ".schedule" > set_ftrace_filter; then |
||||
fail "can not enable schedule filter" |
||||
fi |
||||
fi |
||||
|
||||
echo function_graph > current_tracer |
||||
enable_tracing |
||||
sleep 1 |
||||
# search for functions (has "()" on the line), and make sure |
||||
# that only the schedule function was found |
||||
count=`cat trace | grep '()' | grep -v schedule | wc -l` |
||||
if [ $count -ne 0 ]; then |
||||
fail "Graph filtering not working by itself?" |
||||
fi |
||||
|
||||
# Make sure we did find something |
||||
count=`cat trace | grep 'schedule()' | wc -l` |
||||
if [ $count -eq 0 ]; then |
||||
fail "No schedule traces found?" |
||||
fi |
||||
|
||||
do_reset |
||||
|
||||
exit 0 |
@ -0,0 +1,80 @@ |
||||
#!/bin/sh |
||||
# description: ftrace - function profiler with function tracing |
||||
|
||||
# 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 |
||||
# tracer, because the function_profiler used the function_graph tracer |
||||
# and it was assumed the two could not run simultaneously. |
||||
# |
||||
# There was another related bug where the solution to the first bug |
||||
# broke the way filtering of the function tracer worked. |
||||
# |
||||
# This test triggers those bugs on those kernels. |
||||
# |
||||
# 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 |
||||
|
||||
if [ ! -f set_ftrace_filter ]; then |
||||
echo "set_ftrace_filter not found? Is dynamic ftrace not set?" |
||||
exit_unsupported |
||||
fi |
||||
|
||||
if [ ! -f function_profile_enabled ]; then |
||||
echo "function_profile_enabled not found, function profiling enabled?" |
||||
exit_unsupported |
||||
fi |
||||
|
||||
fail() { # mesg |
||||
reset_tracer |
||||
echo > set_ftrace_filter |
||||
echo $1 |
||||
exit -1 |
||||
} |
||||
|
||||
echo "Testing function tracer with profiler:" |
||||
echo "enable function tracer" |
||||
echo function > current_tracer |
||||
echo "enable profiler" |
||||
echo 1 > function_profile_enabled |
||||
|
||||
sleep 1 |
||||
|
||||
echo "Now filter on just schedule" |
||||
echo '*schedule' > set_ftrace_filter |
||||
clear_trace |
||||
|
||||
echo "Now disable function profiler" |
||||
echo 0 > function_profile_enabled |
||||
|
||||
sleep 1 |
||||
|
||||
# make sure only schedule functions exist |
||||
|
||||
echo "testing if only schedule is being traced" |
||||
if grep -v -e '^#' -e 'schedule' trace; then |
||||
fail "more than schedule was found" |
||||
fi |
||||
|
||||
echo "Make sure schedule was traced" |
||||
if ! grep -e 'schedule' trace > /dev/null; then |
||||
cat trace |
||||
fail "can not find schedule in trace" |
||||
fi |
||||
|
||||
echo > set_ftrace_filter |
||||
clear_trace |
||||
|
||||
sleep 1 |
||||
|
||||
echo "make sure something other than scheduler is being traced" |
||||
if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then |
||||
cat trace |
||||
fail "no other functions besides schedule was found" |
||||
fi |
||||
|
||||
reset_tracer |
||||
|
||||
exit 0 |
@ -0,0 +1,16 @@ |
||||
|
||||
clear_trace() { # reset trace output |
||||
echo > trace |
||||
} |
||||
|
||||
disable_tracing() { # stop trace recording |
||||
echo 0 > tracing_on |
||||
} |
||||
|
||||
enable_tracing() { # start trace recording |
||||
echo 1 > tracing_on |
||||
} |
||||
|
||||
reset_tracer() { # reset the current tracer |
||||
echo nop > current_tracer |
||||
} |
@ -0,0 +1,55 @@ |
||||
#!/bin/sh |
||||
# description: Kprobe dynamic event with function tracer |
||||
|
||||
[ -f kprobe_events ] || exit_unsupported # this is configurable |
||||
grep function available_tracers || exit_unsupported # this is configurable |
||||
|
||||
# prepare |
||||
echo nop > current_tracer |
||||
echo do_fork > set_ftrace_filter |
||||
echo 0 > events/enable |
||||
echo > kprobe_events |
||||
echo 'p:testprobe do_fork' > kprobe_events |
||||
|
||||
# kprobe on / ftrace off |
||||
echo 1 > events/kprobes/testprobe/enable |
||||
echo > trace |
||||
( echo "forked") |
||||
grep testprobe trace |
||||
! grep 'do_fork <-' trace |
||||
|
||||
# kprobe on / ftrace on |
||||
echo function > current_tracer |
||||
echo > trace |
||||
( echo "forked") |
||||
grep testprobe trace |
||||
grep 'do_fork <-' trace |
||||
|
||||
# kprobe off / ftrace on |
||||
echo 0 > events/kprobes/testprobe/enable |
||||
echo > trace |
||||
( echo "forked") |
||||
! grep testprobe trace |
||||
grep 'do_fork <-' trace |
||||
|
||||
# kprobe on / ftrace on |
||||
echo 1 > events/kprobes/testprobe/enable |
||||
echo function > current_tracer |
||||
echo > trace |
||||
( echo "forked") |
||||
grep testprobe trace |
||||
grep 'do_fork <-' trace |
||||
|
||||
# kprobe on / ftrace off |
||||
echo nop > current_tracer |
||||
echo > trace |
||||
( echo "forked") |
||||
grep testprobe trace |
||||
! grep 'do_fork <-' trace |
||||
|
||||
# cleanup |
||||
echo nop > current_tracer |
||||
echo > set_ftrace_filter |
||||
echo 0 > events/kprobes/testprobe/enable |
||||
echo > kprobe_events |
||||
echo > trace |
Loading…
Reference in new issue