diff mbox

[05/54] perf build: Use feature dump file for build-test

Message ID 1453715801-7732-6-git-send-email-wangnan0@huawei.com
State New
Headers show

Commit Message

Wang Nan Jan. 25, 2016, 9:55 a.m. UTC
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 | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

-- 
1.8.3.4

Comments

Wang Nan Jan. 27, 2016, 2:36 a.m. UTC | #1
On 2016/1/27 0:59, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jan 25, 2016 at 09:55:52AM +0000, Wang Nan escreveu:

>> 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>

> So, I'm having this problem when this patch is applied.


[SNIP]

>

> nothing added to commit but untracked files present (use "git add" to track)

> [acme@jouet linux]$ rm -f tools/perf/BUILD_TEST_FEATURE_DUMP tools/perf/make_no_libbpf tools/perf/make_no_newt

> [acme@jouet linux]$ perf stat make -C tools/perf build-test

> make: Entering directory '/home/acme/git/linux/tools/perf'

> Testing Makefile

> - /home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP: cd . && make FEATURE_DUMP_COPY=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP  feature-dump

> cd . && make FEATURE_DUMP_COPY=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump

> - make_doc: cd . && make -f Makefile   DESTDIR=/tmp/tmp.lLyAWJ2KUJ doc FEATURES_DUMP=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP

> - make_no_libperl: cd . && make -f Makefile   DESTDIR=/tmp/tmp.iPREXpyGhh NO_LIBPERL=1 FEATURES_DUMP=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP

> cd . && make -f Makefile DESTDIR=/tmp/tmp.iPREXpyGhh NO_LIBPERL=1 FEATURES_DUMP=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP

>    BUILD:   Doing 'make -j4' parallel build

>    GEN      common-cmds.h

>    CC       fixdep.o

>    CC       perf-read-vdso32

> In file included from /usr/include/features.h:389:0,

>                   from /usr/include/stdio.h:27,

>                   from perf-read-vdso.c:1:

> /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory

> compilation terminated.

> Makefile.perf:416: recipe for target 'perf-read-vdso32' failed

> make[4]: *** [perf-read-vdso32] Error 1

> make[4]: *** Waiting for unfinished jobs....

>    LD       fixdep-in.o

>    LINK     fixdep

>    PERF_VERSION = 4.4.g80fcfd7

> Makefile:68: recipe for target 'all' failed

> make[3]: *** [all] Error 2

>    test: test -x ./perf

> tests/make:274: recipe for target 'make_no_libperl' failed

> make[2]: *** [make_no_libperl] Error 1

> tests/make:7: recipe for target 'all' failed

> make[1]: *** [all] Error 2

> Makefile:81: recipe for target 'build-test' failed

> make: *** [build-test] Error 2

> make: Leaving directory '/home/acme/git/linux/tools/perf'

>


This is the problem of test-compile-32. In 
./tools/build/feature/test-compile.c,
we check the '-m32' compiler flag but don't check include files.

Could you please have a look at your environment? Do you have 
glibc-devel-i386
installed? What's the result of

  $ gcc -m32 tools/build/feature/test-compile.c

I guess in your platform you can compile and link test-compile.c without
gnu/stubs-32.h. Then we need to improve test-compile.c to make it check 
headers
also.

Another question is why you don't meet this error before this patch. It 
seems
test-compile-32 should also pass...

Thank you.
diff mbox

Patch

diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index f918015..b8c86bd 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -15,6 +15,7 @@  else
 PERF := .
 PERF_O := $(PERF)
 O_OPT :=
+FULL_O := $(shell readlink -f $(PERF_O) || echo $(PERF_O))
 
 ifneq ($(O),)
   FULL_O := $(shell readlink -f $(O) || echo $(O))
@@ -313,11 +314,41 @@  make_kernelsrc_tools:
 	(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
 	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
+FEATURES_DUMP_FILE := $(FULL_O)/BUILD_TEST_FEATURE_DUMP
+FEATURES_DUMP_FILE_STATIC := $(FULL_O)/BUILD_TEST_FEATURE_DUMP_STATIC
+
 all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
 	@echo OK
+	@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
 
 out: $(run_O)
 	@echo OK
+	@rm -f $(FEATURES_DUMP_FILE) $(FEATURES_DUMP_FILE_STATIC)
+
+$(FEATURES_DUMP_FILE):
+	$(call clean)
+	@cmd="cd $(PERF) && make FEATURE_DUMP_COPY=$@ $(O_OPT) feature-dump"; \
+	echo "- $@: $$cmd" && echo $$cmd && \
+	( eval $$cmd ) > /dev/null 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 ) > /dev/null 2>&1
+
+# Add feature dump dependency for run/run_O targets
+$(foreach t,$(run) $(run_O),$(eval \
+	$(t): $(if $(findstring make_static,$(t)),\
+		$(FEATURES_DUMP_FILE_STATIC),\
+		$(FEATURES_DUMP_FILE))))
+
+# Append 'FEATURES_DUMP=' option to all test cases. For example:
+# make_no_libbpf: NO_LIBBPF=1  --> NO_LIBBPF=1 FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP
+# make_static: LDFLAGS=-static --> LDFLAGS=-static FEATURES_DUMP=/a/b/BUILD_TEST_FEATURE_DUMP_STATIC
+$(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))))
 
 .PHONY: all $(run) $(run_O) tarpkg clean make_kernelsrc make_kernelsrc_tools
 endif # ifndef MK