Skip to content

Commit a1ca238

Browse files
mhiramatshuahkh
authored andcommitted
selftests: tracing: Add tprobe enable/disable testcase
Commit 2867495 ("tracing: tprobe-events: Register tracepoint when enable tprobe event") caused regression bug and tprobe did not work. To prevent similar problems, add a testcase which enables/disables a tprobe and check the results. Link: https://lore.kernel.org/r/176252610176.214996.3978515319000806265.stgit@devnote2 Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent d9e6269 commit a1ca238

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
# description: Generic dynamic event - enable/disable tracepoint probe events
4+
# requires: dynamic_events "t[:[<group>/][<event>]] <tracepoint> [<args>]":README
5+
6+
echo 0 > events/enable
7+
echo > dynamic_events
8+
9+
TRACEPOINT=sched_switch
10+
ENABLEFILE=events/tracepoints/myprobe/enable
11+
12+
:;: "Add tracepoint event on $TRACEPOINT" ;:
13+
14+
echo "t:myprobe ${TRACEPOINT}" >> dynamic_events
15+
16+
:;: "Check enable/disable to ensure it works" ;:
17+
18+
echo 1 > $ENABLEFILE
19+
20+
grep -q $TRACEPOINT trace
21+
22+
echo 0 > $ENABLEFILE
23+
24+
echo > trace
25+
26+
! grep -q $TRACEPOINT trace
27+
28+
:;: "Repeat enable/disable to ensure it works" ;:
29+
30+
echo 1 > $ENABLEFILE
31+
32+
grep -q $TRACEPOINT trace
33+
34+
echo 0 > $ENABLEFILE
35+
36+
echo > trace
37+
38+
! grep -q $TRACEPOINT trace
39+
40+
exit 0

0 commit comments

Comments
 (0)