]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / tools / testing / selftests / ftrace / test.d / kprobe / kprobe_module.tc
CommitLineData
ff431b13 1#!/bin/sh
b2441318 2# SPDX-License-Identifier: GPL-2.0
ff431b13
NR
3# description: Kprobe dynamic event - probing module
4
5[ -f kprobe_events ] || exit_unsupported # this is configurable
6
7disable_events
8echo > kprobe_events
9
10:;: "Add an event on a module function without specifying event name" ;:
11
12MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
13FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
14[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_unresolved
15echo "p $MOD:$FUNC" > kprobe_events
16PROBE_NAME=`echo $MOD:$FUNC | tr ".:" "_"`
17test -d events/kprobes/p_${PROBE_NAME}_0 || exit_failure
18
19:;: "Add an event on a module function with new event name" ;:
20
21echo "p:event1 $MOD:$FUNC" > kprobe_events
22test -d events/kprobes/event1 || exit_failure
23
24:;: "Add an event on a module function with new event and group name" ;:
25
26echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events
27test -d events/kprobes1/event1 || exit_failure
28
29echo > kprobe_events