diff options
| author | Masami Hiramatsu <mhiramat@kernel.org> | 2017-07-07 14:57:33 -0400 |
|---|---|---|
| committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-07-09 07:46:28 -0400 |
| commit | 8cb0bc9e3f863f3e77522d02443a75c0e45a6ed0 (patch) | |
| tree | f26106bcab2ee3acca41f6b6efadee9561a5baf4 /tools/testing | |
| parent | ff431b1390cbf8764f8550b8e427eb28d4a6328e (diff) | |
selftests/ftrace: Add a testcase for kprobe event naming
Add a testcase for kprobe event naming. This testcase checks whether the
kprobe events can automatically ganerate its event name on normal
function and dot-suffixed function. Also it checks whether the kprobe
events can correctly define new event with given event name and group
name.
Link: http://lkml.kernel.org/r/61ae96fd1fcd14ee652c8b6525c218b8661bb0d2.1499453040.git.naveen.n.rao@linux.vnet.ibm.com
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
[Updated tests to use vfs_read and symbols with '.isra.',
added check for kprobe_events and a command to clear it on exit,
various additional checks and tests]
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc new file mode 100644 index 000000000000..b9302cc82c12 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # description: Kprobe event auto/manual naming | ||
| 3 | |||
| 4 | [ -f kprobe_events ] || exit_unsupported # this is configurable | ||
| 5 | |||
| 6 | disable_events | ||
| 7 | echo > kprobe_events | ||
| 8 | |||
| 9 | :;: "Add an event on function without name" ;: | ||
| 10 | |||
| 11 | FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "` | ||
| 12 | [ "x" != "x$FUNC" ] || exit_unresolved | ||
| 13 | echo "p $FUNC" > kprobe_events | ||
| 14 | PROBE_NAME=`echo $FUNC | tr ".:" "_"` | ||
| 15 | test -d events/kprobes/p_${PROBE_NAME}_0 || exit_failure | ||
| 16 | |||
| 17 | :;: "Add an event on function with new name" ;: | ||
| 18 | |||
| 19 | echo "p:event1 $FUNC" > kprobe_events | ||
| 20 | test -d events/kprobes/event1 || exit_failure | ||
| 21 | |||
| 22 | :;: "Add an event on function with new name and group" ;: | ||
| 23 | |||
| 24 | echo "p:kprobes2/event2 $FUNC" > kprobe_events | ||
| 25 | test -d events/kprobes2/event2 || exit_failure | ||
| 26 | |||
| 27 | :;: "Add an event on dot function without name" ;: | ||
| 28 | |||
| 29 | FUNC=`grep -m 10 " [tT] .*\.isra\..*$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "` | ||
| 30 | [ "x" != "x$FUNC" ] || exit_unresolved | ||
| 31 | echo "p $FUNC" > kprobe_events | ||
| 32 | EVENT=`grep $FUNC kprobe_events | cut -f 1 -d " " | cut -f 2 -d:` | ||
| 33 | [ "x" != "x$EVENT" ] || exit_failure | ||
| 34 | test -d events/$EVENT || exit_failure | ||
| 35 | |||
| 36 | echo > kprobe_events | ||
