Re: Bug in Test code

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

 




On 11/04/21 7:53 am, Steven Rostedt wrote:
On Mon, 12 Apr 2021 06:43:44 +0530
sameeruddin shaik <sameeruddin.shaik8@xxxxxxxxx> 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.




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

  Powered by Linux