Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / tools / testing / selftests / ftrace / test.d / ftrace / fgraph-filter.tc
1 #!/bin/sh
2 # description: ftrace - function graph filters
3
4 # Make sure that function graph filtering works
5
6 if ! grep -q function_graph available_tracers; then
7     echo "no function graph tracer configured"
8     exit_unsupported
9 fi
10
11 do_reset() {
12     reset_tracer
13     enable_tracing
14     clear_trace
15 }
16
17 fail() { # msg
18     do_reset
19     echo $1
20     exit $FAIL
21 }
22
23 disable_tracing
24 clear_trace
25
26 # filter something, schedule is always good
27 if ! 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
32 fi
33
34 echo function_graph > current_tracer
35 enable_tracing
36 sleep 1
37 # search for functions (has "()" on the line), and make sure
38 # that only the schedule function was found
39 count=`cat trace | grep '()' | grep -v schedule | wc -l`
40 if [ $count -ne 0 ]; then
41     fail "Graph filtering not working by itself?"
42 fi
43
44 # Make sure we did find something
45 count=`cat trace | grep 'schedule()' | wc -l` 
46 if [ $count -eq 0 ]; then
47     fail "No schedule traces found?"
48 fi
49
50 do_reset
51
52 exit 0