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
6grep -q 'r\[maxactive\]' README || exit_unsupported # this is older version
7
8# Test if we successfully reject unknown messages
9if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
10
11# Test if we successfully reject too big maxactive
12if echo 'r1000000:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
13
14# Test if we successfully reject unparsable numbers for maxactive
15if echo 'r10fuzz:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
16
17# Test for kretprobe with event name without maxactive
18echo 'r:myprobeaccept inet_csk_accept' > kprobe_events
19grep myprobeaccept kprobe_events
20test -d events/kprobes/myprobeaccept
21echo '-:myprobeaccept' >> kprobe_events
22
23# Test for kretprobe with event name with a small maxactive
24echo 'r10:myprobeaccept inet_csk_accept' > kprobe_events
25grep myprobeaccept kprobe_events
26test -d events/kprobes/myprobeaccept
27echo '-:myprobeaccept' >> kprobe_events
28
29# Test for kretprobe without event name without maxactive
30echo 'r inet_csk_accept' > kprobe_events
31grep inet_csk_accept kprobe_events
32echo > kprobe_events
33
34# Test for kretprobe without event name with a small maxactive
35echo 'r10 inet_csk_accept' > kprobe_events
36grep inet_csk_accept kprobe_events
37echo > kprobe_events
38