Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/tools/testing/ktest/examples/bootconfigs/verify-functiongraph.sh
26299 views
1
#!/bin/sh
2
3
cd /sys/kernel/tracing
4
5
compare_file() {
6
file="$1"
7
val="$2"
8
content=`cat $file`
9
if [ "$content" != "$val" ]; then
10
echo "FAILED: $file has '$content', expected '$val'"
11
exit 1
12
fi
13
}
14
15
compare_file_partial() {
16
file="$1"
17
val="$2"
18
content=`cat $file | sed -ne "/^$val/p"`
19
if [ -z "$content" ]; then
20
echo "FAILED: $file does not contain '$val'"
21
cat $file
22
exit 1
23
fi
24
}
25
26
file_contains() {
27
file=$1
28
val="$2"
29
30
if ! grep -q "$val" $file ; then
31
echo "FAILED: $file does not contain $val"
32
cat $file
33
exit 1
34
fi
35
}
36
37
compare_mask() {
38
file=$1
39
val="$2"
40
41
content=`cat $file | sed -ne "/^[0 ]*$val/p"`
42
if [ -z "$content" ]; then
43
echo "FAILED: $file does not have mask '$val'"
44
cat $file
45
exit 1
46
fi
47
}
48
49
50
compare_file "tracing_on" "0"
51
compare_file "current_tracer" "function_graph"
52
53
compare_file_partial "events/kprobes/start_event/enable" "1"
54
compare_file_partial "events/kprobes/start_event/trigger" "traceon"
55
file_contains "kprobe_events" 'start_event.*pci_proc_init'
56
57
compare_file_partial "events/kprobes/end_event/enable" "1"
58
compare_file_partial "events/kprobes/end_event/trigger" "traceoff"
59
file_contains "kprobe_events" '^r.*end_event.*pci_proc_init'
60
61
exit 0
62
63