Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] perf tests x86: Fail the topdown test when event iteration fails
@ 2026-12-03 11:43 lirongqing
  2026-12-03 11:47 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: lirongqing @ 2026-12-03 11:43 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Li RongQing, Zide Chen,
	linux-perf-users, linux-kernel

From: Li RongQing <lirongqing@baidu.com>

The event callback returns -ENOMEM if it cannot allocate an evlist,
without updating the test result. The caller only breaks the PMU loop
on an iteration error and can return its initial TEST_OK value despite
having aborted the checks.

Return TEST_FAIL when iteration fails, retaining the callback result
for successful iterations. Identified and fixed with Comate assistance.

Fixes: 5b546de9cc17 ("perf topdown: Use attribute to see an event is a topdown metic or slots")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 tools/perf/arch/x86/tests/topdown.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/arch/x86/tests/topdown.c b/tools/perf/arch/x86/tests/topdown.c
index 5200753..33803b2 100644
--- a/tools/perf/arch/x86/tests/topdown.c
+++ b/tools/perf/arch/x86/tests/topdown.c
@@ -72,7 +72,7 @@ static int test__x86_topdown(struct test_suite *test __maybe_unused, int subtest
 
 	while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
 		if (perf_pmu__for_each_event(pmu, /*skip_duplicate_pmus=*/false, &ret, event_cb))
-			break;
+			return TEST_FAIL;
 	}
 	return ret;
 }
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 11:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 11:43 [PATCH] perf tests x86: Fail the topdown test when event iteration fails lirongqing
2026-12-03 11:47 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox