Skip to content

Commit

Permalink
selftests/ftrace: Fix kprobe string testcase to not probe notrace fun…
Browse files Browse the repository at this point in the history
…ction

Fix kprobe string argument testcase to not probe notrace
function. Instead, it probes tracefs function which must
be available with ftrace.

Signed-off-by: Masami Hiramatsu <[email protected]>
Acked-by: Steven Rostedt (VMware) <[email protected]>
Signed-off-by: Shuah Khan (Samsung OSG) <[email protected]>
  • Loading branch information
mhiramat authored and Shuah Khan (Samsung OSG) committed Aug 9, 2018
1 parent 9a29ad5 commit 01675e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
30 changes: 12 additions & 18 deletions tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,40 @@ echo > kprobe_events

case `uname -m` in
x86_64)
ARG2=%si
OFFS=8
ARG1=%di
;;
i[3456]86)
ARG2=%cx
OFFS=4
ARG1=%ax
;;
aarch64)
ARG2=%x1
OFFS=8
ARG1=%x0
;;
arm*)
ARG2=%r1
OFFS=4
ARG1=%r0
;;
ppc64*)
ARG2=%r4
OFFS=8
ARG1=%r3
;;
ppc*)
ARG2=%r4
OFFS=4
ARG1=%r3
;;
*)
echo "Please implement other architecture here"
exit_untested
esac

: "Test get argument (1)"
echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string" > kprobe_events
echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
echo 1 > events/kprobes/testprobe/enable
! echo test >> kprobe_events
tail -n 1 trace | grep -qe "testprobe.* arg1=\"test\""
echo "p:test _do_fork" >> kprobe_events
grep -qe "testprobe.* arg1=\"test\"" trace

echo 0 > events/kprobes/testprobe/enable
: "Test get argument (2)"
echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string arg2=+0(+${OFFS}(${ARG2})):string" > kprobe_events
echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
echo 1 > events/kprobes/testprobe/enable
! echo test1 test2 >> kprobe_events
tail -n 1 trace | grep -qe "testprobe.* arg1=\"test1\" arg2=\"test2\""
echo "p:test _do_fork" >> kprobe_events
grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace

echo 0 > events/enable
echo > kprobe_events
2 changes: 1 addition & 1 deletion tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[ -f kprobe_events ] || exit_unsupported # this is configurable

TARGET_FUNC=create_trace_kprobe
TARGET_FUNC=tracefs_create_dir

dec_addr() { # hexaddr
printf "%d" "0x"`echo $1 | tail -c 8`
Expand Down

0 comments on commit 01675e9

Please sign in to comment.