Skip to content

Commit

Permalink
ftrace/selftests: Update the direct call selftests to test two direct…
Browse files Browse the repository at this point in the history
… calls

The register_ftrace_direct() takes a different path if there's already a
direct call registered, but this was not tested in the self tests. Now that
there's a second direct caller test module, we can use this to test not only
one direct caller, but two.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt (VMware) committed Nov 13, 2019
1 parent 156473a commit ed9dafe
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 23 deletions.
16 changes: 16 additions & 0 deletions tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,19 @@ done

echo nop > current_tracer
rmmod ftrace-direct ||:

# Now do the same thing with another direct function registered
echo "Running with another ftrace direct function"

rmmod ftrace-direct-too ||:
modprobe ftrace-direct-too

for t in `cat available_tracers`; do
if [ "$t" != "nop" ]; then
test_tracer $t
fi
done

echo nop > current_tracer
rmmod ftrace-direct ||:
rmmod ftrace-direct-too ||:
59 changes: 36 additions & 23 deletions tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,41 @@ disable_probe() {
echo 0 > events/kprobes/kwake/enable
}

# probe -> direct -> no direct > no probe
enable_probe
start_direct
stop_direct
disable_probe

# probe -> direct -> no probe > no direct
enable_probe
start_direct
disable_probe
stop_direct

# direct -> probe -> no probe > no direct
start_direct
enable_probe
disable_probe
stop_direct

# direct -> probe -> no direct > no noprobe
start_direct
enable_probe
stop_direct
disable_probe
test_kprobes() {
# probe -> direct -> no direct > no probe
enable_probe
start_direct
stop_direct
disable_probe

# probe -> direct -> no probe > no direct
enable_probe
start_direct
disable_probe
stop_direct

# direct -> probe -> no probe > no direct
start_direct
enable_probe
disable_probe
stop_direct

# direct -> probe -> no direct > no noprobe
start_direct
enable_probe
stop_direct
disable_probe
}

test_kprobes

# Now do this with a second registered direct function
echo "Running with another ftrace direct function"

modprobe ftrace-direct-too

test_kprobes

rmmod ftrace-direct-too

echo > kprobe_events

0 comments on commit ed9dafe

Please sign in to comment.