Skip to contentSkip to conversation

libtracefs: Add unit test to test mounting of tracefs_{tracing,debug}_dir()

PATCH New Steven Rostedt 1 participant 1 message Dec 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Add unit test to test mounting of tracefs_{tracing,debug}_dir()

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

As there was a regression with the mounting of the tracefs and debugfs file systems when tracefs_tracing_dir() and tracefs_debug_dir() were called, add a unit test to make sure they continue to work.

---
 src/tracefs-utils.c   |  3 +-
 utest/tracefs-utest.c | 84 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 1 deletion(-)
src/tracefs-utils.c +2 -1
index d91ff40eee87..ae249de06a39 100644
@@ -85,7 +85,8 @@ static int mount_debugfs(void)
 	return ret;
 }
 
-static char *find_tracing_dir(bool debugfs, bool mount)
+/* Exported for testing purpose only */
+__hidden char *find_tracing_dir(bool debugfs, bool mount)
 {
 	char *debug_str = NULL;
 	char fspath[PATH_MAX+1];
utest/tracefs-utest.c +84 -0

108 lines not on this page · raw message

Signature · 1 line
2.35.1