On Thu, 5 Feb 2026 08:58:42 -0500 "Seokwoo Chung (Ryan)" <[email protected]> wrote:
> Add fprobe_list.tc to test the comma-separated symbol list syntax > with :entry/:exit suffixes. Three scenarios are covered: > > 1. List with default (entry) behavior and ! exclusion > 2. List with explicit :entry suffix > 3. List with :exit suffix for return probes Could you also add wildcard pattern test? > > Each test verifies that the correct functions appear in > enabled_functions and that excluded (!) symbols are absent. > > Note: The existing tests add_remove_fprobe.tc, fprobe_syntax_errors.tc, > and add_remove_fprobe_repeat.tc check their "requires" line against the > tracefs README for the old "%return" syntax pattern. Since the README > now documents ":entry|:exit" instead, these tests report UNSUPPORTED. > Their "requires" lines need updating in a follow-up patch. This means you'll break the selftest. please fix those test first. (This fix must be done before "tracing/fprobe: Support comma-separated symbols and :entry/:exit" so that we can safely bisect it.) Thank you, > > Signed-off-by: Seokwoo Chung (Ryan) <[email protected]> > --- > .../ftrace/test.d/dynevent/fprobe_list.tc | 92 +++++++++++++++++++ > 1 file changed, 92 insertions(+) > create mode 100644 > tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc > > diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc > b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc > new file mode 100644 > index 000000000000..45e57c6f487d > --- /dev/null > +++ b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc > @@ -0,0 +1,92 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > +# description: Fprobe event list syntax and :entry/:exit suffixes > +# requires: dynamic_events "f[:[<group>/][<event>]] > <func-name>[:entry|:exit] [<args>]":README > + > +# Setup symbols to test. These are common kernel functions. > +PLACE=vfs_read > +PLACE2=vfs_write > +PLACE3=vfs_open > + > +echo 0 > events/enable > +echo > dynamic_events > + > +# Get baseline count of enabled functions (should be 0 if clean, but be safe) > +if [ -f enabled_functions ]; then > + ocnt=`cat enabled_functions | wc -l` > +else > + ocnt=0 > +fi > + > +# Test 1: List default (entry) with exclusion > +# Target: Trace vfs_read and vfs_open, but EXCLUDE vfs_write > +echo "f:test/list_entry $PLACE,!$PLACE2,$PLACE3" >> dynamic_events > +grep -q "test/list_entry" dynamic_events > +test -d events/test/list_entry > + > +echo 1 > events/test/list_entry/enable > + > +grep -q "$PLACE" enabled_functions > +grep -q "$PLACE3" enabled_functions > +! grep -q "$PLACE2" enabled_functions > + > +# Check count (Baseline + 2 new functions) > +cnt=`cat enabled_functions | wc -l` > +if [ $cnt -ne $((ocnt + 2)) ]; then > + exit_fail > +fi > + > +# Cleanup Test 1 > +echo 0 > events/test/list_entry/enable > +echo "-:test/list_entry" >> dynamic_events > +! grep -q "test/list_entry" dynamic_events > + > +# Count should return to baseline > +cnt=`cat enabled_functions | wc -l` > +if [ $cnt -ne $ocnt ]; then > + exit_fail > +fi > + > +# Test 2: List with explicit :entry suffix > +# (Should behave exactly like Test 1) > +echo "f:test/list_entry_exp $PLACE,!$PLACE2,$PLACE3:entry" >> dynamic_events > +grep -q "test/list_entry_exp" dynamic_events > +test -d events/test/list_entry_exp > + > +echo 1 > events/test/list_entry_exp/enable > + > +grep -q "$PLACE" enabled_functions > +grep -q "$PLACE3" enabled_functions > +! grep -q "$PLACE2" enabled_functions > + > +cnt=`cat enabled_functions | wc -l` > +if [ $cnt -ne $((ocnt + 2)) ]; then > + exit_fail > +fi > + > +# Cleanup Test 2 > +echo 0 > events/test/list_entry_exp/enable > +echo "-:test/list_entry_exp" >> dynamic_events > + > +# Test 3: List with :exit suffix > +echo "f:test/list_exit $PLACE,!$PLACE2,$PLACE3:exit" >> dynamic_events > +grep -q "test/list_exit" dynamic_events > +test -d events/test/list_exit > + > +echo 1 > events/test/list_exit/enable > + > +# Even for return probes, enabled_functions lists the attached symbols > +grep -q "$PLACE" enabled_functions > +grep -q "$PLACE3" enabled_functions > +! grep -q "$PLACE2" enabled_functions > + > +cnt=`cat enabled_functions | wc -l` > +if [ $cnt -ne $((ocnt + 2)) ]; then > + exit_fail > +fi > + > +# Cleanup Test 3 > +echo 0 > events/test/list_exit/enable > +echo "-:test/list_exit" >> dynamic_events > + > +clear_trace > -- > 2.43.0 > -- Masami Hiramatsu (Google) <[email protected]>
