diff mbox series

[07/23] libtracefs: Reset tracing before and after unit tests

Message ID 20231228203714.53294-8-rostedt@goodmis.org (mailing list archive)
State Superseded
Headers show
Series libtracefs: Several updates | expand

Commit Message

Steven Rostedt Dec. 28, 2023, 8:35 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

After having tests constantly fail because of some left over tracing that
was still enabled before the test started, call tracefs_instance_reset()
before and after the unit tests to make sure it starts with a clean slate
and does not fail due to residual tracing that was from an external event.

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

Patch

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 28960c191581..183f37cd133a 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -2516,6 +2516,7 @@  static void test_custom_trace_dir(void)
 
 static int test_suite_destroy(void)
 {
+	tracefs_instance_reset(NULL);
 	tracefs_instance_destroy(test_instance);
 	tracefs_instance_free(test_instance);
 	tep_free(test_tep);
@@ -2531,6 +2532,9 @@  static int test_suite_init(void)
 	if (!test_instance)
 		return 1;
 
+	/* Start with a new slate */
+	tracefs_instance_reset(NULL);
+
 	return 0;
 }