summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorLeo Yan <leo.yan@arm.com>2026-09-30 14:11:36 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-09-30 15:34:16 -0300
commit179c2413bb601c94e144c7a84cd34ae3bee3b586 (patch)
treecd1a4f1811a20fa7834e81c606f67c95e3f2c9b7 /tools/perf
parent0ccc474fd71a5a6780559f24856533506ac4d7dd (diff)
downloadlinux-next-179c2413bb601c94e144c7a84cd34ae3bee3b586.tar.gz
linux-next-179c2413bb601c94e144c7a84cd34ae3bee3b586.zip
perf build: Build the Python extension before pylint consumers
Pylint checks for tests and standalone Python scripts can run before the perf Python extension is available. On a clean parallel build, an import error can stop make before the extension is built. Run the script and test pylint checks in separate sub-makes after the language bindings are built. Keep their rules in the respective Build files so the perf and perf-test C sub-makes can compile concurrently with util and the Python extension. An isolated make perf does not need to build the extension just for these checks. Fixes: 8a54784e708b51c1 ("perf build: Add pylint build tests") Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com> Reviewed-by: Ian Rogers <irogers@google.com> Assisted-by: Codex:gpt-6 Signed-off-by: Leo Yan <leo.yan@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Build4
-rw-r--r--tools/perf/Makefile.perf15
-rw-r--r--tools/perf/tests/Build4
3 files changed, 21 insertions, 2 deletions
diff --git a/tools/perf/Build b/tools/perf/Build
index 8a0b5592a973..09fd88f5aca5 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -102,4 +102,6 @@ $(OUTPUT)%.pylint_log: %
$(call rule_mkdir)
$(Q)$(call echo-cmd,test)$(PYLINT) "$<" > $@ || (cat $@ && rm $@ && false)
-perf-y += $(PYLINT_TEST_LOGS)
+.PHONY: pylint
+pylint: $(addprefix $(OUTPUT),$(PYLINT_TEST_LOGS))
+ @:
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 0102c3468a0b..0eb4e7c29c40 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -578,6 +578,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
PERF_IN := $(OUTPUT)perf-in.o
+
export NO_JEVENTS
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
@@ -633,6 +634,20 @@ $(SCRIPTS) : $(OUTPUT)% : %.sh
$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
$(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
+ifdef PYLINT
+# Run Python checks after the extension is ready, independently of C builds.
+all: pylint-perf pylint-tests
+.PHONY: pylint-perf pylint-tests
+
+pylint-perf pylint-tests: | $(LANG_BINDINGS)
+
+pylint-perf:
+ $(Q)$(MAKE) $(build)=perf pylint
+
+pylint-tests:
+ $(Q)$(MAKE) $(build)=perf-test dir=tests pylint
+endif
+
# These can record PERF_VERSION
perf.spec $(SCRIPTS) \
: $(OUTPUT)PERF-VERSION-FILE
diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index 8fecd5390124..05c545aac732 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -119,4 +119,6 @@ $(OUTPUT)%.pylint_log: %
$(call rule_mkdir)
$(Q)$(call echo-cmd,test)$(PYLINT) "$<" > $@ || (cat $@ && rm $@ && false)
-perf-test-y += $(PYLINT_TEST_LOGS)
+.PHONY: pylint
+pylint: $(addprefix $(OUTPUT)tests/,$(PYLINT_TEST_LOGS))
+ @: