Path: blob/master/tools/testing/ktest/examples/bootconfigs/verify-boottrace.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}4748compare_file "events/task/task_newtask/filter" "pid < 128"49compare_file "events/task/task_newtask/enable" "1"5051compare_file "events/kprobes/vfs_read/filter" "common_pid < 200"52compare_file "events/kprobes/vfs_read/enable" "1"5354compare_file_partial "events/synthetic/initcall_latency/trigger" "hist:keys=func.sym,lat:vals=hitcount,lat:sort=lat"55compare_file_partial "events/synthetic/initcall_latency/enable" "0"5657compare_file_partial "events/initcall/initcall_start/trigger" "hist:keys=func:vals=hitcount:ts0=common_timestamp.usecs"58compare_file_partial "events/initcall/initcall_start/enable" "1"5960compare_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)'61compare_file_partial "events/initcall/initcall_finish/enable" "1"6263compare_file "instances/foo/current_tracer" "function"64file_contains "instances/foo/set_ftrace_filter" "^user"65compare_file "instances/foo/buffer_size_kb" "512"66compare_mask "instances/foo/tracing_cpumask" "1"67compare_file "instances/foo/options/sym-addr" "0"68file_contains "instances/foo/trace_clock" '\[mono\]'69compare_file_partial "instances/foo/events/signal/signal_deliver/trigger" "snapshot"7071compare_file "instances/bar/current_tracer" "function"72file_contains "instances/bar/set_ftrace_filter" "^kernel"73compare_mask "instances/bar/tracing_cpumask" "2"74file_contains "instances/bar/trace_clock" '\[x86-tsc\]'7576file_contains "snapshot" "Snapshot is allocated"77compare_file "options/sym-addr" "1"78compare_file "events/initcall/enable" "1"79compare_file "buffer_size_kb" "1027"80compare_file "current_tracer" "function"81file_contains "set_ftrace_filter" '^vfs'8283exit 0848586