Skip to contentSkip to conversation

perf tool: Build fixes

PATCH New Jiri Olsa 2 participants 7 messages Jun 22, 2015 – Jun 25, 2015 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

cover perf tool: Build fixes

hi,
sending some build fixes.

Also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/make_test

thanks,
jirka
---
Jiri Olsa (3):
perf tests: Add testing for Makefile.perf perf tests: Add test for make install with prefix perf build: Fix single target build dependency check

 tools/perf/Makefile   |  4 ++--
 tools/perf/tests/make | 31 ++++++++++++++++++++++++++++---
 2 files changed, 30 insertions(+), 5 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/

author reviewer
#1 lore raw

PATCH 1/3 perf tests: Add testing for Makefile.perf

Currently we test only builds through top level Makefile, but seems like there's a bunch of users using Makefile.perf directly.

Changing the make suite to be run for Makefile.perf as well. It takes now considerable amount of time, but hopefully we catch more issues.

Also fixing the output indentation for make_kernelsrc and make_kernelsrc_tools tests.

---
 tools/perf/tests/make | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
tools/perf/tests/make +20 -3
index 65280d28662e..bfe1962da0df 100644
@@ -1,5 +1,16 @@
+ifndef MK
+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
+else
+# run only specific test over 'Makefile'
+%:
+	@echo "Testing Makefile";      $(MAKE) -sf tests/make MK=Makefile $@
+endif
+else
 PERF := .
-MK   := Makefile
 
 include config/Makefile.arch
 
@@ -57,7 +68,12 @@ make_minimal        += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1
 
 # $(run) contains all available tests
 run := make_pure
+# Targets 'clean all' can be run together only through top level
+# Makefile because we detect clean target in Makefile.perf and
+# disable features detection
+ifeq ($(MK),Makefile)
 run += make_clean_all
+endif
 run += make_python_perf_so
 run += make_debug
 run += make_no_libperl
@@ -226,13 +242,13 @@ tarpkg:
 	( eval $$cmd ) >> $@ 2>&1
 
 make_kernelsrc:
-	@echo " - make -C <kernelsrc> tools/perf"
+	@echo "- make -C <kernelsrc> tools/perf"
 	$(call clean); \
 	(make -C ../.. 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 perf"
 	$(call clean); \
 	(make -C ../../tools perf) > $@ 2>&1 && \
 	test -x perf && rm -f $@ || (cat $@ ; false)
@@ -244,3 +260,4 @@ out: $(run_O)
 	@echo OK
 
 .PHONY: all $(run) $(run_O) tarpkg clean
+endif # ifndef MK
Signature · 5 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/
#2 lore raw

[tip:perf/core] perf tests: Add testing for Makefile.perf

perf tests: Add testing for Makefile.perf
Commit-ID:  502819c5f35ef44eb7151fb85cd883c5b76b506d
Gitweb:     http://git.kernel.org/tip/502819c5f35ef44eb7151fb85cd883c5b76b506d
Author:     Jiri Olsa <[email protected]>
AuthorDate: Mon, 22 Jun 2015 14:50:50 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 22 Jun 2015 11:21:57 -0300

perf tests: Add testing for Makefile.perf

Currently we test only builds through top level Makefile, but seems like there's a bunch of users using Makefile.perf directly.

Changing the make suite to be run for Makefile.perf as well. It takes now considerable amount of time, but hopefully we catch more issues.

Also fixing the output indentation for make_kernelsrc and make_kernelsrc_tools tests.

---
 tools/perf/tests/make | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
tools/perf/tests/make +20 -3
index 65280d2..bfe1962da 100644
@@ -1,5 +1,16 @@
+ifndef MK
+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
+else
+# run only specific test over 'Makefile'
+%:
+	@echo "Testing Makefile";      $(MAKE) -sf tests/make MK=Makefile $@
+endif
+else
 PERF := .
-MK   := Makefile
 
 include config/Makefile.arch
 
@@ -57,7 +68,12 @@ make_minimal        += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1
 
 # $(run) contains all available tests
 run := make_pure
+# Targets 'clean all' can be run together only through top level
+# Makefile because we detect clean target in Makefile.perf and
+# disable features detection
+ifeq ($(MK),Makefile)
 run += make_clean_all
+endif
 run += make_python_perf_so
 run += make_debug
 run += make_no_libperl
@@ -226,13 +242,13 @@ tarpkg:
 	( eval $$cmd ) >> $@ 2>&1
 
 make_kernelsrc:
-	@echo " - make -C <kernelsrc> tools/perf"
+	@echo "- make -C <kernelsrc> tools/perf"
 	$(call clean); \
 	(make -C ../.. 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 perf"
 	$(call clean); \
 	(make -C ../../tools perf) > $@ 2>&1 && \
 	test -x perf && rm -f $@ || (cat $@ ; false)
@@ -244,3 +260,4 @@ out: $(run_O)
 	@echo OK
 
 .PHONY: all $(run) $(run_O) tarpkg clean
+endif # ifndef MK
author reviewer
#3 lore raw

PATCH 2/3 perf tests: Add test for make install with prefix

In reply to Jiri Olsa

Lukas Wunner reported issue (and fix) with 'make install prefix=...'. Adding automated test for this, so it wouldn't happen again.

---
 tools/perf/tests/make | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/perf/tests/make +8 -0
index bfe1962da0df..729112f4cfaa 100644
@@ -58,6 +58,7 @@ make_install_man    := install-man
 make_install_html   := install-html
 make_install_info   := install-info
 make_install_pdf    := install-pdf
+make_install_prefix := install prefix=/tmp/krava
 make_static         := LDFLAGS=-static
 
 # all the NO_* variable combined
@@ -99,6 +100,7 @@ run += make_util_map_o
 run += make_util_pmu_bison_o
 run += make_install
 run += make_install_bin
+run += make_install_prefix
 # FIXME 'install-*' commented out till they're fixed
 # run += make_install_doc
 # run += make_install_man
@@ -173,6 +175,12 @@ test_make_install_O     := $(call test_dest_files,$(installed_files_all))
 test_make_install_bin   := $(call test_dest_files,$(installed_files_bin))
 test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin))
 
+# We prefix all installed files for make_install_prefix
+# with '/tmp/krava' to match installed/prefix-ed files.
+installed_files_all_prefix := $(addprefix /tmp/krava/,$(installed_files_all))
+test_make_install_prefix   := $(call test_dest_files,$(installed_files_all_prefix))
+test_make_install_prefix_O := $(call test_dest_files,$(installed_files_all_prefix))
+
 # FIXME nothing gets installed
 test_make_install_man    := test -f $$TMP_DEST/share/man/man1/perf.1
 test_make_install_man_O  := $(test_make_install_man)
Signature · 5 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/
#4 lore raw

[tip:perf/core] perf tests: Add test for make install with prefix

perf tests: Add test for make install with prefix
Commit-ID:  eb30d2c5077b30f9f8e00eb2e5fadba18b148538
Gitweb:     http://git.kernel.org/tip/eb30d2c5077b30f9f8e00eb2e5fadba18b148538
Author:     Jiri Olsa <[email protected]>
AuthorDate: Mon, 22 Jun 2015 14:50:51 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 22 Jun 2015 11:24:05 -0300

perf tests: Add test for make install with prefix

Lukas Wunner reported issue (and fix[1]) with 'make install prefix=...'. Adding automated test for this, so it wouldn't happen again.

[1]: 75e84ab906ef ("perf tools: Fix build breakage if prefix= is specified")

---
 tools/perf/tests/make | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/perf/tests/make +8 -0
index bfe1962da..729112f 100644
@@ -58,6 +58,7 @@ make_install_man    := install-man
 make_install_html   := install-html
 make_install_info   := install-info
 make_install_pdf    := install-pdf
+make_install_prefix := install prefix=/tmp/krava
 make_static         := LDFLAGS=-static
 
 # all the NO_* variable combined
@@ -99,6 +100,7 @@ run += make_util_map_o
 run += make_util_pmu_bison_o
 run += make_install
 run += make_install_bin
+run += make_install_prefix
 # FIXME 'install-*' commented out till they're fixed
 # run += make_install_doc
 # run += make_install_man
@@ -173,6 +175,12 @@ test_make_install_O     := $(call test_dest_files,$(installed_files_all))
 test_make_install_bin   := $(call test_dest_files,$(installed_files_bin))
 test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin))
 
+# We prefix all installed files for make_install_prefix
+# with '/tmp/krava' to match installed/prefix-ed files.
+installed_files_all_prefix := $(addprefix /tmp/krava/,$(installed_files_all))
+test_make_install_prefix   := $(call test_dest_files,$(installed_files_all_prefix))
+test_make_install_prefix_O := $(call test_dest_files,$(installed_files_all_prefix))
+
 # FIXME nothing gets installed
 test_make_install_man    := test -f $$TMP_DEST/share/man/man1/perf.1
 test_make_install_man_O  := $(test_make_install_man)
author reviewer
#5 lore raw

PATCH 3/3 perf build: Fix single target build dependency check

In reply to Jiri Olsa

Currently if we build single target like:

  $ touch util/map.c && make util/map.o

It will not rebuild util/map.o if it already exists and util/map.c is modified.

The reason is that the top-level 'Makefile' processes util/map.o as an implicit rule and if util/map.o exists make considers the 'util/map.o' target as done and wouldn't nest into Makefile.perf.

Adding FORCE for '%', because that's what we want to nest into Makefile.perf for any target.

Adding Makefile into phony targets, because make tries to rebuilt it and it's also resolved as '%' target.

---
 tools/perf/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +2 -2
index d31a7bbd7cee..480546d5f13b 100644
@@ -83,8 +83,8 @@ build-test:
 #
 # All other targets get passed through:
 #
-%:
+%: FORCE
 	$(print_msg)
 	$(make)
 
-.PHONY: tags TAGS
+.PHONY: tags TAGS FORCE Makefile
Signature · 5 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/
#6 lore raw

[tip:perf/core] perf build: Fix single target build dependency check

perf build: Fix single target build dependency check
Commit-ID:  8e55735150934f9ab2ce8a8005626e5693a6b61d
Gitweb:     http://git.kernel.org/tip/8e55735150934f9ab2ce8a8005626e5693a6b61d
Author:     Jiri Olsa <[email protected]>
AuthorDate: Mon, 22 Jun 2015 14:50:52 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 22 Jun 2015 11:27:09 -0300

perf build: Fix single target build dependency check

Currently if we build a single target like:

  $ touch util/map.c && make util/map.o

It will not rebuild util/map.o if it already exists and util/map.c is modified.

The reason is that the top-level 'Makefile' processes util/map.o as an implicit rule and if util/map.o exists make considers the 'util/map.o' target as done and will not nest into Makefile.perf.

Adding FORCE for '%', because that's what we want to nest into Makefile.perf for any target.

Adding Makefile into phony targets, because make tries to rebuild it and it's also resolved as '%' target.

---
 tools/perf/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +2 -2
index d31a7bb..480546d 100644
@@ -83,8 +83,8 @@ build-test:
 #
 # All other targets get passed through:
 #
-%:
+%: FORCE
 	$(print_msg)
 	$(make)
 
-.PHONY: tags TAGS
+.PHONY: tags TAGS FORCE Makefile