Skip to content

Commit c01768b

Browse files
Ye Binmhiramat
authored andcommitted
selftests/ftrace: add kprobe test cases for VFS type "%pd" and "%pD"
This patch adds test cases for new print format type "%pd/%pD".The test cases test the following items: 1. Test README if add "%pd/%pD" type; 2. Test "%pd" type for dput(); 3. Test "%pD" type for vfs_read(); This test case require enable CONFIG_HAVE_FUNCTION_ARG_ACCESS_API configuration. Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Ye Bin <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 5e37460 commit c01768b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
# description: Kprobe event VFS type argument
4+
# requires: kprobe_events "%pd/%pD":README
5+
6+
: "Test argument %pd with name"
7+
echo 'p:testprobe dput name=$arg1:%pd' > kprobe_events
8+
echo 1 > events/kprobes/testprobe/enable
9+
grep -q "1" events/kprobes/testprobe/enable
10+
echo 0 > events/kprobes/testprobe/enable
11+
grep "dput" trace | grep -q "enable"
12+
echo "" > kprobe_events
13+
echo "" > trace
14+
15+
: "Test argument %pd without name"
16+
echo 'p:testprobe dput $arg1:%pd' > kprobe_events
17+
echo 1 > events/kprobes/testprobe/enable
18+
grep -q "1" events/kprobes/testprobe/enable
19+
echo 0 > events/kprobes/testprobe/enable
20+
grep "dput" trace | grep -q "enable"
21+
echo "" > kprobe_events
22+
echo "" > trace
23+
24+
: "Test argument %pD with name"
25+
echo 'p:testprobe vfs_read name=$arg1:%pD' > kprobe_events
26+
echo 1 > events/kprobes/testprobe/enable
27+
grep -q "1" events/kprobes/testprobe/enable
28+
echo 0 > events/kprobes/testprobe/enable
29+
grep "vfs_read" trace | grep -q "enable"
30+
echo "" > kprobe_events
31+
echo "" > trace
32+
33+
: "Test argument %pD without name"
34+
echo 'p:testprobe vfs_read $arg1:%pD' > kprobe_events
35+
echo 1 > events/kprobes/testprobe/enable
36+
grep -q "1" events/kprobes/testprobe/enable
37+
echo 0 > events/kprobes/testprobe/enable
38+
grep "vfs_read" trace | grep -q "enable"
39+
echo "" > kprobe_events
40+
echo "" > trace

0 commit comments

Comments
 (0)