GNU Linux-libre 4.19.245-gnu1
[releases.git] / tools / testing / selftests / ftrace / test.d / kprobe / kretprobe_maxactive.tc
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kretprobe dynamic event with maxactive
4
5 [ -f kprobe_events ] || exit_unsupported # this is configurable
6 grep -q 'r\[maxactive\]' README || exit_unsupported # this is older version
7
8 echo > kprobe_events
9
10 # Test if we successfully reject unknown messages
11 if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
12
13 # Test if we successfully reject too big maxactive
14 if echo 'r1000000:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
15
16 # Test if we successfully reject unparsable numbers for maxactive
17 if echo 'r10fuzz:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
18
19 # Test for kretprobe with event name without maxactive
20 echo 'r:myprobeaccept inet_csk_accept' > kprobe_events
21 grep myprobeaccept kprobe_events
22 test -d events/kprobes/myprobeaccept
23 echo '-:myprobeaccept' >> kprobe_events
24
25 # Test for kretprobe with event name with a small maxactive
26 echo 'r10:myprobeaccept inet_csk_accept' > kprobe_events
27 grep myprobeaccept kprobe_events
28 test -d events/kprobes/myprobeaccept
29 echo '-:myprobeaccept' >> kprobe_events
30
31 # Test for kretprobe without event name without maxactive
32 echo 'r inet_csk_accept' > kprobe_events
33 grep inet_csk_accept kprobe_events
34 echo > kprobe_events
35
36 # Test for kretprobe without event name with a small maxactive
37 echo 'r10 inet_csk_accept' > kprobe_events
38 grep inet_csk_accept kprobe_events
39 echo > kprobe_events
40
41 clear_trace