Skip to content

Commit 434f670

Browse files
committed
selftests: tracing: Enable fprobe events before checking enable_functions
Since the fprobe is not registered before enabling the fprobe events, enable_functions is also empty before enabling it. Thus the tests which checking enable_functions must ensure the event is enabled before testing the enable_functions. Link: https://lore.kernel.org/all/174343538009.843280.6583146613234713007.stgit@devnote2/ Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 2db832e commit 434f670

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe.tc

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,41 @@ ocnt=`cat enabled_functions | wc -l`
1616

1717
echo "f:myevent1 $PLACE" >> dynamic_events
1818

19+
echo "f:myevent2 $PLACE%return" >> dynamic_events
20+
21+
# add another event
22+
echo "f:myevent3 $PLACE2" >> dynamic_events
23+
24+
grep -q myevent1 dynamic_events
25+
grep -q myevent2 dynamic_events
26+
grep -q myevent3 dynamic_events
27+
test -d events/fprobes/myevent1
28+
test -d events/fprobes/myevent2
29+
30+
echo 1 > events/fprobes/myevent1/enable
1931
# Make sure the event is attached and is the only one
2032
grep -q $PLACE enabled_functions
2133
cnt=`cat enabled_functions | wc -l`
2234
if [ $cnt -ne $((ocnt + 1)) ]; then
2335
exit_fail
2436
fi
2537

26-
echo "f:myevent2 $PLACE%return" >> dynamic_events
27-
38+
echo 1 > events/fprobes/myevent2/enable
2839
# It should till be the only attached function
2940
cnt=`cat enabled_functions | wc -l`
3041
if [ $cnt -ne $((ocnt + 1)) ]; then
3142
exit_fail
3243
fi
3344

34-
# add another event
35-
echo "f:myevent3 $PLACE2" >> dynamic_events
36-
45+
echo 1 > events/fprobes/myevent3/enable
46+
# If the function is different, the attached function should be increased
3747
grep -q $PLACE2 enabled_functions
3848
cnt=`cat enabled_functions | wc -l`
3949
if [ $cnt -ne $((ocnt + 2)) ]; then
4050
exit_fail
4151
fi
4252

43-
grep -q myevent1 dynamic_events
44-
grep -q myevent2 dynamic_events
45-
grep -q myevent3 dynamic_events
46-
test -d events/fprobes/myevent1
47-
test -d events/fprobes/myevent2
48-
53+
echo 0 > events/fprobes/myevent2/enable
4954
echo "-:myevent2" >> dynamic_events
5055

5156
grep -q myevent1 dynamic_events
@@ -57,6 +62,7 @@ if [ $cnt -ne $((ocnt + 2)) ]; then
5762
exit_fail
5863
fi
5964

65+
echo 0 > events/fprobes/enable
6066
echo > dynamic_events
6167

6268
# Should have none left
@@ -67,12 +73,14 @@ fi
6773

6874
echo "f:myevent4 $PLACE" >> dynamic_events
6975

76+
echo 1 > events/fprobes/myevent4/enable
7077
# Should only have one enabled
7178
cnt=`cat enabled_functions | wc -l`
7279
if [ $cnt -ne $((ocnt + 1)) ]; then
7380
exit_fail
7481
fi
7582

83+
echo 0 > events/fprobes/enable
7684
echo > dynamic_events
7785

7886
# Should have none left

0 commit comments

Comments
 (0)