aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 23:03:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 23:03:45 -0500
commitc32809521de5b31699a33379183848b0c7628f28 (patch)
tree6879856f5a75059dfcb843a3449d1847be006ec2 /tools
parent1dd7dcb6eaa677b034e7ef63df8320277507ae70 (diff)
parent57cee23650d768130ff2d80aa4cd0b053feabf97 (diff)
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 testcase
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/ftrace/ftracetest43
-rw-r--r--tools/testing/selftests/ftrace/test.d/00basic/basic4.tc5
-rw-r--r--tools/testing/selftests/ftrace/test.d/event/event-enable.tc53
-rw-r--r--tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc53
-rw-r--r--tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc47
-rw-r--r--tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc89
-rw-r--r--tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc52
-rw-r--r--tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc80
-rw-r--r--tools/testing/selftests/ftrace/test.d/functions16
-rw-r--r--tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc1
-rw-r--r--tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc1
-rw-r--r--tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc1
-rw-r--r--tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc55
-rw-r--r--tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc1
14 files changed, 484 insertions, 13 deletions
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 515247601df4..da48812ab95e 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -13,6 +13,7 @@ echo "Usage: ftracetest [options] [testcase(s)] [testcase-directory(s)]"
13echo " Options:" 13echo " Options:"
14echo " -h|--help Show help message" 14echo " -h|--help Show help message"
15echo " -k|--keep Keep passed test logs" 15echo " -k|--keep Keep passed test logs"
16echo " -v|--verbose Show all stdout messages in testcases"
16echo " -d|--debug Debug mode (trace all shell commands)" 17echo " -d|--debug Debug mode (trace all shell commands)"
17exit $1 18exit $1
18} 19}
@@ -37,7 +38,7 @@ abspath() {
37} 38}
38 39
39find_testcases() { #directory 40find_testcases() { #directory
40 echo `find $1 -name \*.tc` 41 echo `find $1 -name \*.tc | sort`
41} 42}
42 43
43parse_opts() { # opts 44parse_opts() { # opts
@@ -53,6 +54,10 @@ parse_opts() { # opts
53 KEEP_LOG=1 54 KEEP_LOG=1
54 shift 1 55 shift 1
55 ;; 56 ;;
57 --verbose|-v)
58 VERBOSE=1
59 shift 1
60 ;;
56 --debug|-d) 61 --debug|-d)
57 DEBUG=1 62 DEBUG=1
58 shift 1 63 shift 1
@@ -90,6 +95,7 @@ TEST_CASES=`find_testcases $TEST_DIR`
90LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/ 95LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
91KEEP_LOG=0 96KEEP_LOG=0
92DEBUG=0 97DEBUG=0
98VERBOSE=0
93# Parse command-line options 99# Parse command-line options
94parse_opts $* 100parse_opts $*
95 101
@@ -135,15 +141,12 @@ TOTAL_RESULT=0
135CASENO=0 141CASENO=0
136testcase() { # testfile 142testcase() { # testfile
137 CASENO=$((CASENO+1)) 143 CASENO=$((CASENO+1))
138 prlog -n "[$CASENO]"`grep "^#[ \t]*description:" $1 | cut -f2 -d:` 144 desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:`
145 prlog -n "[$CASENO]$desc"
139} 146}
140 147
141eval_result() { # retval sigval 148eval_result() { # sigval
142 local retval=$2 149 case $1 in
143 if [ $2 -eq 0 ]; then
144 test $1 -ne 0 && retval=$FAIL
145 fi
146 case $retval in
147 $PASS) 150 $PASS)
148 prlog " [PASS]" 151 prlog " [PASS]"
149 PASSED_CASES="$PASSED_CASES $CASENO" 152 PASSED_CASES="$PASSED_CASES $CASENO"
@@ -187,6 +190,9 @@ SIG_RESULT=
187SIG_BASE=36 # Use realtime signals 190SIG_BASE=36 # Use realtime signals
188SIG_PID=$$ 191SIG_PID=$$
189 192
193SIG_FAIL=$((SIG_BASE + FAIL))
194trap 'SIG_RESULT=$FAIL' $SIG_FAIL
195
190SIG_UNRESOLVED=$((SIG_BASE + UNRESOLVED)) 196SIG_UNRESOLVED=$((SIG_BASE + UNRESOLVED))
191exit_unresolved () { 197exit_unresolved () {
192 kill -s $SIG_UNRESOLVED $SIG_PID 198 kill -s $SIG_UNRESOLVED $SIG_PID
@@ -215,17 +221,25 @@ exit_xfail () {
215} 221}
216trap 'SIG_RESULT=$XFAIL' $SIG_XFAIL 222trap 'SIG_RESULT=$XFAIL' $SIG_XFAIL
217 223
224__run_test() { # testfile
225 # setup PID and PPID, $$ is not updated.
226 (cd $TRACING_DIR; read PID _ < /proc/self/stat ; set -e; set -x; . $1)
227 [ $? -ne 0 ] && kill -s $SIG_FAIL $SIG_PID
228}
229
218# Run one test case 230# Run one test case
219run_test() { # testfile 231run_test() { # testfile
220 local testname=`basename $1` 232 local testname=`basename $1`
221 local testlog=`mktemp --tmpdir=$LOG_DIR ${testname}-XXXXXX.log` 233 local testlog=`mktemp $LOG_DIR/${testname}-log.XXXXXX`
222 testcase $1 234 testcase $1
223 echo "execute: "$1 > $testlog 235 echo "execute: "$1 > $testlog
224 SIG_RESULT=0 236 SIG_RESULT=0
225 # setup PID and PPID, $$ is not updated. 237 if [ $VERBOSE -ne 0 ]; then
226 (cd $TRACING_DIR; read PID _ < /proc/self/stat ; 238 __run_test $1 2>> $testlog | tee -a $testlog
227 set -e; set -x; . $1) >> $testlog 2>&1 239 else
228 eval_result $? $SIG_RESULT 240 __run_test $1 >> $testlog 2>&1
241 fi
242 eval_result $SIG_RESULT
229 if [ $? -eq 0 ]; then 243 if [ $? -eq 0 ]; then
230 # Remove test log if the test was done as it was expected. 244 # Remove test log if the test was done as it was expected.
231 [ $KEEP_LOG -eq 0 ] && rm $testlog 245 [ $KEEP_LOG -eq 0 ] && rm $testlog
@@ -235,6 +249,9 @@ run_test() { # testfile
235 fi 249 fi
236} 250}
237 251
252# load in the helper functions
253. $TEST_DIR/functions
254
238# Main loop 255# Main loop
239for t in $TEST_CASES; do 256for t in $TEST_CASES; do
240 run_test $t 257 run_test $t
diff --git a/tools/testing/selftests/ftrace/test.d/00basic/basic4.tc b/tools/testing/selftests/ftrace/test.d/00basic/basic4.tc
new file mode 100644
index 000000000000..fd9c49a13612
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/00basic/basic4.tc
@@ -0,0 +1,5 @@
1#!/bin/sh
2# description: Basic event tracing check
3test -f available_events -a -f set_event -a -d events
4# check scheduler events are available
5grep -q sched available_events && exit 0 || exit -1 \ No newline at end of file
diff --git a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
new file mode 100644
index 000000000000..668616d9bb03
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
@@ -0,0 +1,53 @@
1#!/bin/sh
2# description: event tracing - enable/disable with event level files
3
4do_reset() {
5 echo > set_event
6 clear_trace
7}
8
9fail() { #msg
10 do_reset
11 echo $1
12 exit -1
13}
14
15if [ ! -f set_event -o ! -d events/sched ]; then
16 echo "event tracing is not supported"
17 exit_unsupported
18fi
19
20reset_tracer
21do_reset
22
23echo 'sched:sched_switch' > set_event
24usleep 1
25
26count=`cat trace | grep sched_switch | wc -l`
27if [ $count -eq 0 ]; then
28 fail "sched_switch events are not recorded"
29fi
30
31do_reset
32
33echo 1 > events/sched/sched_switch/enable
34usleep 1
35
36count=`cat trace | grep sched_switch | wc -l`
37if [ $count -eq 0 ]; then
38 fail "sched_switch events are not recorded"
39fi
40
41do_reset
42
43echo 0 > events/sched/sched_switch/enable
44usleep 1
45
46count=`cat trace | grep sched_switch | wc -l`
47if [ $count -ne 0 ]; then
48 fail "sched_switch events should not be recorded"
49fi
50
51do_reset
52
53exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
new file mode 100644
index 000000000000..655c415b6e7f
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
@@ -0,0 +1,53 @@
1#!/bin/sh
2# description: event tracing - enable/disable with subsystem level files
3
4do_reset() {
5 echo > set_event
6 clear_trace
7}
8
9fail() { #msg
10 do_reset
11 echo $1
12 exit -1
13}
14
15if [ ! -f set_event -o ! -d events/sched ]; then
16 echo "event tracing is not supported"
17 exit_unsupported
18fi
19
20reset_tracer
21do_reset
22
23echo 'sched:*' > set_event
24usleep 1
25
26count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
27if [ $count -lt 3 ]; then
28 fail "at least fork, exec and exit events should be recorded"
29fi
30
31do_reset
32
33echo 1 > events/sched/enable
34usleep 1
35
36count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
37if [ $count -lt 3 ]; then
38 fail "at least fork, exec and exit events should be recorded"
39fi
40
41do_reset
42
43echo 0 > events/sched/enable
44usleep 1
45
46count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
47if [ $count -ne 0 ]; then
48 fail "any of scheduler events should not be recorded"
49fi
50
51do_reset
52
53exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc b/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
new file mode 100644
index 000000000000..480845774007
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
@@ -0,0 +1,47 @@
1#!/bin/sh
2# description: event tracing - enable/disable with top level files
3
4do_reset() {
5 echo > set_event
6 clear_trace
7}
8
9fail() { #msg
10 do_reset
11 echo $1
12 exit -1
13}
14
15if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then
16 echo "event tracing is not supported"
17 exit_unsupported
18fi
19
20reset_tracer
21do_reset
22
23echo '*:*' > set_event
24count=`cat trace | grep -v ^# | wc -l`
25if [ $count -eq 0 ]; then
26 fail "none of events are recorded"
27fi
28
29do_reset
30
31echo 1 > events/enable
32count=`cat trace | grep -v ^# | wc -l`
33if [ $count -eq 0 ]; then
34 fail "none of events are recorded"
35fi
36
37do_reset
38
39echo 0 > events/enable
40count=`cat trace | grep -v ^# | wc -l`
41if [ $count -ne 0 ]; then
42 fail "any of events should not be recorded"
43fi
44
45do_reset
46
47exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc
new file mode 100644
index 000000000000..c15e018e0220
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc
@@ -0,0 +1,89 @@
1#!/bin/sh
2# description: ftrace - function graph filters with stack tracer
3
4# Make sure that function graph filtering works, and is not
5# affected by other tracers enabled (like stack tracer)
6
7if ! grep -q function_graph available_tracers; then
8 echo "no function graph tracer configured"
9 exit_unsupported
10fi
11
12if [ ! -f set_ftrace_filter ]; then
13 echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
14 exit_unsupported
15fi
16
17do_reset() {
18 reset_tracer
19 echo 0 > /proc/sys/kernel/stack_tracer_enabled
20 enable_tracing
21 clear_trace
22 echo > set_ftrace_filter
23}
24
25fail() { # msg
26 do_reset
27 echo $1
28 exit -1
29}
30
31disable_tracing
32clear_trace;
33
34# filter something, schedule is always good
35if ! echo "schedule" > set_ftrace_filter; then
36 # test for powerpc 64
37 if ! echo ".schedule" > set_ftrace_filter; then
38 fail "can not enable schedule filter"
39 fi
40fi
41
42echo function_graph > current_tracer
43
44if [ ! -f stack_trace ]; then
45 echo "Stack tracer not configured"
46 do_reset
47 exit_unsupported;
48fi
49
50echo "Now testing with stack tracer"
51
52echo 1 > /proc/sys/kernel/stack_tracer_enabled
53
54disable_tracing
55clear_trace
56enable_tracing
57sleep 1
58
59count=`cat trace | grep '()' | grep -v schedule | wc -l`
60
61if [ $count -ne 0 ]; then
62 fail "Graph filtering not working with stack tracer?"
63fi
64
65# Make sure we did find something
66count=`cat trace | grep 'schedule()' | wc -l`
67if [ $count -eq 0 ]; then
68 fail "No schedule traces found?"
69fi
70
71echo 0 > /proc/sys/kernel/stack_tracer_enabled
72clear_trace
73sleep 1
74
75
76count=`cat trace | grep '()' | grep -v schedule | wc -l`
77
78if [ $count -ne 0 ]; then
79 fail "Graph filtering not working after stack tracer disabled?"
80fi
81
82count=`cat trace | grep 'schedule()' | wc -l`
83if [ $count -eq 0 ]; then
84 fail "No schedule traces found?"
85fi
86
87do_reset
88
89exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc
new file mode 100644
index 000000000000..6af5f6360b18
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc
@@ -0,0 +1,52 @@
1#!/bin/sh
2# description: ftrace - function graph filters
3
4# Make sure that function graph filtering works
5
6if ! grep -q function_graph available_tracers; then
7 echo "no function graph tracer configured"
8 exit_unsupported
9fi
10
11do_reset() {
12 reset_tracer
13 enable_tracing
14 clear_trace
15}
16
17fail() { # msg
18 do_reset
19 echo $1
20 exit -1
21}
22
23disable_tracing
24clear_trace
25
26# filter something, schedule is always good
27if ! echo "schedule" > set_ftrace_filter; then
28 # test for powerpc 64
29 if ! echo ".schedule" > set_ftrace_filter; then
30 fail "can not enable schedule filter"
31 fi
32fi
33
34echo function_graph > current_tracer
35enable_tracing
36sleep 1
37# search for functions (has "()" on the line), and make sure
38# that only the schedule function was found
39count=`cat trace | grep '()' | grep -v schedule | wc -l`
40if [ $count -ne 0 ]; then
41 fail "Graph filtering not working by itself?"
42fi
43
44# Make sure we did find something
45count=`cat trace | grep 'schedule()' | wc -l`
46if [ $count -eq 0 ]; then
47 fail "No schedule traces found?"
48fi
49
50do_reset
51
52exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
new file mode 100644
index 000000000000..2e719cb1fc4d
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
@@ -0,0 +1,80 @@
1#!/bin/sh
2# description: ftrace - function profiler with function tracing
3
4# There was a bug after a rewrite of the ftrace infrastructure that
5# caused the function_profiler not to be able to run with the function
6# tracer, because the function_profiler used the function_graph tracer
7# and it was assumed the two could not run simultaneously.
8#
9# There was another related bug where the solution to the first bug
10# broke the way filtering of the function tracer worked.
11#
12# This test triggers those bugs on those kernels.
13#
14# We need function_graph and profiling to to run this test
15if ! grep -q function_graph available_tracers; then
16 echo "no function graph tracer configured"
17 exit_unsupported;
18fi
19
20if [ ! -f set_ftrace_filter ]; then
21 echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
22 exit_unsupported
23fi
24
25if [ ! -f function_profile_enabled ]; then
26 echo "function_profile_enabled not found, function profiling enabled?"
27 exit_unsupported
28fi
29
30fail() { # mesg
31 reset_tracer
32 echo > set_ftrace_filter
33 echo $1
34 exit -1
35}
36
37echo "Testing function tracer with profiler:"
38echo "enable function tracer"
39echo function > current_tracer
40echo "enable profiler"
41echo 1 > function_profile_enabled
42
43sleep 1
44
45echo "Now filter on just schedule"
46echo '*schedule' > set_ftrace_filter
47clear_trace
48
49echo "Now disable function profiler"
50echo 0 > function_profile_enabled
51
52sleep 1
53
54# make sure only schedule functions exist
55
56echo "testing if only schedule is being traced"
57if grep -v -e '^#' -e 'schedule' trace; then
58 fail "more than schedule was found"
59fi
60
61echo "Make sure schedule was traced"
62if ! grep -e 'schedule' trace > /dev/null; then
63 cat trace
64 fail "can not find schedule in trace"
65fi
66
67echo > set_ftrace_filter
68clear_trace
69
70sleep 1
71
72echo "make sure something other than scheduler is being traced"
73if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
74 cat trace
75 fail "no other functions besides schedule was found"
76fi
77
78reset_tracer
79
80exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
new file mode 100644
index 000000000000..5d8cd06d920f
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/functions
@@ -0,0 +1,16 @@
1
2clear_trace() { # reset trace output
3 echo > trace
4}
5
6disable_tracing() { # stop trace recording
7 echo 0 > tracing_on
8}
9
10enable_tracing() { # start trace recording
11 echo 1 > tracing_on
12}
13
14reset_tracer() { # reset the current tracer
15 echo nop > current_tracer
16}
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc b/tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc
index 1b8b665ab2b3..a5a426211129 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc
@@ -9,3 +9,4 @@ echo p:myevent do_fork > kprobe_events
9grep myevent kprobe_events 9grep myevent kprobe_events
10test -d events/kprobes/myevent 10test -d events/kprobes/myevent
11echo > kprobe_events 11echo > kprobe_events
12clear_trace
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc b/tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc
index b55c84003587..d8c7bb6581fe 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc
@@ -11,3 +11,4 @@ echo 1 > events/kprobes/myevent/enable
11echo > kprobe_events && exit 1 # this must fail 11echo > kprobe_events && exit 1 # this must fail
12echo 0 > events/kprobes/myevent/enable 12echo 0 > events/kprobes/myevent/enable
13echo > kprobe_events # this must succeed 13echo > kprobe_events # this must succeed
14clear_trace
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc
index a603d3f8db7b..c45ee2761354 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc
@@ -12,5 +12,6 @@ echo 1 > events/kprobes/testprobe/enable
12( echo "forked") 12( echo "forked")
13echo 0 > events/kprobes/testprobe/enable 13echo 0 > events/kprobes/testprobe/enable
14echo "-:testprobe" >> kprobe_events 14echo "-:testprobe" >> kprobe_events
15clear_trace
15test -d events/kprobes/testprobe && exit 1 || exit 0 16test -d events/kprobes/testprobe && exit 1 || exit 0
16 17
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
new file mode 100644
index 000000000000..ab41d2b29841
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
@@ -0,0 +1,55 @@
1#!/bin/sh
2# description: Kprobe dynamic event with function tracer
3
4[ -f kprobe_events ] || exit_unsupported # this is configurable
5grep function available_tracers || exit_unsupported # this is configurable
6
7# prepare
8echo nop > current_tracer
9echo do_fork > set_ftrace_filter
10echo 0 > events/enable
11echo > kprobe_events
12echo 'p:testprobe do_fork' > kprobe_events
13
14# kprobe on / ftrace off
15echo 1 > events/kprobes/testprobe/enable
16echo > trace
17( echo "forked")
18grep testprobe trace
19! grep 'do_fork <-' trace
20
21# kprobe on / ftrace on
22echo function > current_tracer
23echo > trace
24( echo "forked")
25grep testprobe trace
26grep 'do_fork <-' trace
27
28# kprobe off / ftrace on
29echo 0 > events/kprobes/testprobe/enable
30echo > trace
31( echo "forked")
32! grep testprobe trace
33grep 'do_fork <-' trace
34
35# kprobe on / ftrace on
36echo 1 > events/kprobes/testprobe/enable
37echo function > current_tracer
38echo > trace
39( echo "forked")
40grep testprobe trace
41grep 'do_fork <-' trace
42
43# kprobe on / ftrace off
44echo nop > current_tracer
45echo > trace
46( echo "forked")
47grep testprobe trace
48! grep 'do_fork <-' trace
49
50# cleanup
51echo nop > current_tracer
52echo > set_ftrace_filter
53echo 0 > events/kprobes/testprobe/enable
54echo > kprobe_events
55echo > trace
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc
index 283c29e7f7c4..31717985acc7 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc
@@ -12,4 +12,5 @@ echo 1 > events/kprobes/testprobe2/enable
12( echo "forked") 12( echo "forked")
13echo 0 > events/kprobes/testprobe2/enable 13echo 0 > events/kprobes/testprobe2/enable
14echo '-:testprobe2' >> kprobe_events 14echo '-:testprobe2' >> kprobe_events
15clear_trace
15test -d events/kprobes/testprobe2 && exit 1 || exit 0 16test -d events/kprobes/testprobe2 && exit 1 || exit 0