aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/parse-events.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/tests/parse-events.c')
-rw-r--r--tools/perf/tests/parse-events.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index fbdf710d5eea..edc2adcf1bae 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -470,8 +470,7 @@ static int test__checkevent_breakpoint_modifier(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "mem:0:u"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:u"));
return test__checkevent_breakpoint(evlist);
}
@@ -484,8 +483,7 @@ static int test__checkevent_breakpoint_x_modifier(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "mem:0:x:k"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:x:k"));
return test__checkevent_breakpoint_x(evlist);
}
@@ -498,8 +496,7 @@ static int test__checkevent_breakpoint_r_modifier(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "mem:0:r:hp"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:r:hp"));
return test__checkevent_breakpoint_r(evlist);
}
@@ -512,8 +509,7 @@ static int test__checkevent_breakpoint_w_modifier(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "mem:0:w:up"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:w:up"));
return test__checkevent_breakpoint_w(evlist);
}
@@ -526,8 +522,7 @@ static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "mem:0:rw:kp"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "mem:0:rw:kp"));
return test__checkevent_breakpoint_rw(evlist);
}
@@ -540,8 +535,7 @@ static int test__checkevent_breakpoint_modifier_name(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "breakpoint"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint"));
return test__checkevent_breakpoint(evlist);
}
@@ -554,8 +548,7 @@ static int test__checkevent_breakpoint_x_modifier_name(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "breakpoint"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint"));
return test__checkevent_breakpoint_x(evlist);
}
@@ -568,8 +561,7 @@ static int test__checkevent_breakpoint_r_modifier_name(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "breakpoint"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint"));
return test__checkevent_breakpoint_r(evlist);
}
@@ -582,8 +574,7 @@ static int test__checkevent_breakpoint_w_modifier_name(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "breakpoint"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint"));
return test__checkevent_breakpoint_w(evlist);
}
@@ -596,8 +587,7 @@ static int test__checkevent_breakpoint_rw_modifier_name(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "breakpoint"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint"));
return test__checkevent_breakpoint_rw(evlist);
}
@@ -609,12 +599,12 @@ static int test__checkevent_breakpoint_2_events(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
- TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "breakpoint1"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint1"));
evsel = evsel__next(evsel);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
- TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "breakpoint2"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "breakpoint2"));
return TEST_OK;
}
@@ -691,15 +681,14 @@ static int test__checkevent_pmu_name(struct evlist *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", test_config(evsel, 1));
- TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "krava"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(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", test_config(evsel, 2));
- TEST_ASSERT_VAL("wrong name",
- !strcmp(evsel__name(evsel), "cpu/config=2/u"));
+ TEST_ASSERT_VAL("wrong name", evsel__name_is(evsel, "cpu/config=2/u"));
return TEST_OK;
}
@@ -953,8 +942,8 @@ static int test__group2(struct evlist *evlist)
continue;
}
if (evsel->core.attr.type == PERF_TYPE_HARDWARE &&
- test_config(evsel, PERF_COUNT_HW_CACHE_REFERENCES)) {
- /* cache-references + :u modifier */
+ test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS)) {
+ /* branches + :u modifier */
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);
@@ -2043,7 +2032,7 @@ static const struct evlist_test test__events[] = {
/* 8 */
},
{
- .name = "{faults:k,cache-references}:u,cycles:k",
+ .name = "{faults:k,branches}:u,cycles:k",
.check = test__group2,
/* 9 */
},
@@ -2280,6 +2269,13 @@ static const struct evlist_test test__events[] = {
.check = test__checkevent_breakpoint_2_events,
/* 3 */
},
+#ifdef HAVE_LIBTRACEEVENT
+ {
+ .name = "9p:9p_client_req",
+ .check = test__checkevent_tracepoint,
+ /* 4 */
+ },
+#endif
};
static const struct evlist_test test__events_pmu[] = {
@@ -2504,13 +2500,13 @@ static int test_event(const struct evlist_test *e)
return TEST_FAIL;
}
parse_events_error__init(&err);
- ret = parse_events(evlist, e->name, &err);
+ ret = __parse_events(evlist, e->name, /*pmu_filter=*/NULL, &err, /*fake_pmu=*/NULL,
+ /*warn_if_reordered=*/true, /*fake_tp=*/true);
if (ret) {
- pr_debug("failed to parse event '%s', err %d, str '%s'\n",
- e->name, ret, err.str);
+ pr_debug("failed to parse event '%s', err %d\n", e->name, ret);
parse_events_error__print(&err, e->name);
ret = TEST_FAIL;
- if (err.str && strstr(err.str, "can't access trace events"))
+ if (parse_events_error__contains(&err, "can't access trace events"))
ret = TEST_SKIP;
} else {
ret = e->check(evlist);
@@ -2533,10 +2529,11 @@ static int test_event_fake_pmu(const char *str)
parse_events_error__init(&err);
ret = __parse_events(evlist, str, /*pmu_filter=*/NULL, &err,
- &perf_pmu__fake, /*warn_if_reordered=*/true);
+ &perf_pmu__fake, /*warn_if_reordered=*/true,
+ /*fake_tp=*/true);
if (ret) {
- pr_debug("failed to parse event '%s', err %d, str '%s'\n",
- str, ret, err.str);
+ pr_debug("failed to parse event '%s', err %d\n",
+ str, ret);
parse_events_error__print(&err, str);
}