Re: [PATCH] selftests/ftrace: Check for dynamic_events before clearing

From: Masami Hiramatsu (Google)

Date: Sat Nov 28 2026 - 04:45:55 EST


On Fri, 16 Oct 2026 12:26:32 +0900, Jaewon Jung <jaewon8868@xxxxxxxxx> wrote:
> Trace instances do not have a dynamic_events file, but
> clear_dynamic_events() is called during initialization. Check for the
> file to avoid a "No such file or directory" error.
>
> Signed-off-by: Jaewon Jung <jaewon8868@xxxxxxxxx>

This looks good to me, and need this Fixes tag.

Fixes: aaac2820a367 ("selftests/ftrace: Add clear_dynamic_events() to test cases")

Acked-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>


Shuah, can you also pick this to your selftest fixes branch?

Thank you,

> ---
> tools/testing/selftests/ftrace/test.d/functions | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
> index 826141e299e5..4f2abb05e365 100644
> --- a/tools/testing/selftests/ftrace/test.d/functions
> +++ b/tools/testing/selftests/ftrace/test.d/functions
> @@ -84,6 +84,8 @@ clear_synthetic_events() { # reset all current synthetic events
> }
>
> clear_dynamic_events() { # reset all current dynamic events
> + [ -f dynamic_events ] || return 0
> +
> again=1
> stop=1
> # loop mulitple times as some events require other to be removed first
>

--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>