diff mbox series

[3/3] libtracefs: Fixed trace marker unit test

Message ID 20210412042419.3295237-4-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Commit ba1e8e084d96749a00eb608d9ceef981b804e503
Headers show
Series Fix unit tests and APIs for loading saved mappings | expand

Commit Message

Tzvetomir Stoyanov (VMware) April 12, 2021, 4:24 a.m. UTC
The tracefs_printf() and tracefs_vprintf() APIs do not write the terminating
NULL characted of the string in the trace marker, as it is not required
by the kernel interafce. Fixed the unit test to not expect that
terminating NULL while verifying the result of these APIs.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 utest/tracefs-utest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 04b5e81..d675c16 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -287,14 +287,14 @@  static void test_instance_ftrace_marker(struct tracefs_instance *instance)
 		CU_TEST(tracefs_printf(instance, "Test marker: %s 0x%X", string, data) == 0);
 	}
 	asprintf(&str, "Test marker: %s 0x%X", string, data);
-	CU_TEST(find_test_marker(instance, str, strlen(str) + 1, MARKERS_WRITE_COUNT, false));
+	CU_TEST(find_test_marker(instance, str, strlen(str), MARKERS_WRITE_COUNT, false));
 	free(str);
 
 	for (i = 0; i < MARKERS_WRITE_COUNT; i++) {
 		CU_TEST(marker_vprint(instance, "Test marker V: %s 0x%X", string, data) == 0);
 	}
 	asprintf(&str, "Test marker V: %s 0x%X", string, data);
-	CU_TEST(find_test_marker(instance, str, strlen(str) + 1, MARKERS_WRITE_COUNT, false));
+	CU_TEST(find_test_marker(instance, str, strlen(str), MARKERS_WRITE_COUNT, false));
 	free(str);
 
 	tracefs_print_close(instance);