1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Kretprobe dynamic event with maxactive
4# requires: kprobe_events 'r[maxactive]':README
5
6# Test if we successfully reject unknown messages
7if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
8
9# Test if we successfully reject too big maxactive
10if echo 'r1000000:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
11
12# Test if we successfully reject unparsable numbers for maxactive
13if echo 'r10fuzz:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
14
15# Test for kretprobe with event name without maxactive
16echo 'r:myprobeaccept inet_csk_accept' > kprobe_events
17grep myprobeaccept kprobe_events
18test -d events/kprobes/myprobeaccept
19echo '-:myprobeaccept' >> kprobe_events
20
21# Test for kretprobe with event name with a small maxactive
22echo 'r10:myprobeaccept inet_csk_accept' > kprobe_events
23grep myprobeaccept kprobe_events
24test -d events/kprobes/myprobeaccept
25echo '-:myprobeaccept' >> kprobe_events
26
27# Test for kretprobe without event name without maxactive
28echo 'r inet_csk_accept' > kprobe_events
29grep inet_csk_accept kprobe_events
30echo > kprobe_events
31
32# Test for kretprobe without event name with a small maxactive
33echo 'r10 inet_csk_accept' > kprobe_events
34grep inet_csk_accept kprobe_events
35echo > kprobe_events
36