Re: [PATCH 9/9] perf build: Use feature dump file for build-test

Jiri Olsa
2016-01-14T10:23:50Z

On Wed, Jan 13, 2016 at 12:17:22PM +0000, Wang Nan wrote:
> To prevent feature check run too many times, this patch utilizes
> previous introduced feature-dump make target and FEATURES_DUMP
> variable, makes sure the feature checkers run only once when doing
> build-test for normal test cases.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/tests/make | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index 336a6a6..10493ab 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -15,6 +15,7 @@ else
> PERF := .
> PERF_OUT := $(PERF)
> O_OPT :=
> +FULL_O := $(shell readlink -f $(PERF_OUT) || echo $(PERF_OUT))
>
> ifneq ($(O),)
> FULL_O := $(shell readlink -f $(O) || echo $(O))
> @@ -319,5 +320,29 @@ all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
> out: $(run_O)
> @echo OK
>
> +FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
> +FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
> +
> +$(FEATURES_DUMP_FILE):
> + $(call clean)
> + @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \
> + echo "- $@: $$cmd" && echo $$cmd && \
> + ( eval $$cmd ) 2>&1
> +
> +$(FEATURES_DUMP_FILE_STATIC):
> + $(call clean)
> + @cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) LDFLAGS='-static' feature-dump"; \
> + echo "- $@: $$cmd" && echo $$cmd && \
> + ( eval $$cmd ) 2>&1
> +
> +$(foreach t,$(run) $(run_O),$(eval \
> + $(t): $(if $(findstring make_static,$(t)),\
> + $(FEATURES_DUMP_FILE_STATIC),\
> + $(FEATURES_DUMP_FILE))))

could you please put comment in here.. it's not too obvious ;-)

like saying it's just adding proper feature dump dependency
for run/run_O targets.. or something like that

> +
> +$(foreach t,$(run),$(if $(findstring make_static,$(t)),\
> + $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE_STATIC)),\
> + $(eval $(t) := $($(t)) FEATURES_DUMP=$(FEATURES_DUMP_FILE))))
> +

ditto

thanks,
jirka