summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/ftrace/test.d/dynevent/clear_select_events.tc
blob: e0842109cb57733c11ab67bcf8250b54d3e1f095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: Generic dynamic event - selective clear (compatibility)

[ -f dynamic_events ] || exit_unsupported

grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported

grep -q "s:\[synthetic/\]" README || exit_unsupported

[ -f synthetic_events ] || exit_unsupported
[ -f kprobe_events ] || exit_unsupported

echo 0 > events/enable
echo > dynamic_events

PLACE=_do_fork

setup_events() {
echo "p:myevent1 $PLACE" >> dynamic_events
echo "s:latency1 u64 lat; pid_t pid;" >> dynamic_events
echo "r:myevent2 $PLACE" >> dynamic_events
echo "s:latency2 u64 lat; pid_t pid;" >> dynamic_events

grep -q myevent1 dynamic_events
grep -q myevent2 dynamic_events
grep -q latency1 dynamic_events
grep -q latency2 dynamic_events
}

setup_events
echo > synthetic_events

grep -q myevent1 dynamic_events
grep -q myevent2 dynamic_events
! grep -q latency1 dynamic_events
! grep -q latency2 dynamic_events

echo > dynamic_events

setup_events
echo > kprobe_events

! grep -q myevent1 dynamic_events
! grep -q myevent2 dynamic_events
grep -q latency1 dynamic_events
grep -q latency2 dynamic_events

echo > dynamic_events