selftests/ftrace: Let fprobe test consider already enabled functions
The fprobe test fails on Fedora 41 since the fprobe test assumption that
the number of enabled_functions is zero before the test starts is not
necessarily true. Some user space tools, like systemd, add BPF programs
that attach to functions. Those will show up in the enabled_functions table
and must be taken into account by the fprobe test.
Therefore count the number of lines of enabled_functions before tests
start, and use that as base when comparing expected results.
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Link: https://lore.kernel.org/20250226142703.910860-1-hca@linux.ibm.com
Fixes: e85c5e9792
("selftests/ftrace: Update fprobe test to check enabled_functions file")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
6f86bdeab6
commit
3908b6baf2
1 changed files with 11 additions and 7 deletions
|
@ -10,12 +10,16 @@ PLACE=$FUNCTION_FORK
|
|||
PLACE2="kmem_cache_free"
|
||||
PLACE3="schedule_timeout"
|
||||
|
||||
# Some functions may have BPF programs attached, therefore
|
||||
# count already enabled_functions before tests start
|
||||
ocnt=`cat enabled_functions | wc -l`
|
||||
|
||||
echo "f:myevent1 $PLACE" >> dynamic_events
|
||||
|
||||
# Make sure the event is attached and is the only one
|
||||
grep -q $PLACE enabled_functions
|
||||
cnt=`cat enabled_functions | wc -l`
|
||||
if [ $cnt -ne 1 ]; then
|
||||
if [ $cnt -ne $((ocnt + 1)) ]; then
|
||||
exit_fail
|
||||
fi
|
||||
|
||||
|
@ -23,7 +27,7 @@ echo "f:myevent2 $PLACE%return" >> dynamic_events
|
|||
|
||||
# It should till be the only attached function
|
||||
cnt=`cat enabled_functions | wc -l`
|
||||
if [ $cnt -ne 1 ]; then
|
||||
if [ $cnt -ne $((ocnt + 1)) ]; then
|
||||
exit_fail
|
||||
fi
|
||||
|
||||
|
@ -32,7 +36,7 @@ echo "f:myevent3 $PLACE2" >> dynamic_events
|
|||
|
||||
grep -q $PLACE2 enabled_functions
|
||||
cnt=`cat enabled_functions | wc -l`
|
||||
if [ $cnt -ne 2 ]; then
|
||||
if [ $cnt -ne $((ocnt + 2)) ]; then
|
||||
exit_fail
|
||||
fi
|
||||
|
||||
|
@ -49,7 +53,7 @@ grep -q myevent1 dynamic_events
|
|||
|
||||
# should still have 2 left
|
||||
cnt=`cat enabled_functions | wc -l`
|
||||
if [ $cnt -ne 2 ]; then
|
||||
if [ $cnt -ne $((ocnt + 2)) ]; then
|
||||
exit_fail
|
||||
fi
|
||||
|
||||
|
@ -57,7 +61,7 @@ echo > dynamic_events
|
|||
|
||||
# Should have none left
|
||||
cnt=`cat enabled_functions | wc -l`
|
||||
if [ $cnt -ne 0 ]; then
|
||||
if [ $cnt -ne $ocnt ]; then
|
||||
exit_fail
|
||||
fi
|
||||
|
||||
|
@ -65,7 +69,7 @@ echo "f:myevent4 $PLACE" >> dynamic_events
|
|||
|
||||
# Should only have one enabled
|
||||
cnt=`cat enabled_functions | wc -l`
|
||||
if [ $cnt -ne 1 ]; then
|
||||
if [ $cnt -ne $((ocnt + 1)) ]; then
|
||||
exit_fail
|
||||
fi
|
||||
|
||||
|
@ -73,7 +77,7 @@ echo > dynamic_events
|
|||
|
||||
# Should have none left
|
||||
cnt=`cat enabled_functions | wc -l`
|
||||
if [ $cnt -ne 0 ]; then
|
||||
if [ $cnt -ne $ocnt ]; then
|
||||
exit_fail
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue