Path: blob/master/tools/testing/ktest/examples/bootconfigs/verify-functiongraph.sh
26299 views
#!/bin/sh12cd /sys/kernel/tracing34compare_file() {5file="$1"6val="$2"7content=`cat $file`8if [ "$content" != "$val" ]; then9echo "FAILED: $file has '$content', expected '$val'"10exit 111fi12}1314compare_file_partial() {15file="$1"16val="$2"17content=`cat $file | sed -ne "/^$val/p"`18if [ -z "$content" ]; then19echo "FAILED: $file does not contain '$val'"20cat $file21exit 122fi23}2425file_contains() {26file=$127val="$2"2829if ! grep -q "$val" $file ; then30echo "FAILED: $file does not contain $val"31cat $file32exit 133fi34}3536compare_mask() {37file=$138val="$2"3940content=`cat $file | sed -ne "/^[0 ]*$val/p"`41if [ -z "$content" ]; then42echo "FAILED: $file does not have mask '$val'"43cat $file44exit 145fi46}474849compare_file "tracing_on" "0"50compare_file "current_tracer" "function_graph"5152compare_file_partial "events/kprobes/start_event/enable" "1"53compare_file_partial "events/kprobes/start_event/trigger" "traceon"54file_contains "kprobe_events" 'start_event.*pci_proc_init'5556compare_file_partial "events/kprobes/end_event/enable" "1"57compare_file_partial "events/kprobes/end_event/trigger" "traceoff"58file_contains "kprobe_events" '^r.*end_event.*pci_proc_init'5960exit 0616263