2024-05-04 00:33:14

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 0/2] selftests/ftrace: Fix some errors

Here is a couple of patches for fixing errors on ftracetest.
Shuah, can you pick these to your fixes branch? Or I also can push it.

Thank you,
---

Masami Hiramatsu (Google) (2):
selftests/ftrace: Fix BTFARG testcase to check fprobe is enabled correctly
selftests/ftrace: Fix checkbashisms errors


.../ftrace/test.d/dynevent/add_remove_btfarg.tc | 2 +-
.../ftrace/test.d/dynevent/fprobe_entry_arg.tc | 2 +-
.../ftrace/test.d/kprobe/kretprobe_entry_arg.tc | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

--
Masami Hiramatsu (Google) <[email protected]>


2024-05-04 00:34:16

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 1/2] selftests/ftrace: Fix BTFARG testcase to check fprobe is enabled correctly

From: Masami Hiramatsu (Google) <[email protected]>

Since the dynevent/add_remove_btfarg.tc test case forgets to ensure that
fprobe is enabled for some structure field access tests which uses the
fprobe, it fails if CONFIG_FPROBE=n or CONFIG_FPROBE_EVENTS=n.
Fixes it to ensure the fprobe events are supported.

Fixes: d892d3d3d885 ("selftests/ftrace: Add BTF fields access testcases")
Cc: [email protected]
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
---
.../ftrace/test.d/dynevent/add_remove_btfarg.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
index b9c21a81d248..c0cdad4c400e 100644
--- a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
@@ -53,7 +53,7 @@ fi

echo > dynamic_events

-if [ "$FIELDS" ] ; then
+if [ "$FIELDS" -a "$FPROBES" ] ; then
echo "t:tpevent ${TP2} obj_size=s->object_size" >> dynamic_events
echo "f:fpevent ${TP3}%return path=\$retval->name:string" >> dynamic_events
echo "t:tpevent2 ${TP4} p->se.group_node.next->prev" >> dynamic_events


2024-05-04 00:34:35

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 2/2] selftests/ftrace: Fix checkbashisms errors

From: Masami Hiramatsu (Google) <[email protected]>

Fix the below checkbashisms errors. Because of these errors, these tests
will fail on dash shell.

possible bashism in test.d/kprobe/kretprobe_entry_arg.tc line 14 ('function' is useless):
function streq() {
possible bashism in test.d/dynevent/fprobe_entry_arg.tc line 14 ('function' is useless):
function streq() {

Fixes: f6e2253a617c ("selftests/ftrace: Add test cases for entry args at function exit")
Cc: [email protected]
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
---
.../ftrace/test.d/dynevent/fprobe_entry_arg.tc | 2 +-
.../ftrace/test.d/kprobe/kretprobe_entry_arg.tc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc
index d183b8a8ecf8..1e251ce2998e 100644
--- a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc
@@ -11,7 +11,7 @@ echo 1 > events/tests/enable
echo > trace
cat trace > /dev/null

-function streq() {
+streq() {
test $1 = $2
}

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc
index 53b82f36a1d0..e50470b53164 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc
@@ -11,7 +11,7 @@ echo 1 > events/kprobes/enable
echo > trace
cat trace > /dev/null

-function streq() {
+streq() {
test $1 = $2
}