Re: [PATCH v2 3/3] libtracefs: Unit test for tracefs_instance_reset()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 29, 2023 at 3:05 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> On Wed, 26 Apr 2023 07:11:24 +0300
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:
>
> > +static void test_instance_reset(void)
> > +{
> > +     struct tracefs_instance *instance = NULL;
> > +     const char *name = get_rand_str();
> > +
> > +     CU_TEST(tracefs_instance_exists(name) == false);
> > +     instance = tracefs_instance_create(name);
> > +     CU_TEST(instance != NULL);
> > +
> > +     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);
>
> Was there a reason why you picked HWLAT tracer and the fdb_delete trace
> event? Neither exist in my test machine setup, so this test
> automatically fails.
>

Hi Steve,
The only reason to choose them is not to generate many events during
the test, as the test checks the ftrace configuration and not the
generated events. I didn't realize that the tracer and events may not
exist in the system. I noticed your commit, thanks for fixing that!

> -- Steve
>
>
> > +     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);
> > +     CU_TEST(tracefs_instance_file_write(instance, "set_ftrace_filter",
> > +                                                   "schedule:stacktrace") > 0);
> > +     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",
> > +                                                   "enable_event:kmem:kmalloc:1") > 0);
> > +     CU_TEST(tracefs_instance_file_write(instance, "events/bridge/fdb_delete/filter",
> > +                                                   "common_pid == 5") > 0);
> > +
> > +     CU_TEST(test_instance_check_default_state(instance) == false);
> > +
> > +     tracefs_instance_reset(instance);
> > +     CU_TEST(test_instance_check_default_state(instance) == true);
> > +
> > +     CU_TEST(tracefs_instance_destroy(instance) == 0);
> > +     tracefs_instance_free(instance);
> > +}
> > +



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux