linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 3/3] libtracefs: Fixed trace marker unit test
Date: Mon, 12 Apr 2021 07:24:19 +0300	[thread overview]
Message-ID: <20210412042419.3295237-4-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210412042419.3295237-1-tz.stoyanov@gmail.com>

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 --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);
-- 
2.30.2


      parent reply	other threads:[~2021-04-12  4:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12  4:24 [PATCH 0/3] Fix unit tests and APIs for loading saved mappings Tzvetomir Stoyanov (VMware)
2021-04-12  4:24 ` [PATCH 1/3] libtracefs: Fix trace options unit test Tzvetomir Stoyanov (VMware)
2021-04-12  4:24 ` [PATCH 2/3] libtracefs: Fix loading of saved maps Tzvetomir Stoyanov (VMware)
2021-04-12  4:24 ` Tzvetomir Stoyanov (VMware) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210412042419.3295237-4-tz.stoyanov@gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).