| 1 | |
| 2 |
|
| 3 | cd /sys/kernel/tracing
|
| 4 |
|
| 5 | compare_file() {
|
| 6 | file="$1"
|
| 7 | val="$2"
|
| 8 | content=`cat $file`
|
| 9 | if [ "$content" != "$val" ]; then
|
| 10 | echo "FAILED: $file has '$content', expected '$val'"
|
| 11 | exit 1
|
| 12 | fi
|
| 13 | }
|
| 14 |
|
| 15 | compare_file_partial() {
|
| 16 | file="$1"
|
| 17 | val="$2"
|
| 18 | content=`cat $file | sed -ne "/^$val/p"`
|
| 19 | if [ -z "$content" ]; then
|
| 20 | echo "FAILED: $file does not contain '$val'"
|
| 21 | cat $file
|
| 22 | exit 1
|
| 23 | fi
|
| 24 | }
|
| 25 |
|
| 26 | file_contains() {
|
| 27 | file=$1
|
| 28 | val="$2"
|
| 29 |
|
| 30 | if ! grep -q "$val" $file ; then
|
| 31 | echo "FAILED: $file does not contain $val"
|
| 32 | cat $file
|
| 33 | exit 1
|
| 34 | fi
|
| 35 | }
|
| 36 |
|
| 37 | compare_mask() {
|
| 38 | file=$1
|
| 39 | val="$2"
|
| 40 |
|
| 41 | content=`cat $file | sed -ne "/^[0 ]*$val/p"`
|
| 42 | if [ -z "$content" ]; then
|
| 43 | echo "FAILED: $file does not have mask '$val'"
|
| 44 | cat $file
|
| 45 | exit 1
|
| 46 | fi
|
| 47 | }
|
| 48 |
|
| 49 | compare_file "events/task/task_newtask/filter" "pid < 128"
|
| 50 | compare_file "events/task/task_newtask/enable" "1"
|
| 51 |
|
| 52 | compare_file "events/kprobes/vfs_read/filter" "common_pid < 200"
|
| 53 | compare_file "events/kprobes/vfs_read/enable" "1"
|
| 54 |
|
| 55 | compare_file_partial "events/synthetic/initcall_latency/trigger" "hist:keys=func.sym,lat:vals=hitcount,lat:sort=lat"
|
| 56 | compare_file_partial "events/synthetic/initcall_latency/enable" "0"
|
| 57 |
|
| 58 | compare_file_partial "events/initcall/initcall_start/trigger" "hist:keys=func:vals=hitcount:ts0=common_timestamp.usecs"
|
| 59 | compare_file_partial "events/initcall/initcall_start/enable" "1"
|
| 60 |
|
| 61 | compare_file_partial "events/initcall/initcall_finish/trigger" 'hist:keys=func:vals=hitcount:lat=common_timestamp.usecs-\$ts0:sort=hitcount:size=2048:clock=global:onmatch(initcall.initcall_start).trace(initcall_latency,func,\$lat)'
|
| 62 | compare_file_partial "events/initcall/initcall_finish/enable" "1"
|
| 63 |
|
| 64 | compare_file "instances/foo/current_tracer" "function"
|
| 65 | file_contains "instances/foo/set_ftrace_filter" "^user"
|
| 66 | compare_file "instances/foo/buffer_size_kb" "512"
|
| 67 | compare_mask "instances/foo/tracing_cpumask" "1"
|
| 68 | compare_file "instances/foo/options/sym-addr" "0"
|
| 69 | file_contains "instances/foo/trace_clock" '\[mono\]'
|
| 70 | compare_file_partial "instances/foo/events/signal/signal_deliver/trigger" "snapshot"
|
| 71 |
|
| 72 | compare_file "instances/bar/current_tracer" "function"
|
| 73 | file_contains "instances/bar/set_ftrace_filter" "^kernel"
|
| 74 | compare_mask "instances/bar/tracing_cpumask" "2"
|
| 75 | file_contains "instances/bar/trace_clock" '\[x86-tsc\]'
|
| 76 |
|
| 77 | file_contains "snapshot" "Snapshot is allocated"
|
| 78 | compare_file "options/sym-addr" "1"
|
| 79 | compare_file "events/initcall/enable" "1"
|
| 80 | compare_file "buffer_size_kb" "1027"
|
| 81 | compare_file "current_tracer" "function"
|
| 82 | file_contains "set_ftrace_filter" '^vfs'
|
| 83 |
|
| 84 | exit 0
|