Re: [PATCH 2/2] ftrace/selftest: Test if set_event/ftrace_pid exists before writing

From: Masami Hiramatsu
Date: Thu Jul 04 2019 - 01:56:38 EST


On Wed, 3 Jul 2019 22:01:05 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Thu, 4 Jul 2019 10:51:26 +0900
> Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:
>
> > > > diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
> > > > index 779ec11f61bd..a7b06291e32c 100644
> > > > --- a/tools/testing/selftests/ftrace/test.d/functions
> > > > +++ b/tools/testing/selftests/ftrace/test.d/functions
> > > > @@ -91,8 +91,8 @@ initialize_ftrace() { # Reset ftrace to initial-state
> > > > reset_events_filter
> > > > reset_ftrace_filter
> > > > disable_events
> > > > - echo > set_event_pid # event tracer is always on
> > > > - echo > set_ftrace_pid
> > > > + [ -f set_event_pid ] && echo > set_event_pid # event tracer is always on
> > >
> > > I probably should remove that comment, because I believe that was why
> > > it wasn't tested :-/
> >
> > Hmm, OK. I think this comment means "the event tracer is always on if clearing
> > set_event_pid filter". Would this need to be removed?
>
> When this was added in commit 131f840d5b7 ("selftests: ftrace:
> Initialize ftrace before each test"), we had this:
>
> + echo > set_event_pid # event tracer is always on
> + [ -f set_ftrace_filter ] && echo | tee set_ftrace_*
> + [ -f set_graph_function ] && echo | tee set_graph_*
> + [ -f stack_trace_filter ] && echo > stack_trace_filter
> + [ -f kprobe_events ] && echo > kprobe_events
> + [ -f uprobe_events ] && echo > uprobe_events
>
> Where set_event_pid is the only file not tested for existence. I
> figured that comment was the reason for not testing it. If that was the
> case, then adding a test, I would think we should remove the comment.

Ah, I see.

>
> Do you agree?

Yes, I agree with removing it.

Thank you!

>
> -- Steve
>
>
> >
> > Thank you,
> >
> > >
> > > -- Steve
> > >
> > >
> > > > + [ -f set_ftrace_pid ] && echo > set_ftrace_pid
> > > > [ -f set_ftrace_filter ] && echo | tee set_ftrace_*
> > > > [ -f set_graph_function ] && echo | tee set_graph_*
> > > > [ -f stack_trace_filter ] && echo > stack_trace_filter
> > >
> >
> >
>


--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>