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

DORMANTno replies

From: Jaewon Jung <hidden>
Date: 2026-10-16 03:27:08
Also in: linux-kselftest, lkml
Subsystem: kernel selftest framework, the rest, tracing · Maintainers: Shuah Khan, Shuah Khan, Linus Torvalds, Steven Rostedt, Masami Hiramatsu

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help