Merge tag 'pinctrl-v5.8-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6-microblaze.git] / tools / testing / selftests / ftrace / test.d / ftrace / fgraph-filter.tc
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: ftrace - function graph filters
4 # requires: set_ftrace_filter function_graph:tracer
5
6 # Make sure that function graph filtering works
7
8 fail() { # msg
9     echo $1
10     exit_fail
11 }
12
13 disable_tracing
14 clear_trace
15
16 # filter something, schedule is always good
17 if ! echo "schedule" > set_ftrace_filter; then
18     # test for powerpc 64
19     if ! echo ".schedule" > set_ftrace_filter; then
20         fail "can not enable schedule filter"
21     fi
22 fi
23
24 echo function_graph > current_tracer
25 enable_tracing
26 sleep 1
27 # search for functions (has "()" on the line), and make sure
28 # that only the schedule function was found
29 count=`cat trace | grep '()' | grep -v schedule | wc -l`
30 if [ $count -ne 0 ]; then
31     fail "Graph filtering not working by itself?"
32 fi
33
34 # Make sure we did find something
35 count=`cat trace | grep 'schedule()' | wc -l` 
36 if [ $count -eq 0 ]; then
37     fail "No schedule traces found?"
38 fi
39
40 exit 0