#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
                             PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
 
+static bool test_config(const struct evsel *evsel, __u64 expected_config)
+{
+       __u32 type = evsel->core.attr.type;
+       __u64 config = evsel->core.attr.config;
+
+       if (type == PERF_TYPE_HARDWARE || type == PERF_TYPE_HW_CACHE) {
+               /*
+                * HARDWARE and HW_CACHE events encode the PMU's extended type
+                * in the top 32-bits. Mask in order to ignore.
+                */
+               config &= PERF_HW_EVENT_MASK;
+       }
+       return config == expected_config;
+}
+
 #ifdef HAVE_LIBTRACEEVENT
 
 #if defined(__s390x__)
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a));
        return TEST_OK;
 }
 
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 1));
        return TEST_OK;
 }
 
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
        return TEST_OK;
 }
 
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        /*
         * The period value gets configured within evlist__config,
         * while this test executes only parse events method.
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_SW_PAGE_FAULTS));
        return TEST_OK;
 }
 
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", (1 << 16) == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 1 << 16));
        return TEST_OK;
 }
 
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0));
        TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) ==
                                         evsel->core.attr.bp_type);
        TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_4 ==
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0));
        TEST_ASSERT_VAL("wrong bp_type",
                        HW_BREAKPOINT_X == evsel->core.attr.bp_type);
        TEST_ASSERT_VAL("wrong bp_len", sizeof(long) == evsel->core.attr.bp_len);
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type",
                        PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0));
        TEST_ASSERT_VAL("wrong bp_type",
                        HW_BREAKPOINT_R == evsel->core.attr.bp_type);
        TEST_ASSERT_VAL("wrong bp_len",
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type",
                        PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0));
        TEST_ASSERT_VAL("wrong bp_type",
                        HW_BREAKPOINT_W == evsel->core.attr.bp_type);
        TEST_ASSERT_VAL("wrong bp_len",
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type",
                        PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0));
        TEST_ASSERT_VAL("wrong bp_type",
                (HW_BREAKPOINT_R|HW_BREAKPOINT_W) == evsel->core.attr.bp_type);
        TEST_ASSERT_VAL("wrong bp_len",
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",    10 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config",    test_config(evsel, 10));
        TEST_ASSERT_VAL("wrong config1",    1 == evsel->core.attr.config1);
        TEST_ASSERT_VAL("wrong config2",    3 == evsel->core.attr.config2);
        TEST_ASSERT_VAL("wrong config3",    0 == evsel->core.attr.config3);
 
        /* r1 */
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 1));
        TEST_ASSERT_VAL("wrong config1", 0 == evsel->core.attr.config1);
        TEST_ASSERT_VAL("wrong config2", 0 == evsel->core.attr.config2);
        TEST_ASSERT_VAL("wrong config3", 0 == evsel->core.attr.config3);
        /* 1:1:hp */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 1));
        TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cpu/config=1,name=krava/u */
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",  1 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 1));
        TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "krava"));
 
        /* cpu/config=2/u" */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",  2 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 2));
        TEST_ASSERT_VAL("wrong name",
                        !strcmp(evsel__name(evsel), "cpu/config=2/u"));
 
        /* cpu/config=1,call-graph=fp,time,period=100000/ */
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",  1 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 1));
        /*
         * The period, time and callgraph value gets configured within evlist__config,
         * while this test executes only parse events method.
        /* cpu/config=2,call-graph=no,time=0,period=2000/ */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",  2 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 2));
        /*
         * The period, time and callgraph value gets configured within evlist__config,
         * while this test executes only parse events method.
        /* instructions:k */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
        TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cycles:upp */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* faults + :ku modifier */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_SW_PAGE_FAULTS));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cache-references + :u modifier */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_REFERENCES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_REFERENCES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cycles:k */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* group1 cycles:kppp */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* group2 cycles + G modifier */
        evsel = leader = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* group2 1:3 + G modifier */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 3 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 3));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* instructions:u */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cycles:u + p */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* instructions:kp + p */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
        TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cycles + G */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* instructions + G */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cycles:G */
        evsel = leader = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* instructions:G */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cycles */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cycles + :H group modifier */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cache-misses:G + :H group modifier */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_MISSES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cycles + :G group modifier */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cache-misses:H + :G group modifier */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_MISSES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cycles:G + :u group modifier */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cache-misses:H + :u group modifier */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_MISSES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cycles:G + :uG group modifier */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cache-misses:H + :uG group modifier */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_MISSES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cycles - sampling group leader */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* cache-misses - not sampling */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_MISSES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* branch-misses - not sampling */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_MISSES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
        /* instructions - sampling group leader */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* branch-misses - not sampling */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_MISSES));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
        /* cycles - group leader */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
        TEST_ASSERT_VAL("wrong pinned", evsel->core.attr.pinned);
        /* cache-misses - can not be pinned, but will go on with the leader */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_MISSES));
        TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
 
        /* branch-misses - ditto */
        evsel = evsel__next(evsel);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_MISSES));
        TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
 
        return TEST_OK;
        /* cycles - group leader */
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
        TEST_ASSERT_VAL("wrong exclusive", evsel->core.attr.exclusive);
        /* cache-misses - can not be pinned, but will go on with the leader */
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CACHE_MISSES));
        TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
 
        /* branch-misses - ditto */
        evsel = evsel__next(evsel);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_MISSES));
        TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
 
        return TEST_OK;
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0));
        TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) ==
                                         evsel->core.attr.bp_type);
        TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_1 ==
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0));
        TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_W ==
                                         evsel->core.attr.bp_type);
        TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_2 ==
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config",
-                       PERF_COUNT_SW_TASK_CLOCK == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_SW_TASK_CLOCK));
        return TEST_OK;
 }
 
 {
        struct evsel *evsel = evlist__first(evlist);
 
-       TEST_ASSERT_VAL("wrong complex name parsing", evsel__name_is(evsel, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks"));
+       TEST_ASSERT_VAL("wrong complex name parsing",
+                       evsel__name_is(evsel,
+                                      "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks"));
        return TEST_OK;
 }
 
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a));
        return TEST_OK;
 }
 
        struct evsel *evsel = evlist__first(evlist);
 
        TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
-       TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        return TEST_OK;
 }
        struct evsel *evsel = evlist__first(evlist);
 
        TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
-       TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
        TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
        return TEST_OK;
 }
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x3c == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x3c));
        return TEST_OK;
 }
 
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x3c == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x3c));
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
 
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0xc0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0xc0));
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
        return TEST_OK;
 }
 
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x3c == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x3c));
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
        return TEST_OK;
 }
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x3c == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x3c));
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
 
        evsel = evsel__next(evsel);
        evsel = leader = evlist__first(evlist);
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x3c == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x3c));
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
        TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
 
        evsel = evsel__next(evsel);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0xc0 == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0xc0));
        TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        if (!perf_pmu__hybrid_mounted("cpu_atom")) {
                TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
                TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-               TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
+               TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a));
                return TEST_OK;
        }
 
        TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a));
 
        /* The type of second event is randome value */
        evsel = evsel__next(evsel);
-       TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a));
        return TEST_OK;
 }
 
 
        TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
        TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
-       TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
+       TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a));
        return TEST_OK;
 }