diff mbox series

libtracefs utest: Do not test kprobe interface if there's no kprobes

Message ID 20240820174517.152e4404@gandalf.local.home (mailing list archive)
State Accepted
Commit ff20336f8506912a5423d7e706f7c36cf4c5fbf4
Headers show
Series libtracefs utest: Do not test kprobe interface if there's no kprobes | expand

Commit Message

Steven Rostedt Aug. 20, 2024, 9:45 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

If the kernel does not support kprobes, do not bother testing the kprobe
interface.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 utest/tracefs-utest.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index b295253..5bfd665 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -2280,6 +2280,11 @@  static void test_kprobes_instance(struct tracefs_instance *instance)
 	int ret;
 	int i;
 
+	if (!tracefs_file_exists(NULL, "kprobe_events")) {
+		printf("[KERNEL DOES NOT HAVE KPROBE EVENTS] ...");
+		return;
+	}
+
 	tep = tep_alloc();
 	CU_TEST(tep != NULL);