-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests/ftrace: Add BTF arguments test cases
Add test cases to check the BTF arguments correctly supported. Link: https://lore.kernel.org/all/168507478292.913472.25631899274942311.stgit@mhiramat.roam.corp.google.com/ Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
- Loading branch information
Masami Hiramatsu (Google)
committed
Jun 6, 2023
1 parent
6335265
commit 4231f30
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# description: Generic dynamic event - add/remove probes with BTF arguments | ||
# requires: dynamic_events "<argname>":README | ||
|
||
KPROBES= | ||
FPROBES= | ||
|
||
if grep -qF "p[:[<group>/][<event>]] <place> [<args>]" README ; then | ||
KPROBES=yes | ||
fi | ||
if grep -qF "f[:[<group>/][<event>]] <func-name>[%return] [<args>]" README ; then | ||
FPROBES=yes | ||
fi | ||
|
||
if [ -z "$KPROBES" -a "$FPROBES" ] ; then | ||
exit_unsupported | ||
fi | ||
|
||
echo 0 > events/enable | ||
echo > dynamic_events | ||
|
||
TP=kfree | ||
|
||
if [ "$FPROBES" ] ; then | ||
echo "f:fpevent $TP object" >> dynamic_events | ||
echo "t:tpevent $TP ptr" >> dynamic_events | ||
|
||
grep -q "fpevent.*object=object" dynamic_events | ||
grep -q "tpevent.*ptr=ptr" dynamic_events | ||
|
||
echo > dynamic_events | ||
|
||
echo "f:fpevent $TP "'$arg1' >> dynamic_events | ||
grep -q "fpevent.*object=object" dynamic_events | ||
echo > dynamic_events | ||
|
||
echo "f:fpevent $TP "'$arg*' >> dynamic_events | ||
echo "t:tpevent $TP "'$arg*' >> dynamic_events | ||
|
||
grep -q "fpevent.*object=object" dynamic_events | ||
grep -q "tpevent.*ptr=ptr" dynamic_events | ||
! grep -q "tpevent.*_data" dynamic_events | ||
fi | ||
|
||
echo > dynamic_events | ||
|
||
if [ "$KPROBES" ] ; then | ||
echo "p:kpevent $TP object" >> dynamic_events | ||
grep -q "kpevent.*object=object" dynamic_events | ||
|
||
echo > dynamic_events | ||
|
||
echo "p:kpevent $TP "'$arg*' >> dynamic_events | ||
grep -q "kpevent.*object=object" dynamic_events | ||
fi | ||
|
||
clear_trace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters