All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH 02/23] libtracefs testing: Use one tep handle for most tests
Date: Thu, 28 Dec 2023 15:35:24 -0500	[thread overview]
Message-ID: <20231228203714.53294-3-rostedt@goodmis.org> (raw)
In-Reply-To: <20231228203714.53294-1-rostedt@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Creating a tep handle with all events takes a bit of time. Instead of
recreating one for every test, have the main test_tep handle load all events
and use that for all tests that do not need to add special events (like the
dynamic event tests).

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

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 398c94368e66..5ce4bafbfda5 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -366,8 +366,7 @@ static void test_instance_trace_sql(struct tracefs_instance *instance)
 	struct tep_event *event;
 	int ret;
 
-	tep = tracefs_local_events(NULL);
-	CU_TEST(tep != NULL);
+	tep = test_tep;
 
 	trace_seq_init(&seq);
 
@@ -409,7 +408,6 @@ static void test_instance_trace_sql(struct tracefs_instance *instance)
 		trace_seq_reset(&seq);
 	}
 
-	tep_free(tep);
 	trace_seq_destroy(&seq);
 }
 
@@ -436,7 +434,6 @@ struct test_cpu_data {
 static void cleanup_trace_cpu(struct test_cpu_data *data)
 {
 	close(data->fd);
-	tep_free(data->tep);
 	tracefs_cpu_close(data->tcpu);
 	free(data->buf);
 	kbuffer_free(data->kbuf);
@@ -467,10 +464,7 @@ static int setup_trace_cpu(struct tracefs_instance *instance, struct test_cpu_da
 	if (data->fd < 0)
 		return -1;
 
-	data->tep = tracefs_local_events(NULL);
-	CU_TEST(data->tep != NULL);
-	if (!data->tep)
-		goto fail;
+	data->tep = test_tep;
 
 	data->tcpu = tracefs_cpu_open(instance, 0, true);
 	CU_TEST(data->tcpu != NULL);
@@ -685,10 +679,7 @@ static void test_instance_follow_events(struct tracefs_instance *instance)
 
 	memset(&fdata, 0, sizeof(fdata));
 
-	tep = tracefs_local_events(NULL);
-	CU_TEST(tep != NULL);
-	if (!tep)
-		return;
+	tep = test_tep;
 
 	fdata.sched_switch = tep_find_event_by_name(tep, "sched", "sched_switch");
 	CU_TEST(fdata.sched_switch != NULL);
@@ -2529,9 +2520,7 @@ static int test_suite_destroy(void)
 
 static int test_suite_init(void)
 {
-	const char *systems[] = {"ftrace", NULL};
-
-	test_tep = tracefs_local_events_system(NULL, systems);
+	test_tep = tracefs_local_events(NULL);
 	if (test_tep == NULL)
 		return 1;
 	test_instance = tracefs_instance_create(TEST_INSTANCE_NAME);
-- 
2.42.0


  parent reply	other threads:[~2023-12-28 20:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 20:35 [PATCH 00/23] libtracefs: Several updates Steven Rostedt
2023-12-28 20:35 ` [PATCH 01/23] libtracefs Documentation: Fix tracefs_event_file_exists() issues Steven Rostedt
2023-12-28 20:35 ` Steven Rostedt [this message]
2023-12-28 20:35 ` [PATCH 03/23] libtracefs: Free "missed_followers" of instance Steven Rostedt
2023-12-28 20:35 ` [PATCH 04/23] libtracefs: Free buf in clear_func_filter() Steven Rostedt
2023-12-28 20:35 ` [PATCH 05/23] libtracefs: Free tracing_dir in case of remount Steven Rostedt
2023-12-28 20:35 ` [PATCH 06/23] libtracefs: Free dynamic event list in utest Steven Rostedt
2023-12-28 20:35 ` [PATCH 07/23] libtracefs: Reset tracing before and after unit tests Steven Rostedt
2023-12-28 20:35 ` [PATCH 08/23] libtracefs: Add API to remove followers from an instance or toplevel Steven Rostedt
2023-12-28 20:35 ` [PATCH 09/23] libtracefs: Increase splice to use pipe max size Steven Rostedt
2023-12-28 20:35 ` [PATCH 10/23] libtracefs: Add tracefs_instance_file_write_number() Steven Rostedt
2023-12-28 20:35 ` [PATCH 11/23] libtracefs: Add API to read tracefs_cpu and return a kbuffer Steven Rostedt
2023-12-28 20:35 ` [PATCH 12/23] libtracefs: Add tracefs_instance_get/set_buffer_percent() Steven Rostedt
2023-12-28 20:35 ` [PATCH 13/23] libtracefs: Add tracefs_instance_clear() API Steven Rostedt
2023-12-28 20:35 ` [PATCH 14/23] libtracefs utest: Add test to test tracefs_instance_set/get_buffer_percent() Steven Rostedt
2023-12-28 20:35 ` [PATCH 15/23] libtracefs: Add kerneldoc comments to tracefs_instance_set_buffer_size() Steven Rostedt
2023-12-28 20:35 ` [PATCH 16/23] libtracefs: Add tracefs_load_headers() API Steven Rostedt
2023-12-28 20:35 ` [PATCH 17/23] libtracefs: Add API to extract ring buffer statistics Steven Rostedt
2023-12-28 20:35 ` [PATCH 18/23] libtracefs: Add tracefs_instance_set/get_subbuf_size() Steven Rostedt
2023-12-28 20:35 ` [PATCH 19/23] libtracefs: Add ring buffer memory mapping APIs Steven Rostedt
2023-12-28 20:35 ` [PATCH 20/23] libtracefs: Add TIMESTAMP_USECS_DELTA to simplify SQL timestamp compares Steven Rostedt
2023-12-28 20:35 ` [PATCH 21/23] libtracefs: Also clear max_graph_depth on reset Steven Rostedt
2023-12-28 20:35 ` [PATCH 22/23] libtracefs: Add PID filtering API Steven Rostedt
2023-12-28 20:35 ` [PATCH 23/23] libtracefs: Add updating and reading snapshot buffers Steven Rostedt

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=20231228203714.53294-3-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.