Skip to contentSkip to conversation

tools: perf: Fix test build error when bindir contains double slash

PATCH Applied Pawel Moll 4 participants 4 messages Jul 28, 2015 – Jul 31, 2015 perf events

lore
Share & tools
lore

Pawel Moll

author
#0 lore raw

PATCH v2 1/1 tools: perf: Fix test build error when bindir contains double slash

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 abspath function.

---
 tools/perf/config/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/config/Makefile +1 -1
index b4a9c29..e8d987a 100644
@@ -638,7 +638,7 @@ ifndef DESTDIR
 prefix ?= $(HOME)
 endif
 bindir_relative = bin
-bindir = $(prefix)/$(bindir_relative)
+bindir = $(abspath $(prefix)/$(bindir_relative))
 mandir = share/man
 infodir = share/info
 perfexecdir = libexec/perf-core
Signature · 1 line
2.1.4
Acked-by on v2 1/1
#1 lore raw
Quoted 24 lines · 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
Quoted 2 lines

This patch works around the problem by "cleaning" the bindir string using make's abspath function.

nice ;-)

thanks,
jirka

maintainer Applied
#2 lore raw

Em Tue, Jul 28, 2015 at 04:46:00PM +0200, Jiri Olsa escreveu:

Quoted 9 lines · Pawel Moll
Quoted 4 lines

When building with a prefix ending with a slash, for example:

This patch works around the problem by "cleaning" the bindir string using make's abspath function.

nice ;-)

Applied.

- Arnaldo

#3 lore raw

[tip:perf/core] perf tools: Fix test build error when bindir contains double slash

In reply to Pawel Moll
perf tools: Fix test build error when bindir contains double slash
Commit-ID:  0927beeca5f9d1a7978f8da9c9d28647859816d3
Gitweb:     http://git.kernel.org/tip/0927beeca5f9d1a7978f8da9c9d28647859816d3
Author:     Pawel Moll <[email protected]>
AuthorDate: Tue, 28 Jul 2015 15:10:13 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 28 Jul 2015 13:03:49 -0300

perf tools: Fix test build error when bindir contains double slash

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 abspath function.

---
 tools/perf/config/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/config/Makefile +1 -1
index 094ddae..d31fac1 100644
@@ -638,7 +638,7 @@ ifndef DESTDIR
 prefix ?= $(HOME)
 endif
 bindir_relative = bin
-bindir = $(prefix)/$(bindir_relative)
+bindir = $(abspath $(prefix)/$(bindir_relative))
 mandir = share/man
 infodir = share/info
 perfexecdir = libexec/perf-core