summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorJames Clark <james.clark@linaro.org>2025-02-12 16:38:56 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:44:28 +0200
commit4945503dc03eab3449e1614778057c2ede4ce221 (patch)
treeebc54c1131b97dcc934934061f42de219306e19a /tools/perf
parent92cd117b8d1d3645768fb142cf64bd381bb5c1b1 (diff)
downloadlinux-4945503dc03eab3449e1614778057c2ede4ce221.tar.gz
linux-4945503dc03eab3449e1614778057c2ede4ce221.tar.bz2
linux-4945503dc03eab3449e1614778057c2ede4ce221.zip
perf tests: Fix Tool PMU test segfault
[ Upstream commit 615ec00b06f78912c370b372426190768402a5b9 ] tool_pmu__event_to_str() now handles skipped events by returning NULL, so it's wrong to re-check for a skip on the resulting string. Calling tool_pmu__skip_event() with a NULL string results in a segfault so remove the unnecessary skip to fix it: $ perf test -vv "parsing with PMU name" 12.2: Parsing with PMU name: ... ---- unexpected signal (11) ---- 12.2: Parsing with PMU name : FAILED! Fixes: ee8aef2d2321 ("perf tools: Add skip check in tool_pmu__event_to_str()") Signed-off-by: James Clark <james.clark@linaro.org> Reported-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Acked-by: Kan Liang <kan.liang@linux.intel.com> Tested-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250212163859.1489916-1-james.clark@linaro.org Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/tests/tool_pmu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/tests/tool_pmu.c b/tools/perf/tests/tool_pmu.c
index 187942b749b7..1e900ef92e37 100644
--- a/tools/perf/tests/tool_pmu.c
+++ b/tools/perf/tests/tool_pmu.c
@@ -27,7 +27,7 @@ static int do_test(enum tool_pmu_event ev, bool with_pmu)
parse_events_error__init(&err);
ret = parse_events(evlist, str, &err);
if (ret) {
- if (tool_pmu__skip_event(tool_pmu__event_to_str(ev))) {
+ if (!tool_pmu__event_to_str(ev)) {
ret = TEST_OK;
goto out;
}
@@ -59,7 +59,7 @@ static int do_test(enum tool_pmu_event ev, bool with_pmu)
}
}
- if (!found && !tool_pmu__skip_event(tool_pmu__event_to_str(ev))) {
+ if (!found && tool_pmu__event_to_str(ev)) {
pr_debug("FAILED %s:%d Didn't find tool event '%s' in parsed evsels\n",
__FILE__, __LINE__, str);
ret = TEST_FAIL;