From: Ryan Chung <seokwoo.chung130@gmail.com>
To: rostedt@goodmis.org, mhiramat@kernel.org
Cc: mathieu.desnoyers@efficios.com, shuah@kernel.org,
hca@linux.ibm.com, corbet@lwn.net,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org,
seokwoo.chung130@gmail.com
Subject: [PATCH v3 4/5] selftests/ftrace: dynevent: add reject cases for list/:entry/:exit
Date: Sun, 5 Oct 2025 08:46:58 +0900 [thread overview]
Message-ID: <20251004235001.133111-5-seokwoo.chung130@gmail.com> (raw)
In-Reply-To: <20251004235001.133111-1-seokwoo.chung130@gmail.com>
Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com>
---
.../test.d/dynevent/add_remove_fprobe.tc | 121 ++++++++++++++++++
1 file changed, 121 insertions(+)
diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe.tc b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe.tc
index 2506f464811b..d5761d31217c 100644
--- a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe.tc
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe.tc
@@ -2,6 +2,8 @@
# SPDX-License-Identifier: GPL-2.0
# description: Generic dynamic event - add/remove fprobe events
# requires: dynamic_events "f[:[<group>/][<event>]] <func-name>[%return] [<args>]":README
+# Note: list-style specs and :entry/:exit may be unavailable on older kernels.
+# These tests auto-skip at runtime if the list form is rejected by tracefs.
echo 0 > events/enable
echo > dynamic_events
@@ -89,4 +91,123 @@ if [ $cnt -ne $ocnt ]; then
exit_fail
fi
+# ---- New accept cases for list syntax with :entry/:exit and !-exclusions ----
+if echo "f:test/__list_check $PLACE,$PLACE3" >> dynamic_events 2> /dev/null; then
+ # Clean the probe added by the guard
+ echo "-:test/__list_check" >> dynamic_events
+
+ # List default (entry) with exclusion, explicit group/event
+ 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
+ # Should attach to PLACE and PLACE3, but not PLACE2
+ 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
+
+ # Disable and remove; count should be back to baseline
+ echo 0 > events/test/list_entry/enable
+ echo "-:test/list_entry" >> dynamic_events
+ ! grep -q "test/list_entry" dynamic_events
+ cnt=`cat enabled_functions | wc -l`
+ if [ $cnt -ne $ocnt ]; then
+ exit_fail
+ fi
+
+ # List with explicit :entry suffix (same behavior as default)
+ 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
+
+ echo 0 > events/test/list_entry_exp/enable
+ echo "-:test/list_entry_exp" >> dynamic_events
+ ! grep -q "test/list_entry_exp" dynamic_events
+ cnt=`cat enabled_functions | wc -l`
+ if [ $cnt -ne $ocnt ]; then
+ exit_fail
+ fi
+
+ # List with :exit suffix across the same set
+ 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
+ # On return probes, enabled_functions still reflects attached functions.
+ 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
+
+ echo 0 > events/test/list_exit/enable
+ echo "-:test/list_exit" >> dynamic_events
+ ! grep -q "test/list_exit" dynamic_events
+ cnt=`cat enabled_functions | wc -l`
+ if [ $cnt -ne $ocnt ]; then
+ exit_fail
+ fi
+
+ # Enabling entry and exit together does not double-count functions
+ echo "f:test/list_both_e $PLACE,!$PLACE2,$PLACE3" >> dynamic_events
+ echo "f:test/list_both_x $PLACE,!$PLACE2,$PLACE3:exit" >> dynamic_events
+ grep -q "test/list_both_e" dynamic_events
+ grep -q "test/list_both_x" dynamic_events
+ test -d events/test/list_both_e
+ test -d events/test/list_both_x
+
+ echo 1 > events/test/list_both_e/enable
+ cnt=`cat enabled_functions | wc -l`
+ if [ $cnt -ne $((ocnt + 2)) ]; then
+ exit_fail
+ fi
+
+ # Enabling :exit for the same set should keep the count the same
+ echo 1 > events/test/list_both_x/enable
+ cnt=`cat enabled_functions | wc -l`
+ if [ $cnt -ne $((ocnt + 2)) ]; then
+ exit_fail
+ fi
+
+ # Disable one; count should remain (the other still holds the attach)
+ echo 0 > events/test/list_both_e/enable
+ cnt=`cat enabled_functions | wc -l`
+ if [ $cnt -ne $((ocnt + 2)) ]; then
+ exit_fail
+ fi
+
+ # Disable the other; count returns to baseline
+ echo 0 > events/test/list_both_x/enable
+ cnt=`cat enabled_functions | wc -l`
+ if [ $cnt -ne $ocnt ]; then
+ exit_fail
+ fi
+
+ # Remove both definitions
+ echo "-:test/list_both_e" >> dynamic_events
+ echo "-:test/list_both_x" >> dynamic_events
+ ! grep -q "test/list_both_e" dynamic_events
+ ! grep -q "test/list_both_x" dynamic_events
+else
+ # List-form not supported; skip silently
+ :
+fi
+
clear_trace
--
2.43.0
next prev parent reply other threads:[~2025-10-04 23:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-04 23:46 [PATCH v3 0/5] tracing: fprobe: list-style filters, Ryan Chung
2025-10-04 23:46 ` [PATCH v3 1/5] docs: tracing: fprobe: document list filters and :entry/:exit Ryan Chung
2025-10-08 1:06 ` Masami Hiramatsu
2025-10-12 14:40 ` Ryan Chung
2025-10-04 23:46 ` [PATCH v3 2/5] tracing: fprobe: require explicit [GROUP/]EVENT for list/wildcard Ryan Chung
2025-10-08 0:53 ` Masami Hiramatsu
2025-10-12 14:32 ` Ryan Chung
2025-10-04 23:46 ` [PATCH v3 3/5] tracing: fprobe: support comma-separated symbols and :entry/:exit Ryan Chung
2025-10-08 10:09 ` Masami Hiramatsu
2025-10-12 14:19 ` Ryan Chung
2025-10-10 15:10 ` kernel test robot
2025-10-10 15:52 ` kernel test robot
2025-10-04 23:46 ` Ryan Chung [this message]
2025-10-04 23:46 ` [PATCH v3 5/5] selftests/ftrace: dynevent: add reject cases Ryan Chung
2025-10-08 0:51 ` [PATCH v3 0/5] tracing: fprobe: list-style filters, Masami Hiramatsu
2025-10-12 1:49 ` Ryan Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251004235001.133111-5-seokwoo.chung130@gmail.com \
--to=seokwoo.chung130@gmail.com \
--cc=corbet@lwn.net \
--cc=hca@linux.ibm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®