* [PATCH] tools: perf: Fix test build error when bindir contains double slash
@ 2015-07-27 16:46 Pawel Moll
2015-07-27 18:24 ` [PATCH] perf tests: Adding build test for having ending slash in " Jiri Olsa
0 siblings, 1 reply; 5+ messages in thread
From: Pawel Moll @ 2015-07-27 16:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Jiri Olsa,
Namhyung Kim, Adrian Hunter
Cc: linux-kernel, Pawel Moll
When building with a prefix ending with a slash, for example:
$ make prefix=/usr/local/
one of the perf tests fail to compile due to BUILD_STR macro mishandling
bindir_SQ string containing with two slashes:
-DBINDIR="BUILD_STR(/usr/local//bin)"
with the following error:
CC tests/attr.o
tests/attr.c: In function ‘test__attr’:
tests/attr.c:168:50: error: expected ‘)’ before ‘;’ token
snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
^
tests/attr.c:176:1: error: expected ‘;’ before ‘}’ token
}
^
tests/attr.c:176:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors
This patch works around the problem by "cleaning" the bindir string
using make's realpath function.
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
tools/perf/config/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index b4a9c29..59e8376 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -638,7 +638,7 @@ ifndef DESTDIR
prefix ?= $(HOME)
endif
bindir_relative = bin
-bindir = $(prefix)/$(bindir_relative)
+bindir = $(realpath $(prefix)/$(bindir_relative))
mandir = share/man
infodir = share/info
perfexecdir = libexec/perf-core
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] perf tests: Adding build test for having ending slash in double slash 2015-07-27 16:46 [PATCH] tools: perf: Fix test build error when bindir contains double slash Pawel Moll @ 2015-07-27 18:24 ` Jiri Olsa 2015-07-28 12:40 ` Pawel Moll 2015-07-31 13:55 ` [tip:perf/core] perf tests: Adding build test for having ending " tip-bot for Jiri Olsa 0 siblings, 2 replies; 5+ messages in thread From: Jiri Olsa @ 2015-07-27 18:24 UTC (permalink / raw) To: Pawel Moll Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Adrian Hunter, linux-kernel On Mon, Jul 27, 2015 at 05:46:33PM +0100, Pawel Moll wrote: > When building with a prefix ending with a slash, for example: > > $ make prefix=/usr/local/ > > one of the perf tests fail to compile due to BUILD_STR macro mishandling > bindir_SQ string containing with two slashes: hum, I can find this.. is it known issue with stringification? > > -DBINDIR="BUILD_STR(/usr/local//bin)" > > with the following error: > > CC tests/attr.o > tests/attr.c: In function ‘test__attr’: > tests/attr.c:168:50: error: expected ‘)’ before ‘;’ token > snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR); > ^ > tests/attr.c:176:1: error: expected ‘;’ before ‘}’ token > } > ^ > tests/attr.c:176:1: error: control reaches end of non-void function [-Werror=return-type] > } > ^ > cc1: all warnings being treated as errors > > This patch works around the problem by "cleaning" the bindir string > using make's realpath function. I'm getting install error with your patch: [jolsa@krava perf]$ rm -rf /tmp/krava/ && make install prefix=/tmp/krava SNIP LINK perf INSTALL binaries INSTALL tests install: cannot create directory ‘’: No such file or directory install: target ‘’ is not a directory: No such file or directory ln: failed to access ‘/perf’: No such file or directory Makefile.perf:492: recipe for target 'install-tools' failed make[1]: *** [install-tools] Error 1 make[1]: *** Waiting for unfinished jobs.... Makefile:87: recipe for target 'install' failed make: *** [install] Error 2 somethings wrong with install targets dealing with bindir_SQ anyway, attaching test case for your issue thanks, jirka --- Pawel Moll reported build issue for having extra slash (/) at the end of the prefix variable. $ make prefix=/usr/local/ CC tests/attr.o tests/attr.c: In function ‘test__attr’: tests/attr.c:168:50: error: expected ‘)’ before ‘;’ token snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR); ^ tests/attr.c:176:1: error: expected ‘;’ before ‘}’ token } ^ tests/attr.c:176:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1: all warnings being treated as errors Adding automated test case for this. Reported-by: Pawel Moll <pawel.moll@arm.com> Link: http://lkml.kernel.org/n/tip-uk97po64cp149se3ll28gqel@git.kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- tools/perf/tests/make | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 729112f4cfaa..ba31c4bd441d 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -58,7 +58,8 @@ 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_install_prefix := install prefix=/tmp/krava +make_install_prefix_slash := install prefix=/tmp/krava/ make_static := LDFLAGS=-static # all the NO_* variable combined @@ -101,6 +102,7 @@ run += make_util_pmu_bison_o run += make_install run += make_install_bin run += make_install_prefix +run += make_install_prefix_slash # FIXME 'install-*' commented out till they're fixed # run += make_install_doc # run += make_install_man @@ -175,11 +177,14 @@ 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 +# We prefix all installed files for make_install_prefix(_slash) # 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)) +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)) + +test_make_install_prefix_slash := $(test_make_install_prefix) +test_make_install_prefix_slash_O := $(test_make_install_prefix_O) # FIXME nothing gets installed test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1 -- 2.4.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] perf tests: Adding build test for having ending slash in double slash 2015-07-27 18:24 ` [PATCH] perf tests: Adding build test for having ending slash in " Jiri Olsa @ 2015-07-28 12:40 ` Pawel Moll 2015-07-28 13:44 ` Pawel Moll 2015-07-31 13:55 ` [tip:perf/core] perf tests: Adding build test for having ending " tip-bot for Jiri Olsa 1 sibling, 1 reply; 5+ messages in thread From: Pawel Moll @ 2015-07-28 12:40 UTC (permalink / raw) To: Jiri Olsa Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Adrian Hunter, linux-kernel@vger.kernel.org On Mon, 2015-07-27 at 19:24 +0100, Jiri Olsa wrote: > I'm getting install error with your patch: > > [jolsa@krava perf]$ rm -rf /tmp/krava/ && make install prefix=/tmp/krava > > SNIP > > LINK perf > INSTALL binaries > INSTALL tests > install: cannot create directory ‘’: No such file or directory > install: target ‘’ is not a directory: No such file or directory > ln: failed to access ‘/perf’: No such file or directory > Makefile.perf:492: recipe for target 'install-tools' failed > make[1]: *** [install-tools] Error 1 > make[1]: *** Waiting for unfinished jobs.... > Makefile:87: recipe for target 'install' failed > make: *** [install] Error 2 > > somethings wrong with install targets dealing with bindir_SQ Interesting. Building from a perf-tar-src-pkg tarball works: $ rm -rf /tmp/krava/ && make install prefix=/tmp/krava [...] LINK perf LINK libperf-gtk.so INSTALL GTK UI INSTALL binaries INSTALL tests INSTALL libexec INSTALL perf-archive INSTALL perf-with-kcore INSTALL perl-scripts INSTALL python-scripts INSTALL perf_completion-script but it breaks indeed the way you pointed out when building in-tree... Having a look now. Pawel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf tests: Adding build test for having ending slash in double slash 2015-07-28 12:40 ` Pawel Moll @ 2015-07-28 13:44 ` Pawel Moll 0 siblings, 0 replies; 5+ messages in thread From: Pawel Moll @ 2015-07-28 13:44 UTC (permalink / raw) To: Jiri Olsa Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Adrian Hunter, linux-kernel@vger.kernel.org On Tue, 2015-07-28 at 13:40 +0100, Pawel Moll wrote: > Interesting. Building from a perf-tar-src-pkg tarball works: > > $ rm -rf /tmp/krava/ && make install prefix=/tmp/krava > [...] > LINK perf > LINK libperf-gtk.so > INSTALL GTK UI > INSTALL binaries > INSTALL tests > INSTALL libexec > INSTALL perf-archive > INSTALL perf-with-kcore > INSTALL perl-scripts > INSTALL python-scripts > INSTALL perf_completion-script > > but it breaks indeed the way you pointed out when building in-tree... Ignore what I said above. The real issue is that $(realpath PATH) returns nothing if PATH does not actually exist. Didn't know that... Will send v2 soon. Pawel ^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:perf/core] perf tests: Adding build test for having ending double slash 2015-07-27 18:24 ` [PATCH] perf tests: Adding build test for having ending slash in " Jiri Olsa 2015-07-28 12:40 ` Pawel Moll @ 2015-07-31 13:55 ` tip-bot for Jiri Olsa 1 sibling, 0 replies; 5+ messages in thread From: tip-bot for Jiri Olsa @ 2015-07-31 13:55 UTC (permalink / raw) To: linux-tip-commits Cc: jolsa, acme, namhyung, adrian.hunter, hpa, mingo, tglx, jolsa, a.p.zijlstra, linux-kernel, pawel.moll Commit-ID: aa53c09e90a19c215549bd1ca970fddcb7c0c001 Gitweb: http://git.kernel.org/tip/aa53c09e90a19c215549bd1ca970fddcb7c0c001 Author: Jiri Olsa <jolsa@redhat.com> AuthorDate: Mon, 27 Jul 2015 20:24:17 +0200 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Thu, 30 Jul 2015 12:23:08 -0300 perf tests: Adding build test for having ending double slash Pawel Moll reported build issue for having extra slash (/) at the end of the prefix variable. $ make prefix=/usr/local/ CC tests/attr.o tests/attr.c: In function ‘test__attr’: tests/attr.c:168:50: error: expected ‘)’ before ‘;’ token snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR); ^ tests/attr.c:176:1: error: expected ‘;’ before ‘}’ token } ^ tests/attr.c:176:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1: all warnings being treated as errors Adding automated test case for this. Reported-by: Pawel Moll <pawel.moll@arm.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20150727182417.GD20509@krava.brq.redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/tests/make | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 729112f..ba31c4b 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -58,7 +58,8 @@ 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_install_prefix := install prefix=/tmp/krava +make_install_prefix_slash := install prefix=/tmp/krava/ make_static := LDFLAGS=-static # all the NO_* variable combined @@ -101,6 +102,7 @@ run += make_util_pmu_bison_o run += make_install run += make_install_bin run += make_install_prefix +run += make_install_prefix_slash # FIXME 'install-*' commented out till they're fixed # run += make_install_doc # run += make_install_man @@ -175,11 +177,14 @@ 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 +# We prefix all installed files for make_install_prefix(_slash) # 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)) +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)) + +test_make_install_prefix_slash := $(test_make_install_prefix) +test_make_install_prefix_slash_O := $(test_make_install_prefix_O) # FIXME nothing gets installed test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-31 13:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-07-27 16:46 [PATCH] tools: perf: Fix test build error when bindir contains double slash Pawel Moll 2015-07-27 18:24 ` [PATCH] perf tests: Adding build test for having ending slash in " Jiri Olsa 2015-07-28 12:40 ` Pawel Moll 2015-07-28 13:44 ` Pawel Moll 2015-07-31 13:55 ` [tip:perf/core] perf tests: Adding build test for having ending " tip-bot for Jiri Olsa
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.