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

From: Jaewon Jung

Date: Thu Oct 15 2026 - 23:29:07 EST


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>
---
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
--
2.43.0