Path: blob/master/tools/testing/ktest/examples/bootconfigs/verify-tracing.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 "current_tracer" "function_graph"49compare_file "options/event-fork" "1"50compare_file "options/sym-addr" "1"51compare_file "options/stacktrace" "1"52compare_file "buffer_size_kb" "1024"53file_contains "snapshot" "Snapshot is allocated"54file_contains "trace_clock" '\[global\]'5556compare_file "events/initcall/enable" "1"57compare_file "events/task/task_newtask/enable" "1"58compare_file "events/sched/sched_process_exec/filter" "pid < 128"59compare_file "events/kprobes/enable" "1"6061compare_file "instances/bar/events/kprobes/myevent/enable" "1"62compare_file "instances/bar/events/kprobes/myevent2/enable" "1"63compare_file "instances/bar/events/kprobes/myevent3/enable" "1"6465compare_file "instances/foo/current_tracer" "function"66compare_file "instances/foo/tracing_on" "0"6768compare_file "/proc/sys/kernel/ftrace_dump_on_oops" "2"69compare_file "/proc/sys/kernel/traceoff_on_warning" "1"7071exit 0727374