Skip to contentSkip to conversation

perf tests parse-events: Add intel_pt parse test

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 16, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  b3f58c8da64bc63bd0c0a06a4e2cf258a3d20be6
Gitweb:     https://git.kernel.org/tip/b3f58c8da64bc63bd0c0a06a4e2cf258a3d20be6
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 11 May 2018 11:48:54 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 15 May 2018 10:31:59 -0300

perf tests parse-events: Add intel_pt parse test

To avoid regressions such as the one fixed by 4a35a9027f64 ("Revert "perf pmu: Fix pmu events parsing rule""), where '-e intel_pt//u' got broken, with this new entry in this 'perf tests' subtest, we would have caught it before pushing upstream.

---
 tools/perf/tests/parse-events.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tools/perf/tests/parse-events.c +13 -0
index 18b06444f230..6829dd416a99 100644
@@ -1309,6 +1309,14 @@ static int test__checkevent_config_cache(struct perf_evlist *evlist)
 	return 0;
 }
 
+static int test__intel_pt(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0);
+	return 0;
+}
+
 static int count_tracepoints(void)
 {
 	struct dirent *events_ent;
@@ -1637,6 +1645,11 @@ static struct evlist_test test__events[] = {
 		.check = test__checkevent_config_cache,
 		.id    = 51,
 	},
+	{
+		.name  = "intel_pt//u",
+		.check = test__intel_pt,
+		.id    = 52,
+	},
 };
 
 static struct evlist_test test__events_pmu[] = {