arm64: vdso32: Fix '--prefix=' value for newer versions of clang
[linux-2.6-microblaze.git] / tools / testing / selftests / ftrace / test.d / kprobe / kprobe_module.tc
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kprobe dynamic event - probing module
4
5 [ -f kprobe_events ] || exit_unsupported # this is configurable
6
7 rmmod trace-printk ||:
8 if ! modprobe trace-printk ; then
9   echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
10 m"
11   exit_unresolved;
12 fi
13
14 MOD=trace_printk
15 FUNC=trace_printk_irq_work
16
17 :;: "Add an event on a module function without specifying event name" ;:
18
19 echo "p $MOD:$FUNC" > kprobe_events
20 PROBE_NAME=`echo $MOD:$FUNC | tr ".:" "_"`
21 test -d events/kprobes/p_${PROBE_NAME}_0 || exit_failure
22
23 :;: "Add an event on a module function with new event name" ;:
24
25 echo "p:event1 $MOD:$FUNC" > kprobe_events
26 test -d events/kprobes/event1 || exit_failure
27
28 :;: "Add an event on a module function with new event and group name" ;:
29
30 echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events
31 test -d events/kprobes1/event1 || exit_failure
32
33 :;: "Remove target module, but event still be there" ;:
34 if ! rmmod trace-printk ; then
35   echo "Failed to unload module - please enable CONFIG_MODULE_UNLOAD"
36   exit_unresolved;
37 fi
38 test -d events/kprobes1/event1
39
40 :;: "Check posibility to defining events on unloaded module";:
41 echo "p:event2 $MOD:$FUNC" >> kprobe_events
42
43 :;: "Target is gone, but we can prepare for next time";:
44 echo 1 > events/kprobes1/event1/enable
45
46 :;: "Load module again, which means the event1 should be recorded";:
47 modprobe trace-printk
48 grep "event1:" trace
49
50 :;: "Remove the module again and check the event is not locked"
51 rmmod trace-printk
52 echo 0 > events/kprobes1/event1/enable
53 echo "-:kprobes1/event1" >> kprobe_events