Re: [PATCH 2/5] selftests: ftrace: Fix test cases to enable tracing

Steven Rostedt
2016-10-24T19:50:35Z

On Wed, 19 Oct 2016 13:53:46 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Fix some test cases to enable tracing before starting
> trace test. This can avoid false-positive failure when
> previous testcase fails while disabling tracing.

I wonder if this would be better to do the enabling from the ftracetest
script instead. Then the tests would need to worry about it.

-- Steve

>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> .../selftests/ftrace/test.d/event/event-enable.tc | 1 +
> .../selftests/ftrace/test.d/event/event-pid.tc | 1 +
> .../ftrace/test.d/event/subsystem-enable.tc | 1 +
> .../ftrace/test.d/event/toplevel-enable.tc | 1 +
> .../ftrace/test.d/ftrace/func_profiler.tc | 1 +
> .../ftrace/test.d/kprobe/kprobe_ftrace.tc | 1 +
> 6 files changed, 6 insertions(+)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> index 87eb9d6..ee7ea0a 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> @@ -23,6 +23,7 @@ fi
>
> reset_tracer
> do_reset
> +enable_tracing
>
> echo 'sched:sched_switch' > set_event
>
> diff --git a/tools/testing/selftests/ftrace/test.d/event/event-pid.tc b/tools/testing/selftests/ftrace/test.d/event/event-pid.tc
> index d4ab27b..1477e5e 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/event-pid.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/event-pid.tc
> @@ -30,6 +30,7 @@ fi
>
> reset_tracer
> do_reset
> +enable_tracing
>
> echo 1 > events/sched/sched_switch/enable
>
> 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 ced27ef..f4a64f9 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> @@ -23,6 +23,7 @@ fi
>
> reset_tracer
> do_reset
> +enable_tracing
>
> echo 'sched:*' > set_event
>
> diff --git a/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc b/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
> index 0bb5df3..037a82e 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
> @@ -23,6 +23,7 @@ fi
>
> reset_tracer
> do_reset
> +enable_tracing
>
> echo '*:*' > set_event
>
> diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
> index 7808336..d10d6e0 100644
> --- a/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
> @@ -36,6 +36,7 @@ fail() { # mesg
>
> echo "Testing function tracer with profiler:"
> echo "enable function tracer"
> +enable_tracing
> echo function > current_tracer
> echo "enable profiler"
> echo 1 > function_profile_enabled
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
> index d6f2f49..bdbd385 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
> @@ -10,6 +10,7 @@ echo _do_fork > set_ftrace_filter
> echo 0 > events/enable
> echo > kprobe_events
> echo 'p:testprobe _do_fork' > kprobe_events
> +enable_tracing
>
> # kprobe on / ftrace off
> echo 1 > events/kprobes/testprobe/enable