From: Steven Rostedt <rostedt@goodmis.org>
To: Tengda Wu <wutengda@huaweicloud.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Shuah Khan <shuah@kernel.org>,
Yuanhe Shu <xiangzao@linux.alibaba.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH -next] selftests/ftrace: Prevent potential failure in subsystem-enable test case
Date: Thu, 10 Jul 2025 15:34:09 -0400 [thread overview]
Message-ID: <20250710153409.3135fb17@batman.local.home> (raw)
In-Reply-To: <20250710130134.591066-1-wutengda@huaweicloud.com>
On Thu, 10 Jul 2025 13:01:34 +0000
Tengda Wu <wutengda@huaweicloud.com> wrote:
>
> Fixes: 1a4ea83a6e67 ("selftests/ftrace: Limit length in subsystem-enable tests")
> Signed-off-by: Tengda Wu <wutengda@huaweicloud.com>
> ---
> .../selftests/ftrace/test.d/event/subsystem-enable.tc | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> index b7c8f29c09a9..3a28adc7b727 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> @@ -19,8 +19,8 @@ echo 'sched:*' > set_event
> yield
>
> count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
> -if [ $count -lt 3 ]; then
> - fail "at least fork, exec and exit events should be recorded"
> +if [ $count -eq 0 ]; then
> + fail "none of scheduler events are recorded"
> fi
>
> do_reset
> @@ -30,8 +30,8 @@ echo 1 > events/sched/enable
> yield
>
> count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
> -if [ $count -lt 3 ]; then
> - fail "at least fork, exec and exit events should be recorded"
> +if [ $count -eq 0 ]; then
> + fail "none of scheduler events are recorded"
So if there's a bug that causes the system enable to only enable a
single event, this will no longer catch it?
I rather not let the slide.
Can you test this to see if this works for you?
-- Steve
diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
index b7c8f29c09a9..46a9e6d92730 100644
--- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
@@ -14,11 +14,32 @@ fail() { #msg
exit_fail
}
+check_unique() {
+ cat trace_pipe | grep -v '^#' | awk '
+ BEGIN { cnt = 0; }
+ {
+ for (i = 0; i < cnt; i++) {
+ if (event[i] == $5) {
+ break;
+ }
+ }
+ if (i == cnt) {
+ event[cnt++] = $5;
+ if (cnt > 2) {
+ exit;
+ }
+ }
+ }
+ END {
+ printf "%d", cnt;
+ }'
+}
+
echo 'sched:*' > set_event
yield
-count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
+count=`check_unique`
if [ $count -lt 3 ]; then
fail "at least fork, exec and exit events should be recorded"
fi
@@ -29,7 +50,7 @@ echo 1 > events/sched/enable
yield
-count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
+count=`check_unique`
if [ $count -lt 3 ]; then
fail "at least fork, exec and exit events should be recorded"
fi
next prev parent reply other threads:[~2025-07-10 19:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 13:01 Tengda Wu
2025-07-10 19:34 ` Steven Rostedt [this message]
2025-07-11 2:48 ` Tengda Wu
2025-07-11 3:22 ` Steven Rostedt
2025-07-11 3:37 ` Tengda Wu
2025-07-21 1:54 ` Tengda Wu
2025-07-21 17:29 ` Steven Rostedt
2025-07-26 11:01 ` Tengda Wu
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=20250710153409.3135fb17@batman.local.home \
--to=rostedt@goodmis.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=shuah@kernel.org \
--cc=wutengda@huaweicloud.com \
--cc=xiangzao@linux.alibaba.com \
/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®