Skip to content

Commit 79191c8

Browse files
WangNan0acmel
authored andcommitted
perf build: Use feature dump file for build-test
To prevent the feature check tests to run repeately, one time per 'tests/make' target/test, this patch utilizes the previously introduced 'feature-dump' make target and FEATURES_DUMP variable, making sure that the feature checkers run only once when doing build-test for normal test cases. However, since standard users doesn't reuse features dump result, we'd better give an option to check their behaviors. The above feature should be used to make build-test faster only. Only utilize it for build-test. Signed-off-by: Wang Nan <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 5a155bb commit 79191c8

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

tools/perf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ clean:
7878
# The build-test target is not really parallel, don't print the jobs info:
7979
#
8080
build-test:
81-
@$(MAKE) SHUF=1 -f tests/make --no-print-directory
81+
@$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 --no-print-directory
8282

8383
#
8484
# All other targets get passed through:

tools/perf/tests/make

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ else
1515
PERF := .
1616
PERF_O := $(PERF)
1717
O_OPT :=
18+
FULL_O := $(shell readlink -f $(PERF_O) || echo $(PERF_O))
1819

1920
ifneq ($(O),)
2021
FULL_O := $(shell readlink -f $(O) || echo $(O))
@@ -313,11 +314,43 @@ make_kernelsrc_tools:
313314
(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
314315
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
315316

317+
FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
318+
FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
319+
316320
all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
317321
@echo OK
322+
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
318323

319324
out: $(run_O)
320325
@echo OK
326+
@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
327+
328+
ifeq ($(REUSE_FEATURES_DUMP),1)
329+
$(FEATURES_DUMP_FILE):
330+
$(call clean)
331+
@cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \
332+
echo "- $@: $$cmd" && echo $$cmd && \
333+
( eval $$cmd ) > /dev/null 2>&1
334+
335+
$(FEATURES_DUMP_FILE_STATIC):
336+
$(call clean)
337+
@cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \
338+
echo "- $@: $$cmd" && echo $$cmd && \
339+
( eval $$cmd ) > /dev/null 2>&1
340+
341+
# Add feature dump dependency for run/run_O targets
342+
$(foreach t,$(run) $(run_O),$(eval \
343+
$(t): $(if $(findstring make_static,$(t)),\
344+
$(FEATURES_DUMP_FILE_STATIC),\
345+
$(FEATURES_DUMP_FILE))))
346+
347+
# Append 'FEATURES_DUMP=' option to all test cases. For example:
348+
# make_no_libbpf: NO_LIBBPF=1 --> NO_LIBBPF=1 FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP
349+
# make_static: LDFLAGS=-static --> LDFLAGS=-static FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP_STATIC
350+
$(foreach t,$(run),$(if $(findstring make_static,$(t)),\
351+
$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE_STATIC)),\
352+
$(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
353+
endif
321354

322355
.PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
323356
endif # ifndef MK

0 commit comments

Comments
 (0)