From: Steven Rostedt <rostedt@goodmis.org>
To: Yipeng Zou <zouyipeng@huawei.com>
Cc: <mhiramat@kernel.org>, <shuah@kernel.org>,
<linux-trace-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH] selftests/ftrace: let traceonoff_triggers testcase without md5sum
Date: Wed, 16 Aug 2023 16:20:23 -0400 [thread overview]
Message-ID: <20230816162023.79ad9a47@gandalf.local.home> (raw)
In-Reply-To: <20230814025918.2726807-1-zouyipeng@huawei.com>
On Mon, 14 Aug 2023 10:59:18 +0800
Yipeng Zou <zouyipeng@huawei.com> wrote:
> So I directly dump the trace file before md5sum, the diff shows that:
>
> [root@localhost]# diff trace_1.log trace_2.log -y --suppress-common-lines
> dockerd-12285 [036] d.... 18385.510290: sched_stat | <...>-12285 [036] d.... 18385.510290: sched_stat
> dockerd-12285 [036] d.... 18385.510291: sched_swit | <...>-12285 [036] d.... 18385.510291: sched_swit
> <...>-740 [044] d.... 18385.602859: sched_stat | kworker/44:1-740 [044] d.... 18385.602859: sched_stat
> <...>-740 [044] d.... 18385.602860: sched_swit | kworker/44:1-740 [044] d.... 18385.602860: sched_swit
So the problem is the <..> being added?
>
> And we can see that the saved_cmdlines in kernel was changed.
>
> So Maybe there is no safe to use md5sum here to verify whether
> the file whether it has changed.
>
> >From my point of view, we only need to verify traceoff event
> is valid there.
>
> Maybe it is enough to check first that the tracing_on equals 0,
> and then check that the total number of rows of trace does not
> increase?
>
> Fixes: d87b29179aa0 ("selftests: ftrace: Use md5sum to take less time of checking logs")
> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
> ---
> .../test.d/ftrace/func_traceonoff_triggers.tc | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc
> index aee22289536b..180c60605d7b 100644
> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc
> @@ -77,25 +77,17 @@ if [ $cnt -ne 1 ]; then
> fail "Did not find traceoff trigger"
> fi
>
> -cnt=`cnt_trace`
> -sleep $SLEEP_TIME
> -cnt2=`cnt_trace`
> -
> -if [ $cnt -ne $cnt2 ]; then
> - fail "Tracing is not stopped"
> -fi
> -
> on=`cat tracing_on`
> if [ $on != "0" ]; then
> fail "Tracing is not off"
> fi
>
> -csum1=`md5sum trace`
What about just changing the above to:
# Can not rely on names being around as they are only cached
csum1=`cat trace | sed -e 's/^ *[^ ]*\(-[0-9][0-9]*\)/\1/' | md5sum`
> +cnt=`cnt_trace`
> sleep $SLEEP_TIME
> -csum2=`md5sum trace`
And this:
csum2=`cat trace | sed -e 's/^ *[^ ]*\(-[0-9][0-9]*\)/\1/' | md5sum`
That will strip off the names an leave just the -[PID]... part of the line?
-- Steve
> +cnt2=`cnt_trace`
>
> -if [ "$csum1" != "$csum2" ]; then
> - fail "Tracing file is still changing"
> +if [ $cnt -ne $cnt2 ]; then
> + fail "Tracing is not stopped"
> fi
>
> clear_trace
next prev parent reply other threads:[~2023-08-16 20:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 2:59 [PATCH] selftests/ftrace: let traceonoff_triggers testcase without md5sum Yipeng Zou
2023-08-16 20:20 ` Steven Rostedt [this message]
2023-08-17 2:34 ` Yipeng Zou
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=20230816162023.79ad9a47@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=shuah@kernel.org \
--cc=zouyipeng@huawei.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;
as well as URLs for NNTP newsgroup(s).