Skip to contentSkip to conversation

libtracefs: utest: Do not fail if uprobes are not supported by kernel

PATCH New Steven Rostedt 1 participant 1 message Apr 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: utest: Do not fail if uprobes are not supported by kernel

From: "Steven Rostedt (Google)" <[email protected]>

If the kernel does not support uprobes, do not fail the unit tests, but report that the kernel does not support it.

---
 utest/tracefs-utest.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
utest/tracefs-utest.c +10 -0
index 8c9aab4..cc7e689 100644
@@ -2206,6 +2206,7 @@ static bool check_probes(struct probe_test *probes, int count,
 {
 	enum tracefs_dynevent_type type;
 	struct tep_event *tevent;
+	bool uprobes_supported = true;
 	char *ename;
 	char *address;
 	char *event;
@@ -2240,6 +2241,15 @@ static bool check_probes(struct probe_test *probes, int count,
 			}
 			ret = tracefs_event_enable(instance, system, event);
 			if (in_system) {
+				/* ENOTSUPP is 524 */
+				if (ret && errno == 524) {
+					if (uprobes_supported)
+						printf("[KERNEL DOES NOT HAVE UPROBE EVENTS] ...");
+					uprobes_supported = false;
+					/* Count it as passed */
+					found++;
+					break;
+				}
 				CU_TEST(ret == 0);
 			} else {
 				CU_TEST(ret != 0);
Signature · 1 line
2.47.2