From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Subject: [PATCH] libtracefs: Do not use hwlat tracer and fdb_delete event for tests
Date: Tue, 30 May 2023 00:19:51 -0400 [thread overview]
Message-ID: <20230530001951.2070c879@rorschach.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The tracefs_reset() test required the hwlat tracer and the fdb_delete event to
exist on the system to succeed. But that trace and event are uncommon, and will
cause a failure when they are not part of the system. Instead, pick the first
tracer returned by tracefs_tracers() and also the "sched_switch" event as that
will make the test more robust with different kernel configs.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
utest/tracefs-utest.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 47f65cbaa4fe..47fc9570a473 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -1768,6 +1768,7 @@ static void test_instance_reset(void)
{
struct tracefs_instance *instance = NULL;
const char *name = get_rand_str();
+ char **tracers;
CU_TEST(tracefs_instance_exists(name) == false);
instance = tracefs_instance_create(name);
@@ -1775,8 +1776,13 @@ static void test_instance_reset(void)
CU_TEST(test_instance_check_default_state(instance) == true);
- CU_TEST(tracefs_tracer_set(instance, TRACEFS_TRACER_HWLAT) == 0);
- CU_TEST(tracefs_event_enable(instance, "bridge", "fdb_delete") == 0);
+ tracers = tracefs_tracers(NULL);
+ CU_TEST(tracers != NULL);
+ if (tracers) {
+ CU_TEST(tracefs_tracer_set(instance, TRACEFS_TRACER_CUSTOM, tracers[0]) == 0);
+ tracefs_list_free(tracers);
+ }
+ CU_TEST(tracefs_event_enable(instance, "sched", "sched_switch") == 0);
CU_TEST(tracefs_instance_file_write(instance, "set_ftrace_pid", "5") > 0);
CU_TEST(tracefs_instance_file_write(instance, "trace_clock", "global") > 0);
CU_TEST(tracefs_instance_file_write(instance, "set_event_pid", "5") > 0);
@@ -1785,9 +1791,9 @@ static void test_instance_reset(void)
CU_TEST(tracefs_instance_file_write(instance, "set_ftrace_notrace",
"schedule:stacktrace") > 0);
CU_TEST(tracefs_instance_file_write(instance, "tracing_cpumask", "0f") > 0);
- CU_TEST(tracefs_instance_file_write(instance, "events/syscalls/sys_exit_read/trigger",
+ CU_TEST(tracefs_event_file_write(instance, "syscalls", "sys_exit_read", "trigger",
"enable_event:kmem:kmalloc:1") > 0);
- CU_TEST(tracefs_instance_file_write(instance, "events/bridge/fdb_delete/filter",
+ CU_TEST(tracefs_event_file_write(instance, "sched", "sched_switch", "filter",
"common_pid == 5") > 0);
CU_TEST(test_instance_check_default_state(instance) == false);
--
2.39.2
reply other threads:[~2023-05-30 4:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230530001951.2070c879@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tz.stoyanov@gmail.com \
/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).