Skip to contentSkip to conversation

perf build: Make build-test faster

PATCH Superseded Wang Nan 3 participants 19 messages Jan 14, 2016 – Jan 15, 2016 perf events

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Wang Nan

author
#0 lore raw

v2 cover perf build: Make build-test faster

Utilize Jiri's feature-dump make target to avoid make build-test check features too many times.

v1 -> v2: Add more comment in makefile, fix 'test' commands for
kernel build test cases (add lost 'perf'), rename make vars, remove feature dumps after all tests finished.

Jiri Olsa (2):
perf build: Add feature-dump target
perf build: Introduce FEATURES_DUMP make variable

Wang Nan (7):
perf build: Set parallel making options build-test perf build: Pass O option to Makefile.perf in build-test perf build: Test correct path of perf in build-test perf build: Pass O option to kernel makefile in build-test tools build: Allow subprojects select all feature checkers perf build: Select all feature checkers for feature-dump perf build: Use feature dump file for build-test

 tools/build/Makefile.feature | 21 ++++++++++-
 tools/perf/Makefile.perf     | 34 +++++++++++++++++-
 tools/perf/config/Makefile   |  4 +++
 tools/perf/tests/make        | 86 ++++++++++++++++++++++++++++++++++++--------
 4 files changed, 128 insertions(+), 17 deletions(-)
Signature · 1 line
1.8.3.4
author
#1 lore raw

PATCH v2 1/9 perf build: Set parallel making options build-test

'make build-test' is painful because of time consuming. In a full test, all test cases are built twice with tools/perf/Makefile and tools/perf/Makefile.perf. 'Makefile' automatically computes parallel options for make, but 'Makefile.perf' not, so all test cases is built with one job. It is very slow.

This patch adds '-j' options to Makefile.perf testing. It computes parallel building options like what tools/perf/Makefile does, and pass '-j' option to Makefile.perf test.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/tests/make | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
tools/perf/tests/make +16 -7
index df38dec..c0ee679 100644
@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),)
 # no target specified, trigger the whole suite
 all:
 	@echo "Testing Makefile";      $(MAKE) -sf tests/make MK=Makefile
-	@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf
+	@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1
 else
 # run only specific test over 'Makefile'
 %:
@@ -14,6 +14,15 @@ endif
 else
 PERF := .
 
+PARALLEL_OPT=
+ifeq ($(SET_PARALLEL),1)
+  cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
+  ifeq ($(cores),0)
+    cores := 1
+  endif
+  PARALLEL_OPT="-j$(cores)"
+endif
+
 # As per kernel Makefile, avoid funny character set dependencies
 unexport LC_ALL
 LC_COLLATE=C
@@ -252,7 +261,7 @@ clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
 $(run):
 	$(call clean)
 	@TMP_DEST=$$(mktemp -d); \
-	cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \
+	cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) DESTDIR=$$TMP_DEST $($@)"; \
 	echo "- $@: $$cmd" && echo $$cmd > $@ && \
 	( eval $$cmd ) >> $@ 2>&1; \
 	echo "  test: $(call test,$@)" >> $@ 2>&1; \
@@ -263,7 +272,7 @@ $(run_O):
 	$(call clean)
 	@TMP_O=$$(mktemp -d); \
 	TMP_DEST=$$(mktemp -d); \
-	cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
+	cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
 	echo "- $@: $$cmd" && echo $$cmd > $@ && \
 	( eval $$cmd ) >> $@ 2>&1 && \
 	echo "  test: $(call test_O,$@)" >> $@ 2>&1; \
@@ -277,15 +286,15 @@ tarpkg:
 	rm -f $@
 
 make_kernelsrc:
-	@echo "- make -C <kernelsrc> tools/perf"
+	@echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
 	$(call clean); \
-	(make -C ../.. tools/perf) > $@ 2>&1 && \
+	(make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
 	test -x perf && rm -f $@ || (cat $@ ; false)
 
 make_kernelsrc_tools:
-	@echo "- make -C <kernelsrc>/tools perf"
+	@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
 	$(call clean); \
-	(make -C ../../tools perf) > $@ 2>&1 && \
+	(make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
 	test -x perf && rm -f $@ || (cat $@ ; false)
 
 all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
Signature · 1 line
1.8.3.4
author
#2 lore raw

PATCH v2 2/9 perf build: Pass O option to Makefile.perf in build-test

In reply to Wang Nan

Doesn't like tools/perf/Makefile, tools/perf/Makefile.perf obey 'O' option when it is passed through cmdline only, because of code in tools/scripts/Makefile.include:

ifneq ($(O),)
ifeq ($(origin O), command line)
...
ABSOLUTE_O := $(shell cd $(O) ; pwd) OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
endif
endif

This patch passes 'O' to Makefile.perf through cmdline explicitly to make it follow O variable during build-test.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/tests/make | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
tools/perf/tests/make +10 -2
index c0ee679..14d7b8d 100644
@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),)
 # no target specified, trigger the whole suite
 all:
 	@echo "Testing Makefile";      $(MAKE) -sf tests/make MK=Makefile
-	@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1
+	@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1
 else
 # run only specific test over 'Makefile'
 %:
@@ -13,6 +13,14 @@ else
 endif
 else
 PERF := .
+O_OPT :=
+
+ifneq ($(O),)
+  FULL_O := $(shell readlink -f $(O) || echo $(O))
+  ifeq ($(SET_O),1)
+    O_OPT := 'O=$(FULL_O)'
+  endif
+endif
 
 PARALLEL_OPT=
 ifeq ($(SET_PARALLEL),1)
@@ -261,7 +269,7 @@ clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
 $(run):
 	$(call clean)
 	@TMP_DEST=$$(mktemp -d); \
-	cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) DESTDIR=$$TMP_DEST $($@)"; \
+	cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST $($@)"; \
 	echo "- $@: $$cmd" && echo $$cmd > $@ && \
 	( eval $$cmd ) >> $@ 2>&1; \
 	echo "  test: $(call test,$@)" >> $@ 2>&1; \
Signature · 1 line
1.8.3.4
author
#3 lore raw

PATCH v2 3/9 perf build: Test correct path of perf in build-test

In reply to Wang Nan

If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f' will fail because perf resides in a different directory. Fix this by computing PERF_OUT according to 'O' and test correct output files. For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR instead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/tests/make | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
tools/perf/tests/make +15 -8
index 14d7b8d..e74c86b 100644
@@ -13,10 +13,12 @@ else
 endif
 else
 PERF := .
+PERF_O := $(PERF)
 O_OPT :=
 
 ifneq ($(O),)
   FULL_O := $(shell readlink -f $(O) || echo $(O))
+  PERF_O := $(FULL_O)
   ifeq ($(SET_O),1)
     O_OPT := 'O=$(FULL_O)'
   endif
@@ -173,11 +175,11 @@ test_make_doc    := $(test_ok)
 test_make_help_O := $(test_ok)
 test_make_doc_O  := $(test_ok)
 
-test_make_python_perf_so := test -f $(PERF)/python/perf.so
+test_make_python_perf_so := test -f $(PERF_O)/python/perf.so
 
-test_make_perf_o           := test -f $(PERF)/perf.o
-test_make_util_map_o       := test -f $(PERF)/util/map.o
-test_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o
+test_make_perf_o           := test -f $(PERF_O)/perf.o
+test_make_util_map_o       := test -f $(PERF_O)/util/map.o
+test_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
 
 define test_dest_files
   for file in $(1); do				\
@@ -244,7 +246,7 @@ test_make_perf_o_O            := test -f $$TMP_O/perf.o
 test_make_util_map_o_O        := test -f $$TMP_O/util/map.o
 test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
 
-test_default = test -x $(PERF)/perf
+test_default = test -x $(PERF_O)/perf
 test = $(if $(test_$1),$(test_$1),$(test_default))
 
 test_default_O = test -x $$TMP_O/perf
@@ -264,7 +266,7 @@ endif
 
 MAKEFLAGS := --no-print-directory
 
-clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
 
 $(run):
 	$(call clean)
@@ -293,17 +295,22 @@ tarpkg:
 	( eval $$cmd ) >> $@ 2>&1 && \
 	rm -f $@
 
+KERNEL_O := ../..
+ifneq ($(O),)
+  KERNEL_O := $(O)
+endif
+
 make_kernelsrc:
 	@echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
 	$(call clean); \
 	(make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
-	test -x perf && rm -f $@ || (cat $@ ; false)
+	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
 make_kernelsrc_tools:
 	@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
 	$(call clean); \
 	(make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
-	test -x perf && rm -f $@ || (cat $@ ; false)
+	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
 all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
 	@echo OK
Signature · 1 line
1.8.3.4
#4 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:

Quoted 6 lines

If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f' will fail because perf resides in a different directory. Fix this by computing PERF_OUT according to 'O' and test correct output files. For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR instead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).

So, before this patch:

[acme@felicio linux]$ make -C tools/perf -f tests/make make_static
make: Entering directory `/home/acme/git/linux/tools/perf' Testing Makefile
make[1]: Entering directory `/home/acme/git/linux/tools/perf'
- make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.aCtpIoMBDZ LDFLAGS=-static
make[1]: Leaving directory `/home/acme/git/linux/tools/perf'
make: Leaving directory `/home/acme/git/linux/tools/perf' [acme@felicio linux]$

after I applied it it was failing, but now, running just the 'make_static' target, it works, oops, trying to run it as plain 'build-test', i.e. randomly picking the targets and running them all...

Also note that I'm not using O= at all, trying to check first if it works without it, to avoid introducing a regression.

Ok, failed again, I was lucky and it was the second test to run, it seems some cleanup is not being done wrt the python binding...

  $ make -C tools/perf build-test
  make: Entering directory `/home/acme/git/linux/tools/perf'
  Testing Makefile
  - make_no_demangle: cd . && make -f Makefile   DESTDIR=/tmp/tmp.OO1OfcvkFQ NO_DEMANGLE=1
  - make_static: cd . && make -f Makefile   DESTDIR=/tmp/tmp.jSd2VoICTE LDFLAGS=-static
  cd . && make -f Makefile DESTDIR=/tmp/tmp.jSd2VoICTE LDFLAGS=-static
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:

  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...        numa_num_possible_cpus: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]
  ...            libdw-dwarf-unwind: [ on  ]
  ...                          zlib: [ on  ]
  ...                          lzma: [ on  ]
  ...                     get_cpuid: [ on  ]
  ...                           bpf: [ on  ]
    GEN      common-cmds.h
    PERF_VERSION = 4.4.ge0a5e17c
    CC       plugin_hrtimer.o
    CC       plugin_jbd2.o
    CC       plugin_kmem.o
    LD       plugin_jbd2-in.o
<SNIP>
    CC       tests/llvm.o
    AR       libperf.a
    CC       tests/bpf.o
    CC       tests/topology.o
    CC       tests/cpumap.o
    CC       tests/stat.o
    CC       tests/event_update.o
    CC       tests/dwarf-unwind.o
  /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
  /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
    CC       tests/llvm-src-base.o
  cp: cannot stat ‘python_ext_build/lib/perf.so’: No such file or directory
  make[4]: *** [python/perf.so] Error 1
  make[4]: *** Waiting for unfinished jobs....
    CC       tests/llvm-src-kbuild.o
    CC       tests/llvm-src-prologue.o
    CC       perf.o
    LD       tests/perf-in.o
    LD       perf-in.o

make[4]: *** wait: No child processes. Stop. make[3]: *** [all] Error 2
test: test -x ./perf
make[2]: *** [make_static] Error 1
make[1]: *** [all] Error 2
make: *** [build-test] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf' [acme@felicio linux]$

- Arnaldo

Quoted 86 lines
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/tests/make | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
tools/perf/tests/make +15 -8
index 14d7b8d..e74c86b 100644
@@ -13,10 +13,12 @@ else
 endif
 else
 PERF := .
+PERF_O := $(PERF)
 O_OPT :=
 
 ifneq ($(O),)
   FULL_O := $(shell readlink -f $(O) || echo $(O))
+  PERF_O := $(FULL_O)
   ifeq ($(SET_O),1)
     O_OPT := 'O=$(FULL_O)'
   endif
@@ -173,11 +175,11 @@ test_make_doc    := $(test_ok)
 test_make_help_O := $(test_ok)
 test_make_doc_O  := $(test_ok)
 
-test_make_python_perf_so := test -f $(PERF)/python/perf.so
+test_make_python_perf_so := test -f $(PERF_O)/python/perf.so
 
-test_make_perf_o           := test -f $(PERF)/perf.o
-test_make_util_map_o       := test -f $(PERF)/util/map.o
-test_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o
+test_make_perf_o           := test -f $(PERF_O)/perf.o
+test_make_util_map_o       := test -f $(PERF_O)/util/map.o
+test_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
 
 define test_dest_files
   for file in $(1); do				\
@@ -244,7 +246,7 @@ test_make_perf_o_O            := test -f $$TMP_O/perf.o
 test_make_util_map_o_O        := test -f $$TMP_O/util/map.o
 test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
 
-test_default = test -x $(PERF)/perf
+test_default = test -x $(PERF_O)/perf
 test = $(if $(test_$1),$(test_$1),$(test_default))
 
 test_default_O = test -x $$TMP_O/perf
@@ -264,7 +266,7 @@ endif
 
 MAKEFLAGS := --no-print-directory
 
-clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
 
 $(run):
 	$(call clean)
@@ -293,17 +295,22 @@ tarpkg:
 	( eval $$cmd ) >> $@ 2>&1 && \
 	rm -f $@
 
+KERNEL_O := ../..
+ifneq ($(O),)
+  KERNEL_O := $(O)
+endif
+
 make_kernelsrc:
 	@echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
 	$(call clean); \
 	(make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
-	test -x perf && rm -f $@ || (cat $@ ; false)
+	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
 make_kernelsrc_tools:
 	@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
 	$(call clean); \
 	(make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
-	test -x perf && rm -f $@ || (cat $@ ; false)
+	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
 all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
 	@echo OK
Signature · 1 line
1.8.3.4
#5 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 9 lines

Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:

Quoted 6 lines

If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f' will fail because perf resides in a different directory. Fix this by computing PERF_OUT according to 'O' and test correct output files. For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR instead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).

So, before this patch:

Also, while trying to get this to work, I found these places lacking the O= prefixing, right?

tools/perf/tests/make +4 -4
index e74c86b00c31..67842900482e 100644
@@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
 
 # standard single make variable specified
 make_clean_all      := clean all
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(PERF_O)/python/perf.so
 make_debug          := DEBUG=1
 make_no_libperl     := NO_LIBPERL=1
 make_no_libpython   := NO_LIBPYTHON=1
@@ -82,9 +82,9 @@ make_tags           := tags
 make_cscope         := cscope
 make_help           := help
 make_doc            := doc
-make_perf_o           := perf.o
-make_util_map_o       := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
+make_perf_o           := $(PERF_O)/perf.o
+make_util_map_o       := $(PERF_O)/util/map.o
+make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
 make_install        := install
 make_install_bin    := install-bin
 make_install_doc    := install-doc
#6 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

发自我的 iPhone

Quoted 40 lines · 在 2016年1月14日,下午10:58,Arnaldo Carvalho de Melo <[email protected]> 写道:

Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 9 lines

Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:

Quoted 6 lines

If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f' will fail because perf resides in a different directory. Fix this by computing PERF_OUT according to 'O' and test correct output files. For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR instead because the path is different from others ($(O)/perf vs $(O)/tools/perf).

So, before this patch:

Also, while trying to get this to work, I found these places lacking the O= prefixing, right?

tools/perf/tests/make +0 -0
index e74c86b00c31..67842900482e 100644
@@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
 
 # standard single make variable specified

make_clean_all := clean all

tools/perf/tests/make +1 -1
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(PERF_O)/python/perf.so
make_debug          := DEBUG=1
make_no_libperl     := NO_LIBPERL=1
make_no_libpython   := NO_LIBPYTHON=1
tools/perf/tests/make +0 -0
@@ -82,9 +82,9 @@ make_tags           := tags
make_cscope         := cscope
make_help           := help
make_doc            := doc
tools/perf/tests/make +3 -3
-make_perf_o           := perf.o
-make_util_map_o       := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
+make_perf_o           := $(PERF_O)/perf.o
+make_util_map_o       := $(PERF_O)/util/map.o
+make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
Quoted 3 lines
make_install        := install
make_install_bin    := install-bin
make_install_doc    := install-doc

I have throughly tested this patch set, both with and without O, many times, and see no error related to this part of code, so I think we don't really need this prefix.

But maybe there's error I never noticed. Let me check it tomorrow.

Thank you.

#7 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

Em Thu, Jan 14, 2016 at 11:08:11PM +0800, pi3orama escreveu:

Quoted 53 lines

发自我的 iPhone

Quoted 40 lines · 在 2016年1月14日,下午10:58,Arnaldo Carvalho de Melo <[email protected]> 写道:

Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 9 lines

Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:

Quoted 6 lines

If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f' will fail because perf resides in a different directory. Fix this by computing PERF_OUT according to 'O' and test correct output files. For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR instead because the path is different from others ($(O)/perf vs $(O)/tools/perf).

So, before this patch:

Also, while trying to get this to work, I found these places lacking the O= prefixing, right?

tools/perf/tests/make +0 -0
index e74c86b00c31..67842900482e 100644
@@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
 
 # standard single make variable specified

make_clean_all := clean all

tools/perf/tests/make +1 -1
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(PERF_O)/python/perf.so
make_debug          := DEBUG=1
make_no_libperl     := NO_LIBPERL=1
make_no_libpython   := NO_LIBPYTHON=1
tools/perf/tests/make +0 -0
@@ -82,9 +82,9 @@ make_tags           := tags
make_cscope         := cscope
make_help           := help
make_doc            := doc
tools/perf/tests/make +3 -3
-make_perf_o           := perf.o
-make_util_map_o       := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
+make_perf_o           := $(PERF_O)/perf.o
+make_util_map_o       := $(PERF_O)/util/map.o
+make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
Quoted 3 lines
make_install        := install
make_install_bin    := install-bin
make_install_doc    := install-doc

I have throughly tested this patch set, both with and without O, many times, and see no error related to this part of code, so I think we don't really need this prefix.

Quoted 2 lines

But maybe there's error I never noticed. Let me check it tomorrow.

Ok, but are you testing it patch after patch or just after all the patches in this series are applied?

Here, with up to:

I am getting 'make clean' related errors after some tests on a RHEL7.1 test machine:

- make_no_libunwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.CKrCzt1X85 NO_LIBUNWIND=1
find: ‘/home/acme/git/linux/tools/perf/tests/dso-data.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/.dso-data.o.cmd’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/pmu.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/sw-clock.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/.sample-parsing.o.cmd’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/attr.o’: No such file or directory
- make_help: cd . && make -f Makefile DESTDIR=/tmp/tmp.9Gcw1OfooR help
- make_no_slang: cd . && make -f Makefile DESTDIR=/tmp/tmp.Ce5PSg2snH NO_SLANG=1

And 'build-test' fails when it tries to run the 'make_static' target and that is not the first one to be run:

- make_no_libelf: cd . && make -f Makefile DESTDIR=/tmp/tmp.tEwrxaQPOB NO_LIBELF=1
- make_no_libdw_dwarf_unwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.4r7zlxeeAA NO_LIBDW_DWARF_UNWIND=1
- make_no_libnuma: cd . && make -f Makefile DESTDIR=/tmp/tmp.XuaZ3SACwX NO_LIBNUMA=1
- make_perf_o: cd . && make -f Makefile DESTDIR=/tmp/tmp.LXh3STdaiO perf.o
- make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:

...                         dwarf: [ on  ]
...                         glibc: [ on  ]
...                          gtk2: [ on  ]
...                      libaudit: [ on  ]
...                        libbfd: [ on  ]
...                        libelf: [ on  ]
...                       libnuma: [ on  ]
...        numa_num_possible_cpus: [ on  ]
...                       libperl: [ on  ]
...                     libpython: [ on  ]
...                      libslang: [ on  ]
...                     libunwind: [ on  ]
...            libdw-dwarf-unwind: [ on  ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ on  ]
...                           bpf: [ on  ]

GEN common-cmds.h
PERF_VERSION = 4.4.gbe874d2
CC plugin_hrtimer.o

<SNIP>

  CC       util/zlib.o
  CC       util/lzma.o
  FLEX     util/parse-events-flex.c
  FLEX     util/pmu-flex.c
  CC       util/pmu-bison.o
  CC       util/parse-events.o
  CC       util/parse-events-flex.o
  CC       util/pmu.o
  CC       util/pmu-flex.o
  LD       util/libperf-in.o
  LD       libperf-in.o
  AR       libperf.a

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
cp: cannot stat ‘python_ext_build/lib/perf.so’: No such file or directory
make[4]: *** [python/perf.so] Error 1
make[3]: *** [all] Error 2
test: test -x ./perf
make[2]: *** [make_static] Error 1
make[1]: *** [all] Error 2
make: *** [build-test] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'

-------------------

If I try it manually, in the source tree:

[acme@felicio linux]$ cd tools/perf
[acme@felicio perf]$ make LDFLAGS=-static

  BUILD:   Doing 'make -j4' parallel build
  GEN      libtraceevent-dynamic-list
  LINK     libperf-gtk.so

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libperf-gtk.so] Error 1
make: *** [all] Error 2
[acme@felicio perf]$

And if I do a make clean and try again, it works:

[acme@felicio perf]$ make clean

  CLEAN    libtraceevent
  CLEAN    libapi
  CLEAN    libbpf
  CLEAN    libsubcmd
  CLEAN    libsubcmd
  CLEAN    config
  CLEAN    core-objs
  CLEAN    core-progs
  CLEAN    core-gen
  SUBDIR   Documentation
  CLEAN    Documentation
  CLEAN    python

[acme@felicio perf]$ make LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]

config/Makefile:268: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR config/Makefile:272: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev config/Makefile:328: DWARF support is off, BPF prologue is disabled
config/Makefile:342: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:360: Disabling post unwind, no support found.
config/Makefile:401: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:416: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:430: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:458: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev config/Makefile:501: No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev config/Makefile:562: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling config/Makefile:591: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev config/Makefile:604: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev

  GEN      common-cmds.h
  CC       util/abspath.o
  CC       fd/array.o
  CC       fs/fs.o
  CC       util/alias.o
  CC       fs/tracing_path.o

PERF_VERSION = 4.4.gbe874d2
CC event-parse.o
CC util/annotate.o
<SNIP>

  CC       tests/llvm-src-prologue.o
  LD       tests/perf-in.o
  LD       perf-in.o
  LD       libperf-in.o
  AR       libperf.a
  LINK     perf

/home/acme/git/linux/tools/lib/traceevent/libtraceevent.a(libtraceevent-in.o): In function `load_plugin':
/home/acme/git/linux/tools/lib/traceevent/event-plugin.c:304: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking libperf.a(libperf-in.o): In function `target__parse_uid':
/home/acme/git/linux/tools/perf/util/target.c:79: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/acme/git/linux/tools/perf/util/target.c:91: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x682b): warning: the use of mktemp' is dangerous, better use mkstemp'
[acme@felicio perf]$

Running it again I don't see those warnings, that are for things we should fix eventually for static builds but that are not problems related to what we're trying to fix here:

[acme@felicio perf]$ make LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]

config/Makefile:268: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR config/Makefile:272: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev config/Makefile:328: DWARF support is off, BPF prologue is disabled
config/Makefile:342: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:360: Disabling post unwind, no support found.
config/Makefile:401: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:416: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:430: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:458: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev config/Makefile:501: No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev config/Makefile:562: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling config/Makefile:591: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev config/Makefile:604: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev [acme@felicio perf]$

- Arnaldo

#8 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

Em Thu, Jan 14, 2016 at 12:44:36PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 7 lines

If I try it manually, in the source tree:

[acme@felicio linux]$ cd tools/perf [acme@felicio perf]$ make LDFLAGS=-static

  BUILD:   Doing 'make -j4' parallel build
  GEN      libtraceevent-dynamic-list
  LINK     libperf-gtk.so
Quoted 8 lines

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libperf-gtk.so] Error 1
make: *** [all] Error 2
[acme@felicio perf]$

And if I do a make clean and try again, it works:

[acme@felicio linux]$ git log --oneline -5
be874d2f8baa perf build: Test correct path of perf in build-test dab97c905927 perf build: Pass O option to Makefile.perf in build-test 7d66631ea112 perf build: Set parallel making options build-test 69d5f8e92f05 perf symbols: Fix reading of build-id from vDSO 8bf78e69a277 perf kvm record/report: 'unprocessable sample' error while recording/reporting guest data
[acme@felicio linux]$

So, with that hunch, I tried with the patch below and it finishes a 'make -C tools/perf build-test' run with no find .cmd errors not 'make_static' failures, investigating what is the problem with the 'clean' target when it gets a O= passed...

[acme@felicio linux]$ git diff

tools/perf/tests/make +2 -1
index e74c86b00c31..baf8f0099507 100644
@@ -266,7 +266,8 @@ endif
 
 MAKEFLAGS := --no-print-directory
 
-clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+#clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
 
 $(run):
        $(call clean)

[acme@felicio linux]$

#9 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

Em Thu, Jan 14, 2016 at 01:02:02PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 26 lines

Em Thu, Jan 14, 2016 at 12:44:36PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 7 lines

If I try it manually, in the source tree:

[acme@felicio linux]$ cd tools/perf [acme@felicio perf]$ make LDFLAGS=-static

  BUILD:   Doing 'make -j4' parallel build
  GEN      libtraceevent-dynamic-list
  LINK     libperf-gtk.so
Quoted 8 lines

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbeginT.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libperf-gtk.so] Error 1
make: *** [all] Error 2
[acme@felicio perf]$

And if I do a make clean and try again, it works:

[acme@felicio linux]$ git log --oneline -5
be874d2f8baa perf build: Test correct path of perf in build-test dab97c905927 perf build: Pass O option to Makefile.perf in build-test 7d66631ea112 perf build: Set parallel making options build-test 69d5f8e92f05 perf symbols: Fix reading of build-id from vDSO 8bf78e69a277 perf kvm record/report: 'unprocessable sample' error while recording/reporting guest data
[acme@felicio linux]$

Quoted 4 lines

So, with that hunch, I tried with the patch below and it finishes a 'make -C tools/perf build-test' run with no find .cmd errors not 'make_static' failures, investigating what is the problem with the 'clean' target when it gets a O= passed...

So, this seems to do the trick, is it right?

tools/perf/tests/make +1 -1
index e74c86b00c31..29810cf2c117 100644
@@ -266,7 +266,7 @@ endif
 
 MAKEFLAGS := --no-print-directory
 
-clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) $(O_OPT) clean >/dev/null)
 
 $(run):
 	$(call clean)
Quoted 17 lines

[acme@felicio linux]$ git diff

tools/perf/tests/make +2 -1
index e74c86b00c31..baf8f0099507 100644
@@ -266,7 +266,8 @@ endif
 
 MAKEFLAGS := --no-print-directory
 
-clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+#clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_O) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
 
 $(run):
        $(call clean)

[acme@felicio linux]$

#10 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

In reply to Arnaldo Carvalho de Melo
Quoted 92 lines · Arnaldo Carvalho de Melo

Em Thu, Jan 14, 2016 at 11:08:11PM +0800, pi3orama escreveu:

Quoted 49 lines

发自我的 iPhone

Quoted 38 lines · 在 2016年1月14日,下午10:58,Arnaldo Carvalho de Melo <[email protected]> 写道:

Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 8 lines

Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:

Quoted 6 lines

If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f' will fail because perf resides in a different directory. Fix this by computing PERF_OUT according to 'O' and test correct output files. For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR instead because the path is different from others ($(O)/perf vs $(O)/tools/perf).

So, before this patch:

Also, while trying to get this to work, I found these places lacking the O= prefixing, right?

tools/perf/tests/make +0 -0
index e74c86b00c31..67842900482e 100644
@@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
 
 # standard single make variable specified

make_clean_all := clean all

tools/perf/tests/make +1 -1
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(PERF_O)/python/perf.so
make_debug          := DEBUG=1
make_no_libperl     := NO_LIBPERL=1
make_no_libpython   := NO_LIBPYTHON=1
tools/perf/tests/make +0 -0
@@ -82,9 +82,9 @@ make_tags           := tags
make_cscope         := cscope
make_help           := help
make_doc            := doc
tools/perf/tests/make +3 -3
-make_perf_o           := perf.o
-make_util_map_o       := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
+make_perf_o           := $(PERF_O)/perf.o
+make_util_map_o       := $(PERF_O)/util/map.o
+make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
Quoted 3 lines
make_install        := install
make_install_bin    := install-bin
make_install_doc    := install-doc

I have throughly tested this patch set, both with and without O, many times, and see no error related to this part of code, so I think we don't really need this prefix.

Quoted 2 lines

But maybe there's error I never noticed. Let me check it tomorrow.

Ok, but are you testing it patch after patch or just after all the patches in this series are applied?

Here, with up to:

I am getting 'make clean' related errors after some tests on a RHEL7.1 test machine:

- make_no_libunwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.CKrCzt1X85 NO_LIBUNWIND=1
find: ‘/home/acme/git/linux/tools/perf/tests/dso-data.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/.dso-data.o.cmd’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/pmu.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/sw-clock.o’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/.sample-parsing.o.cmd’: No such file or directory
find: ‘/home/acme/git/linux/tools/perf/tests/attr.o’: No such file or directory
- make_help: cd . && make -f Makefile DESTDIR=/tmp/tmp.9Gcw1OfooR help
- make_no_slang: cd . && make -f Makefile DESTDIR=/tmp/tmp.Ce5PSg2snH NO_SLANG=1

And 'build-test' fails when it tries to run the 'make_static' target and that is not the first one to be run:

- make_no_libelf: cd . && make -f Makefile DESTDIR=/tmp/tmp.tEwrxaQPOB NO_LIBELF=1
- make_no_libdw_dwarf_unwind: cd . && make -f Makefile DESTDIR=/tmp/tmp.4r7zlxeeAA NO_LIBDW_DWARF_UNWIND=1
- make_no_libnuma: cd . && make -f Makefile DESTDIR=/tmp/tmp.XuaZ3SACwX NO_LIBNUMA=1
- make_perf_o: cd . && make -f Makefile DESTDIR=/tmp/tmp.LXh3STdaiO perf.o
- make_static: cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
cd . && make -f Makefile DESTDIR=/tmp/tmp.xii2W5SLf2 LDFLAGS=-static
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:

...                         dwarf: [ on  ]
...                         glibc: [ on  ]
...                          gtk2: [ on  ]
...                      libaudit: [ on  ]
...                        libbfd: [ on  ]
...                        libelf: [ on  ]
...                       libnuma: [ on  ]
...        numa_num_possible_cpus: [ on  ]
...                       libperl: [ on  ]
Quoted 8 lines
...                     libpython: [ on  ]
...                      libslang: [ on  ]
...                     libunwind: [ on  ]
...            libdw-dwarf-unwind: [ on  ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ on  ]
...                           bpf: [ on  ]

Look at this feature detection result.

Quoted 10 lines

Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]

Quoted 8 lines

... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]

And this one.

They are different.

I reproduced this error in my environment. The reason is: if we use 'make clean O=something', the 'bin' files created by feature testing won't be removed. Not related to my work. Here I give an example:

tools/perf> make clean
tools/perf> make
BUILD: Doing 'make -j24' parallel build

Auto-detecting system features:

...                         dwarf: [ on  ]
...                         glibc: [ on  ]

... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]

...            libdw-dwarf-unwind: [ on  ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ on  ]
...                           bpf: [ on  ]

<SNIP>
tools/perf> make clean O=.
tools/perf> make LDFLAGS='-static'
BUILD: Doing 'make -j24' parallel build

Auto-detecting system features:

...                         dwarf: [ on  ]
...                         glibc: [ on  ]

... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]

...            libdw-dwarf-unwind: [ on  ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ on  ]
...                           bpf: [ on  ]

config/Makefile:342: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:401: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:416: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:430: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:562: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
config/Makefile:604: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
...
/home/w00229757/kernel-hydrogen/tools/lib/traceevent/libtraceevent.a(libtraceevent-in.o): In function `load_plugin':
/home/w00229757/kernel-hydrogen/tools/lib/traceevent/event-plugin.c:304: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld: cannot find -llzma /tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld: cannot find -lperl
libperf.a(libperf-in.o): In function `target__parse_uid':
/home/w00229757/kernel-hydrogen/tools/perf/util/target.c:79: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/w00229757/kernel-hydrogen/tools/perf/util/target.c:91: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /tmp/oxygen_root-w00229757/usr/bin/../lib64/gcc/x86_64-oe-linux/4.8.1/../../../../x86_64-oe-linux/bin/ld: cannot find -llzma
collect2: error: ld returned 1 exit status
...

Result of feature testing is similar.

tools/perf> make clean
tools/perf> make LDFLAGS='-static'
BUILD: Doing 'make -j24' parallel build

Auto-detecting system features:
... dwarf: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ on ]
... lzma: [ OFF ]
... get_cpuid: [ on ]
... bpf: [ on ]
...

Good result.

Look at [1]. Here's a similar problem I reported to Jiri.

Concultion: the reason of the problem you met is because 'make clean O=.' doesn't clean feature test results. In v1 I have:

-clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_OUT) clean >/dev/null; make -s -f $(MK) clean >/dev/null)

(two 'make clean' here for safety)

But removes them in v2. The second 'make clean' would remove any feature testing results and return good testing result for you. This also explain why I never met failure like this: if patch 4 - 9 are applied, make static would use feature dump.

Let me see how to remove feature testing results.

[1] http://lkml.kernel.org/g/[email protected]

#11 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

Quoted 2 lines · Wangnan (F)

[SNIP]

Quoted 8 lines

Concultion: the reason of the problem you met is because 'make clean O=.' doesn't clean feature test results. In v1 I have:

(quoted diff) +1 -1
-clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
+clean := @(cd $(PERF); make -s -f $(MK) O=$(PERF_OUT) clean 
Quoted 1 line

/dev/null; make -s -f $(MK) clean >/dev/null)

Quoted 7 lines

(two 'make clean' here for safety)

But removes them in v2. The second 'make clean' would remove any feature testing results and return good testing result for you. This also explain why I never met failure like this: if patch 4 - 9 are applied, make static would use feature dump.

Let me see how to remove feature testing results.

Here:

config-clean:

        $(call QUIET_CLEAN, config)
        $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if 

$(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null

If we build with 'O', feature test directory would reside in $(OUTPUT)/feature. Then when we 'make clean', the resuling .bin files are removed from $(OUTPUT)/feature. However, if we build without 'O' but clean with 'O=.', make clean tries to remove ./feature, but should be ../build/feature.

Thank you.

#12 lore raw

Re: [PATCH v2 3/9] perf build: Test correct path of perf in build-test

In reply to Arnaldo Carvalho de Melo
Quoted 29 lines · Arnaldo Carvalho de Melo

Em Thu, Jan 14, 2016 at 11:50:21AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 8 lines

Em Thu, Jan 14, 2016 at 01:13:57PM +0000, Wang Nan escreveu:

Quoted 6 lines

If an 'O' is passed to 'make build-test', many 'test -x' and 'test -f' will fail because perf resides in a different directory. Fix this by computing PERF_OUT according to 'O' and test correct output files. For make_kernelsrc and make_kernelsrc_tools, set KBUILD_OUTPUT_DIR instead because the path is different from others ($(O)/perf vs
$(O)/tools/perf).

So, before this patch:

Also, while trying to get this to work, I found these places lacking the O= prefixing, right?

tools/perf/tests/make +1 -1
index e74c86b00c31..67842900482e 100644
@@ -59,7 +59,7 @@ has = $(shell which $1 2>/dev/null)
 
  # standard single make variable specified
  make_clean_all      := clean all
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(PERF_O)/python/perf.so
  make_debug          := DEBUG=1
  make_no_libperl     := NO_LIBPERL=1
  make_no_libpython   := NO_LIBPYTHON=1
@@ -82,9 +82,9 @@ make_tags           := tags
  make_cscope         := cscope
  make_help           := help

tools/perf/tests/make make_tags := tags · line 90

Quoted 10 lines
tools/perf/tests/make +3 -3
  make_doc            := doc
-make_perf_o           := perf.o
-make_util_map_o       := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
+make_perf_o           := $(PERF_O)/perf.o
+make_util_map_o       := $(PERF_O)/util/map.o
+make_util_pmu_bison_o := $(PERF_O)/util/pmu-bison.o
  make_install        := install
  make_install_bin    := install-bin
  make_install_doc    := install-doc

Rechecked. As a make target we don't need this prefix:

Don't allow writing at every directories:

$ find -type d -exec  chmod 555 {} \;
$ touch ddd
touch: cannot touch ‘ddd’: Permission denied
$ make -C perf python/perf.so
make: Entering directory `/home/wangnan/kernel-hydrogen/tools/perf'
  BUILD:   Doing 'make -j24' parallel build
/bin/sh: .config-detected: Permission denied
...
config/Makefile:261: *** No gnu/libc-version.h found, please install glibc-dev[el].  Stop.
make: *** [python/perf.so] Error 2
make: Leaving directory `/home/wangnan/kernel-hydrogen/tools/perf'

Then use python/perf.so as make target:

$ make -C perf python/perf.so O=/tmp/xxxxx
make: Entering directory `/home/w00229757/kernel-hydrogen/tools/perf'
  BUILD:   Doing 'make -j24' parallel build

Auto-detecting system features:

...                         dwarf: [ on  ]
...                         glibc: [ on  ]

... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ OFF ]
... libunwind: [ OFF ]

...            libdw-dwarf-unwind: [ on  ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ on  ]
...                           bpf: [ on  ]

...

  LD       /tmp/xxxxx/fd/libapi-in.o
  GEN      /tmp/xxxxx/libtraceevent-dynamic-list
  LD       /tmp/xxxxx/fs/libapi-in.o
  LD       /tmp/xxxxx/libapi-in.o
  AR       /tmp/xxxxx/libapi.a
  LD       /tmp/xxxxx/libtraceevent-in.o
  LINK     /tmp/xxxxx/libtraceevent.a
  GEN      /tmp/xxxxx/python/perf.so

make: Leaving directory `/home/wangnan/kernel-hydrogen/tools/perf'

Adding the prefix also works it.

author
#13 lore raw

PATCH v2 4/9 perf build: Pass O option to kernel makefile in build-test

In reply to Wang Nan

Kernel makefile only follow 'O' option passed from command line explicitely. In build-test with 'O' option set, kernel makefile contaminate kernel source directory. Build test also fail if we don't create output directory manually.

K_O_OPT is added and passed to kernel makefile if 'O' is passed to build-test.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/tests/make | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/perf/tests/make +5 -4
index e74c86b..f8d3162 100644
@@ -22,6 +22,7 @@ ifneq ($(O),)
   ifeq ($(SET_O),1)
     O_OPT := 'O=$(FULL_O)'
   endif
+  K_O_OPT := 'O=$(FULL_O)'
 endif
 
 PARALLEL_OPT=
@@ -301,15 +302,15 @@ ifneq ($(O),)
 endif
 
 make_kernelsrc:
-	@echo "- make -C <kernelsrc> $(PARALLEL_OPT) tools/perf"
+	@echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf"
 	$(call clean); \
-	(make -C ../.. $(PARALLEL_OPT) tools/perf) > $@ 2>&1 && \
+	(make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \
 	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
 make_kernelsrc_tools:
-	@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) perf"
+	@echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf"
 	$(call clean); \
-	(make -C ../../tools $(PARALLEL_OPT) perf) > $@ 2>&1 && \
+	(make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
 	test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
 
 all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
Signature · 1 line
1.8.3.4
author
#14 lore raw

PATCH v2 5/9 perf build: Add feature-dump target

In reply to Wang Nan

From: Jiri Olsa <[email protected]>

To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
if defined, with no further action.

Get feature dump of the current build:

  $ make feature-dump
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]

FEATURE-DUMP file available in FEATURE-DUMP

Get feature dump static build into /tmp/fd file:

  $ make feature-dump FEATURE_DUMP_COPY=/tmp/fd LDFLAGS=-static
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ OFF ]

SNIP

FEATURE-DUMP file copied into /tmp/fd

---
 tools/perf/Makefile.perf | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/perf/Makefile.perf +11 -0
index 0a22407..f758a72 100644
@@ -611,6 +611,17 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean
 	$(python-clean)
 
 #
+# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
+# file if defined, with no further action.
+feature-dump:
+ifdef FEATURE_DUMP_COPY
+	@cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY)
+	@echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)"
+else
+	@echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP"
+endif
+
+#
 # Trick: if ../../.git does not exist - we are building out of tree for example,
 # then force version regeneration:
 #
Signature · 1 line
1.8.3.4
author
#15 lore raw

PATCH v2 6/9 perf build: Introduce FEATURES_DUMP make variable

In reply to Wang Nan

From: Jiri Olsa <[email protected]>

Introducing FEATURES_DUMP make variable to provide features detection dump file and bypass the feature detection.

The intention is to use this during build tests to skip repeated features detection, like:

Get feature dump static build into /tmp/fd file:

  $ make feature-dump FEATURE_DUMP_COPY=/tmp/fd LDFLAGS=-static
    BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ OFF ]

SNIP

FEATURE-DUMP file copied into /tmp/fd

Use /tmp/fd to build perf:

  $ make FEATURES_DUMP=/tmp/fd LDFLAGS=-static
  $ file perf
  perf: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for ...
---
 tools/perf/Makefile.perf   | 14 +++++++++++++-
 tools/perf/config/Makefile |  4 ++++
 2 files changed, 17 insertions(+), 1 deletion(-)
tools/perf/Makefile.perf +13 -1
index f758a72..5d34815 100644
@@ -77,6 +77,9 @@ include config/utilities.mak
 # Define NO_AUXTRACE if you do not want AUX area tracing support
 #
 # Define NO_LIBBPF if you do not want BPF support
+#
+# Define FEATURES_DUMP to provide features detection dump file
+# and bypass the feature detection
 
 # As per kernel Makefile, avoid funny character set dependencies
 unexport LC_ALL
@@ -166,6 +169,15 @@ ifeq ($(config),1)
 include config/Makefile
 endif
 
+# The FEATURE_DUMP_EXPORT holds location of the actual
+# FEATURE_DUMP file to be used to bypass feature detection
+# (for bpf or any other subproject)
+ifeq ($(FEATURES_DUMP),)
+FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
+else
+FEATURE_DUMP_EXPORT := $(FEATURES_DUMP)
+endif
+
 export prefix bindir sharedir sysconfdir DESTDIR
 
 # sparse is architecture-neutral, which means that we need to tell it
@@ -436,7 +448,7 @@ $(LIBAPI)-clean:
 	$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 
 $(LIBBPF): fixdep FORCE
-	$(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(realpath $(OUTPUT)FEATURE-DUMP)
+	$(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
 
 $(LIBBPF)-clean:
 	$(call QUIET_CLEAN, libbpf)
tools/perf/config/Makefile +4 -0
index e5959c1..511141b 100644
@@ -181,7 +181,11 @@ LDFLAGS += -Wl,-z,noexecstack
 
 EXTLIBS = -lpthread -lrt -lm -ldl
 
+ifeq ($(FEATURES_DUMP),)
 include $(srctree)/tools/build/Makefile.feature
+else
+include $(FEATURES_DUMP)
+endif
 
 ifeq ($(feature-stackprotector-all), 1)
   CFLAGS += -fstack-protector-all
Signature · 1 line
1.8.3.4
author
#16 lore raw

PATCH v2 7/9 tools build: Allow subprojects select all feature checkers

In reply to Wang Nan

Put feature checkers not in original FEATURE_TESTS to a new list and allow subproject select all feature checkers by setting FEATURE_TESTS to 'all'.

Cc Jiri Olsa <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/build/Makefile.feature | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
tools/build/Makefile.feature +20 -1
index 02db3cd..674c47d 100644
@@ -27,7 +27,7 @@ endef
 #   the rule that uses them - an example for that is the 'bionic'
 #   feature check. ]
 #
-FEATURE_TESTS ?=			\
+FEATURE_TESTS_BASIC :=			\
 	backtrace			\
 	dwarf				\
 	fortify-source			\
@@ -56,6 +56,25 @@ FEATURE_TESTS ?=			\
 	get_cpuid			\
 	bpf
 
+# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
+# of all feature tests
+FEATURE_TESTS_EXTRA :=			\
+	bionic				\
+	compile-32			\
+	compile-x32			\
+	cplus-demangle			\
+	hello				\
+	libbabeltrace			\
+	liberty				\
+	liberty-z			\
+	libunwind-debug-frame
+
+FEATURE_TESTS ?= $(FEATURE_TESTS_BASIC)
+
+ifeq ($(FEATURE_TESTS),all)
+  FEATURE_TESTS := $(FEATURE_TESTS_BASIC) $(FEATURE_TESTS_EXTRA)
+endif
+
 FEATURE_DISPLAY ?=			\
 	dwarf				\
 	glibc				\
Signature · 1 line
1.8.3.4
author
#17 lore raw

PATCH v2 8/9 perf build: Select all feature checkers for feature-dump

In reply to Wang Nan

Set FEATURE_TESTS to 'all' so all possible feature checkers are executed. Without this setting the output feature dump file miss some feature, for example, liberity. Select all checker so we won't get an incomplete feature dump file.

Cc Jiri Olsa <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/Makefile.perf | 9 +++++++++
 1 file changed, 9 insertions(+)
tools/perf/Makefile.perf +9 -0
index 5d34815..283775b 100644
@@ -165,7 +165,16 @@ ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
 endif
 endif
 
+# Set FEATURE_TESTS to 'all' so all possible feature checkers are
+# executed. Without this setting the output feature dump file miss
+# some feature, for example, liberity. Select all checker so we won't
+# get an incomplete feature dump file.
 ifeq ($(config),1)
+ifdef MAKECMDGOALS
+ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump)
+FEATURE_TESTS := all
+endif
+endif
 include config/Makefile
 endif
 
Signature · 1 line
1.8.3.4
author
#18 lore raw

PATCH v2 9/9 perf build: Use feature dump file for build-test

In reply to Wang Nan

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.

Cc Jiri Olsa <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/tests/make | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
tools/perf/tests/make +31 -0
index f8d3162..012b84b 100644
@@ -15,6 +15,7 @@ else
 PERF := .
 PERF_O := $(PERF)
 O_OPT :=
+FULL_O := $(shell readlink -f $(PERF_OUT) || echo $(PERF_OUT))
 
 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
Signature · 1 line
1.8.3.4