linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Bug in Test code
  2021-04-12  1:13 Bug in Test code sameeruddin shaik
@ 2021-04-11  2:23 ` Steven Rostedt
  2021-04-13  1:05   ` sameeruddin shaik
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2021-04-11  2:23 UTC (permalink / raw)
  To: sameeruddin shaik; +Cc: Tzvetomir Stoyanov, Linux Trace Devel

On Mon, 12 Apr 2021 06:43:44 +0530
sameeruddin shaik <sameeruddin.shaik8@gmail.com> wrote:

> hi,
> 
> Test: tracing options ...FAILED
>      1. tracefs-utest.c:746  - check_options_mask_empty(all)
>      2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
>    Test: custom system directory ...FAILED
>      1. tracefs-utest.c:746  - check_options_mask_empty(all)
>      2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
>    Test: ftrace marker ...trace-utest: ../nptl/pthread_mutex_lock.c:81: 
> __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
> Aborted (core dumped)
> 
> 
> Above tests are failing for me, what about you guys?
> 
> Do i have to give any command line options when running the test ?
> 
> I ran test like below
> 
> -----------------------
> 
> #./trace-utest
> 
> -----------------------
> 

Hi Sameer,

Thanks for the report. Yes, it is a bug in the tests. We did a last
minute change to have the options bitmask be stored in the instance and
it is immutable, but did not update the tests. The below patch should
fix it for you. Let us know if it does.

Thanks!

-- Steve

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 1f48e6f..3407202 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -679,7 +679,7 @@ out:
 	return ret;
 }
 
-static bool check_options_mask_empty(struct tracefs_options_mask *mask)
+static bool check_options_mask_empty(const struct tracefs_options_mask *mask)
 {
 	int i;
 
@@ -692,8 +692,9 @@ static bool check_options_mask_empty(struct tracefs_options_mask *mask)
 
 static void test_instance_tracing_options(struct tracefs_instance *instance)
 {
-	struct tracefs_options_mask *enabled;
-	struct tracefs_options_mask *all, *all_copy;
+	const struct tracefs_options_mask *enabled;
+	const struct tracefs_options_mask *all_copy;
+	const struct tracefs_options_mask *all;
 	enum tracefs_option_id i = 1;
 	char file[PATH_MAX];
 	const char *name;
@@ -745,9 +746,6 @@ static void test_instance_tracing_options(struct tracefs_instance *instance)
 	}
 	CU_TEST(check_options_mask_empty(all));
 	CU_TEST(check_options_mask_empty(enabled));
-
-	free(all);
-	free(enabled);
 }
 
 static void test_tracing_options(void)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Bug in Test code
@ 2021-04-12  1:13 sameeruddin shaik
  2021-04-11  2:23 ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: sameeruddin shaik @ 2021-04-12  1:13 UTC (permalink / raw)
  To: Steven Rostedt, Tzvetomir Stoyanov; +Cc: Linux Trace Devel

hi,

Test: tracing options ...FAILED
     1. tracefs-utest.c:746  - check_options_mask_empty(all)
     2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
   Test: custom system directory ...FAILED
     1. tracefs-utest.c:746  - check_options_mask_empty(all)
     2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
   Test: ftrace marker ...trace-utest: ../nptl/pthread_mutex_lock.c:81: 
__pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
Aborted (core dumped)


Above tests are failing for me, what about you guys?

Do i have to give any command line options when running the test ?

I ran test like below

-----------------------

#./trace-utest

-----------------------

--sameer.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug in Test code
  2021-04-13  1:05   ` sameeruddin shaik
@ 2021-04-12  4:32     ` Tzvetomir Stoyanov
  2021-04-14  1:03       ` Sameeruddin Shaik
  0 siblings, 1 reply; 5+ messages in thread
From: Tzvetomir Stoyanov @ 2021-04-12  4:32 UTC (permalink / raw)
  To: sameeruddin shaik; +Cc: Steven Rostedt, Linux Trace Devel

Hi Sameer,

On Mon, Apr 12, 2021 at 4:05 AM sameeruddin shaik
<sameeruddin.shaik8@gmail.com> wrote:
>
>
> On 11/04/21 7:53 am, Steven Rostedt wrote:
> > On Mon, 12 Apr 2021 06:43:44 +0530
> > sameeruddin shaik <sameeruddin.shaik8@gmail.com> wrote:
> >
> >> hi,
> >>
> >> Test: tracing options ...FAILED
> >>       1. tracefs-utest.c:746  - check_options_mask_empty(all)
> >>       2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
> >>     Test: custom system directory ...FAILED
> >>       1. tracefs-utest.c:746  - check_options_mask_empty(all)
> >>       2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
> >>     Test: ftrace marker ...trace-utest: ../nptl/pthread_mutex_lock.c:81:
> >> __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
> >> Aborted (core dumped)
> >>
> >>
> >> Above tests are failing for me, what about you guys?
> >>
> >> Do i have to give any command line options when running the test ?
> >>
> >> I ran test like below
> >>
> >> -----------------------
> >>
> >> #./trace-utest
> >>
> >> -----------------------
> >>
> > Hi Sameer,
> >
> > Thanks for the report. Yes, it is a bug in the tests. We did a last
> > minute change to have the options bitmask be stored in the instance and
> > it is immutable, but did not update the tests. The below patch should
> > fix it for you. Let us know if it does.
> >
> > Thanks!
> >
> > -- Steve
> >
> > diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
> > index 1f48e6f..3407202 100644
> > --- a/utest/tracefs-utest.c
> > +++ b/utest/tracefs-utest.c
> > @@ -679,7 +679,7 @@ out:
> >       return ret;
> >   }
> >
> > -static bool check_options_mask_empty(struct tracefs_options_mask *mask)
> > +static bool check_options_mask_empty(const struct tracefs_options_mask *mask)
> >   {
> >       int i;
> >
> > @@ -692,8 +692,9 @@ static bool check_options_mask_empty(struct tracefs_options_mask *mask)
> >
> >   static void test_instance_tracing_options(struct tracefs_instance *instance)
> >   {
> > -     struct tracefs_options_mask *enabled;
> > -     struct tracefs_options_mask *all, *all_copy;
> > +     const struct tracefs_options_mask *enabled;
> > +     const struct tracefs_options_mask *all_copy;
> > +     const struct tracefs_options_mask *all;
> >       enum tracefs_option_id i = 1;
> >       char file[PATH_MAX];
> >       const char *name;
> > @@ -745,9 +746,6 @@ static void test_instance_tracing_options(struct tracefs_instance *instance)
> >       }
> >       CU_TEST(check_options_mask_empty(all));
> >       CU_TEST(check_options_mask_empty(enabled));
> > -
> > -     free(all);
> > -     free(enabled);
> >   }
> >
> >   static void test_tracing_options(void)
>
> No steve it didn't resolved the issue,

Thanks for running the unit tests and testing the latest release.
Indeed, there is a bug in that code that leads to a memory corruption.
And we neglected the unit tests, did not align with the latest changes
in the APIs.
Please, check if the patch set that I just sent fixes this in your
environment: "[PATCH 0/3] Fix unit tests and APIs for loading saved
mappings".


[ ... ]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug in Test code
  2021-04-11  2:23 ` Steven Rostedt
@ 2021-04-13  1:05   ` sameeruddin shaik
  2021-04-12  4:32     ` Tzvetomir Stoyanov
  0 siblings, 1 reply; 5+ messages in thread
From: sameeruddin shaik @ 2021-04-13  1:05 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Tzvetomir Stoyanov, Linux Trace Devel


On 11/04/21 7:53 am, Steven Rostedt wrote:
> On Mon, 12 Apr 2021 06:43:44 +0530
> sameeruddin shaik <sameeruddin.shaik8@gmail.com> wrote:
>
>> hi,
>>
>> Test: tracing options ...FAILED
>>       1. tracefs-utest.c:746  - check_options_mask_empty(all)
>>       2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
>>     Test: custom system directory ...FAILED
>>       1. tracefs-utest.c:746  - check_options_mask_empty(all)
>>       2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
>>     Test: ftrace marker ...trace-utest: ../nptl/pthread_mutex_lock.c:81:
>> __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
>> Aborted (core dumped)
>>
>>
>> Above tests are failing for me, what about you guys?
>>
>> Do i have to give any command line options when running the test ?
>>
>> I ran test like below
>>
>> -----------------------
>>
>> #./trace-utest
>>
>> -----------------------
>>
> Hi Sameer,
>
> Thanks for the report. Yes, it is a bug in the tests. We did a last
> minute change to have the options bitmask be stored in the instance and
> it is immutable, but did not update the tests. The below patch should
> fix it for you. Let us know if it does.
>
> Thanks!
>
> -- Steve
>
> diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
> index 1f48e6f..3407202 100644
> --- a/utest/tracefs-utest.c
> +++ b/utest/tracefs-utest.c
> @@ -679,7 +679,7 @@ out:
>   	return ret;
>   }
>   
> -static bool check_options_mask_empty(struct tracefs_options_mask *mask)
> +static bool check_options_mask_empty(const struct tracefs_options_mask *mask)
>   {
>   	int i;
>   
> @@ -692,8 +692,9 @@ static bool check_options_mask_empty(struct tracefs_options_mask *mask)
>   
>   static void test_instance_tracing_options(struct tracefs_instance *instance)
>   {
> -	struct tracefs_options_mask *enabled;
> -	struct tracefs_options_mask *all, *all_copy;
> +	const struct tracefs_options_mask *enabled;
> +	const struct tracefs_options_mask *all_copy;
> +	const struct tracefs_options_mask *all;
>   	enum tracefs_option_id i = 1;
>   	char file[PATH_MAX];
>   	const char *name;
> @@ -745,9 +746,6 @@ static void test_instance_tracing_options(struct tracefs_instance *instance)
>   	}
>   	CU_TEST(check_options_mask_empty(all));
>   	CU_TEST(check_options_mask_empty(enabled));
> -
> -	free(all);
> -	free(enabled);
>   }
>   
>   static void test_tracing_options(void)

No steve it didn't resolved the issue,

root@sameeraaron-Lenovo-Z50-70:/home/sameeraaron/hobbies/libtracefs/utest# 
./trace-utest


      CUnit - A unit testing framework for C - Version 2.1-3
      http://cunit.sourceforge.net/

*** Error in `./trace-utest': malloc(): memory corruption: 
0x0000000001251670 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7f7f8171f7f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8215e)[0x7f7f8172a15e]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x54)[0x7f7f8172c1d4]
/usr/local/lib64/libtraceevent.so.1(tep_register_print_string+0x1f)[0x7f7f81ea322c]
/usr/local/lib64/libtraceevent.so.1(tep_parse_printk_formats+0x10c)[0x7f7f81ea34cf]
./trace-utest[0x40bf2e]
./trace-utest[0x40bf9d]
./trace-utest[0x40c160]
./trace-utest(tracefs_local_events_system+0x48)[0x40c1c0]
./trace-utest[0x408c19]
/usr/lib/x86_64-linux-gnu/libcunit.so.1(+0x3e7e)[0x7f7f81a75e7e]
/usr/lib/x86_64-linux-gnu/libcunit.so.1(CU_run_all_tests+0x6e)[0x7f7f81a763be]
./trace-utest(main+0x10b)[0x403501]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f7f816c8840]
./trace-utest(_start+0x29)[0x4032a9]


--sameer.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug in Test code
  2021-04-12  4:32     ` Tzvetomir Stoyanov
@ 2021-04-14  1:03       ` Sameeruddin Shaik
  0 siblings, 0 replies; 5+ messages in thread
From: Sameeruddin Shaik @ 2021-04-14  1:03 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: Steven Rostedt, Linux Trace Devel

hi Tzvetomir,
Its worked
--sameer.

On Mon, Apr 12, 2021 at 10:02 AM Tzvetomir Stoyanov
<tz.stoyanov@gmail.com> wrote:
>
> Hi Sameer,
>
> On Mon, Apr 12, 2021 at 4:05 AM sameeruddin shaik
> <sameeruddin.shaik8@gmail.com> wrote:
> >
> >
> > On 11/04/21 7:53 am, Steven Rostedt wrote:
> > > On Mon, 12 Apr 2021 06:43:44 +0530
> > > sameeruddin shaik <sameeruddin.shaik8@gmail.com> wrote:
> > >
> > >> hi,
> > >>
> > >> Test: tracing options ...FAILED
> > >>       1. tracefs-utest.c:746  - check_options_mask_empty(all)
> > >>       2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
> > >>     Test: custom system directory ...FAILED
> > >>       1. tracefs-utest.c:746  - check_options_mask_empty(all)
> > >>       2. tracefs-utest.c:747  - check_options_mask_empty(enabled)
> > >>     Test: ftrace marker ...trace-utest: ../nptl/pthread_mutex_lock.c:81:
> > >> __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
> > >> Aborted (core dumped)
> > >>
> > >>
> > >> Above tests are failing for me, what about you guys?
> > >>
> > >> Do i have to give any command line options when running the test ?
> > >>
> > >> I ran test like below
> > >>
> > >> -----------------------
> > >>
> > >> #./trace-utest
> > >>
> > >> -----------------------
> > >>
> > > Hi Sameer,
> > >
> > > Thanks for the report. Yes, it is a bug in the tests. We did a last
> > > minute change to have the options bitmask be stored in the instance and
> > > it is immutable, but did not update the tests. The below patch should
> > > fix it for you. Let us know if it does.
> > >
> > > Thanks!
> > >
> > > -- Steve
> > >
> > > diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
> > > index 1f48e6f..3407202 100644
> > > --- a/utest/tracefs-utest.c
> > > +++ b/utest/tracefs-utest.c
> > > @@ -679,7 +679,7 @@ out:
> > >       return ret;
> > >   }
> > >
> > > -static bool check_options_mask_empty(struct tracefs_options_mask *mask)
> > > +static bool check_options_mask_empty(const struct tracefs_options_mask *mask)
> > >   {
> > >       int i;
> > >
> > > @@ -692,8 +692,9 @@ static bool check_options_mask_empty(struct tracefs_options_mask *mask)
> > >
> > >   static void test_instance_tracing_options(struct tracefs_instance *instance)
> > >   {
> > > -     struct tracefs_options_mask *enabled;
> > > -     struct tracefs_options_mask *all, *all_copy;
> > > +     const struct tracefs_options_mask *enabled;
> > > +     const struct tracefs_options_mask *all_copy;
> > > +     const struct tracefs_options_mask *all;
> > >       enum tracefs_option_id i = 1;
> > >       char file[PATH_MAX];
> > >       const char *name;
> > > @@ -745,9 +746,6 @@ static void test_instance_tracing_options(struct tracefs_instance *instance)
> > >       }
> > >       CU_TEST(check_options_mask_empty(all));
> > >       CU_TEST(check_options_mask_empty(enabled));
> > > -
> > > -     free(all);
> > > -     free(enabled);
> > >   }
> > >
> > >   static void test_tracing_options(void)
> >
> > No steve it didn't resolved the issue,
>
> Thanks for running the unit tests and testing the latest release.
> Indeed, there is a bug in that code that leads to a memory corruption.
> And we neglected the unit tests, did not align with the latest changes
> in the APIs.
> Please, check if the patch set that I just sent fixes this in your
> environment: "[PATCH 0/3] Fix unit tests and APIs for loading saved
> mappings".
>
>
> [ ... ]
>
> --
> Tzvetomir (Ceco) Stoyanov
> VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-14  1:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  1:13 Bug in Test code sameeruddin shaik
2021-04-11  2:23 ` Steven Rostedt
2021-04-13  1:05   ` sameeruddin shaik
2021-04-12  4:32     ` Tzvetomir Stoyanov
2021-04-14  1:03       ` Sameeruddin Shaik

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).