brintos

brintos / linux-shallow public Read only

0
0
Text · 1.6 KiB · 01e111e Raw
73 lines · bash
1#!/bin/sh2 3cd /sys/kernel/tracing4 5compare_file() {6	file="$1"7	val="$2"8	content=`cat $file`9	if [ "$content" != "$val" ]; then10		echo "FAILED: $file has '$content', expected '$val'"11		exit 112	fi13}14 15compare_file_partial() {16	file="$1"17	val="$2"18	content=`cat $file | sed -ne "/^$val/p"`19	if [ -z "$content" ]; then20		echo "FAILED: $file does not contain '$val'"21		cat $file22		exit 123	fi24}25 26file_contains() {27	file=$128	val="$2"29 30	if ! grep -q "$val" $file ; then31		echo "FAILED: $file does not contain $val"32		cat $file33		exit 134	fi35}36 37compare_mask() {38	file=$139	val="$2"40 41	content=`cat $file | sed -ne "/^[0 ]*$val/p"`42	if [ -z "$content" ]; then43		echo "FAILED: $file does not have mask '$val'"44		cat $file45		exit 146	fi47}48 49compare_file "current_tracer" "function_graph"50compare_file "options/event-fork" "1"51compare_file "options/sym-addr" "1"52compare_file "options/stacktrace" "1"53compare_file "buffer_size_kb" "1024"54file_contains "snapshot" "Snapshot is allocated"55file_contains "trace_clock" '\[global\]'56 57compare_file "events/initcall/enable" "1"58compare_file "events/task/task_newtask/enable" "1"59compare_file "events/sched/sched_process_exec/filter" "pid < 128"60compare_file "events/kprobes/enable" "1"61 62compare_file "instances/bar/events/kprobes/myevent/enable" "1"63compare_file "instances/bar/events/kprobes/myevent2/enable" "1"64compare_file "instances/bar/events/kprobes/myevent3/enable" "1"65 66compare_file "instances/foo/current_tracer" "function"67compare_file "instances/foo/tracing_on" "0"68 69compare_file "/proc/sys/kernel/ftrace_dump_on_oops" "2"70compare_file "/proc/sys/kernel/traceoff_on_warning" "1"71 72exit 073