Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 
0003 cd /sys/kernel/tracing
0004 
0005 compare_file() {
0006         file="$1"
0007         val="$2"
0008         content=`cat $file`
0009         if [ "$content" != "$val" ]; then
0010                 echo "FAILED: $file has '$content', expected '$val'"
0011                 exit 1
0012         fi
0013 }
0014 
0015 compare_file_partial() {
0016         file="$1"
0017         val="$2"
0018         content=`cat $file | sed -ne "/^$val/p"`
0019         if [ -z "$content" ]; then
0020                 echo "FAILED: $file does not contain '$val'"
0021                 cat $file
0022                 exit 1
0023         fi
0024 }
0025 
0026 file_contains() {
0027         file=$1
0028         val="$2"
0029 
0030         if ! grep -q "$val" $file ; then
0031                 echo "FAILED: $file does not contain $val"
0032                 cat $file
0033                 exit 1
0034         fi
0035 }
0036 
0037 compare_mask() {
0038         file=$1
0039         val="$2"
0040 
0041         content=`cat $file | sed -ne "/^[0 ]*$val/p"`
0042         if [ -z "$content" ]; then
0043                 echo "FAILED: $file does not have mask '$val'"
0044                 cat $file
0045                 exit 1
0046         fi
0047 }
0048 
0049 
0050 compare_file "tracing_on" "0"
0051 compare_file "current_tracer" "function_graph"
0052 
0053 compare_file_partial "events/kprobes/start_event/enable" "1"
0054 compare_file_partial "events/kprobes/start_event/trigger" "traceon"
0055 file_contains "kprobe_events" 'start_event.*pci_proc_init'
0056 
0057 compare_file_partial "events/kprobes/end_event/enable" "1"
0058 compare_file_partial "events/kprobes/end_event/trigger" "traceoff"
0059 file_contains "kprobe_events" '^r.*end_event.*pci_proc_init'
0060 
0061 exit 0