[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <171651179523.161068.3164659198838770307.stgit@devnote2>
Date: Fri, 24 May 2024 09:49:55 +0900
From: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>,
Shuah Khan <shuah@...nel.org>
Cc: Andrii Nakryiko <andrii@...nel.org>,
oleg@...hat.com,
jolsa@...nel.org,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
mhiramat@...nel.org,
linux-kselftest@...r.kernel.org
Subject: [PATCH] selftests/uprobes: Add a basic uprobe testcase
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Add a basic uprobe testcase which checks whether add/remove/trace
operations works on /bin/sh.
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
---
.../ftrace/test.d/dynevent/add_remove_uprobe.tc | 26 ++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
new file mode 100644
index 000000000000..a275decdc880
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
@@ -0,0 +1,26 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Generic dynamic event - add/remove/test uprobe events
+# requires: uprobe_events
+
+echo 0 > events/enable
+echo > dynamic_events
+
+echo 'cat /proc/$$/maps' | /bin/sh | \
+ grep "r-xp .*/bin/.*sh$" | \
+ awk '{printf "p:myevent %s:0x%s\n", $6,$3 }' >> uprobe_events
+
+grep -q myevent uprobe_events
+test -d events/uprobes/myevent
+
+echo 1 > events/uprobes/myevent/enable
+echo 'ls' | /bin/sh > /dev/null
+echo 0 > events/uprobes/myevent/enable
+grep -q myevent trace
+
+echo "-:myevent" >> uprobe_events
+! grep -q myevent uprobe_events
+
+echo > uprobe_events
+
+clear_trace
Powered by blists - more mailing lists