@@ -41,22 +41,7 @@ static int num_core_entries(struct evlist *evlist)
4141 return 1 ;
4242}
4343
44- static bool test_config (const struct evsel * evsel , __u64 expected_config )
45- {
46- __u32 type = evsel -> core .attr .type ;
47- __u64 config = evsel -> core .attr .config ;
48-
49- if (type == PERF_TYPE_HARDWARE || type == PERF_TYPE_HW_CACHE ) {
50- /*
51- * HARDWARE and HW_CACHE events encode the PMU's extended type
52- * in the top 32-bits. Mask in order to ignore.
53- */
54- config &= PERF_HW_EVENT_MASK ;
55- }
56- return config == expected_config ;
57- }
58-
59- static bool test_perf_config (const struct perf_evsel * evsel , __u64 expected_config )
44+ static bool test_hw_config (const struct perf_evsel * evsel , __u64 expected_config )
6045{
6146 return (evsel -> attr .config & PERF_HW_EVENT_MASK ) == expected_config ;
6247}
@@ -129,7 +114,7 @@ static int test__checkevent_raw(struct evlist *evlist)
129114 struct perf_pmu * pmu __maybe_unused = NULL ;
130115 bool type_matched = false;
131116
132- TEST_ASSERT_VAL ("wrong config" , test_perf_config (evsel , 0x1a ));
117+ TEST_ASSERT_VAL ("wrong config" , test_hw_config (evsel , 0x1a ));
133118 TEST_ASSERT_VAL ("event not parsed as raw type" ,
134119 evsel -> attr .type == PERF_TYPE_RAW );
135120#if defined(__aarch64__ )
@@ -215,7 +200,7 @@ static int test__checkevent_genhw(struct evlist *evlist)
215200
216201 perf_evlist__for_each_entry (& evlist -> core , evsel ) {
217202 TEST_ASSERT_VAL ("wrong type" , PERF_TYPE_HW_CACHE == evsel -> attr .type );
218- TEST_ASSERT_VAL ("wrong config" , test_perf_config (evsel , 1 << 16 ));
203+ TEST_ASSERT_VAL ("wrong config" , test_hw_config (evsel , 1 << 16 ));
219204 }
220205 return TEST_OK ;
221206}
@@ -596,7 +581,7 @@ static int test__checkevent_pmu(struct evlist *evlist)
596581
597582 TEST_ASSERT_VAL ("wrong number of entries" , 1 == evlist -> core .nr_entries );
598583 TEST_ASSERT_VAL ("wrong type" , core_pmu -> type == evsel -> core .attr .type );
599- TEST_ASSERT_VAL ("wrong config" , test_config ( evsel , 10 ));
584+ TEST_ASSERT_VAL ("wrong config" , test_hw_config ( & evsel -> core , 10 ));
600585 TEST_ASSERT_VAL ("wrong config1" , 1 == evsel -> core .attr .config1 );
601586 TEST_ASSERT_VAL ("wrong config2" , 3 == evsel -> core .attr .config2 );
602587 TEST_ASSERT_VAL ("wrong config3" , 0 == evsel -> core .attr .config3 );
0 commit comments