perf test: Check python path on attr test
Namhyung Kim
maintainerPATCH 1/1 perf test: Check python path on attr test
From: Namhyung Kim <[email protected]>
Current perf test code tries to execute python version 2 in order to test attributes on perf_event_open syscall. However it's not default python version anymore a system can have python v3 only or v2 with a different name (e.g. python2). So if there's no such python interpreter with the name 'python', the test would fail like this (yes, it's happened on my new archlinux laptop :).
13: struct perf_event_attr setup :sh: python: command not found
FAILED!
As we can pass name of the python interpreter on make, use it for the attr test also.
--- tools/perf/Makefile | 2 +- tools/perf/tests/attr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +1 -1
@@ -952,7 +952,7 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS $(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ - '-DBINDIR="$(bindir_SQ)"' \ + '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \ $< $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
tools/perf/tests/attr.c +1 -1
@@ -146,7 +146,7 @@ static int run_dir(const char *d, const char *perf) {char cmd[3 *PATH_MAX ]; -snprintf (cmd,3 *PATH_MAX ,"python %s/attr.py -d %s/attr/ -p %s %s" , +snprintf (cmd,3 *PATH_MAX ,PYTHON " %s/attr.py -d %s/attr/ -p %s %s" , d, d, perf, verbose ?"-v" :"" );return system (cmd);
Signature · 1 line
1.7.11.7
Quoted 9 lines · Namhyung Kim
From: Namhyung Kim <[email protected]>
Current perf test code tries to execute python version 2 in order to test attributes on
perf_event_opensyscall. However it's not default python version anymore a system can have python v3 only or v2 with a different name (e.g. python2). So if there's no such python interpreter with the name 'python', the test would fail like this (yes, it's happened on my new archlinux laptop :).
Quoted 8 lines
13: struct
perf_event_attrsetup :sh: python: command not found
FAILED!As we can pass name of the python interpreter on make, use it for the attr test also.
Cc Jiri Olsa <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
jirka
[tip:perf/core] perf tests: Check python path on attr and binding test
In reply to Namhyung KimCommit-ID: 000ae33fdb5ff7bc7ae985b43e6278024a4985c2 Gitweb: http://git.kernel.org/tip/000ae33fdb5ff7bc7ae985b43e6278024a4985c2 Author: Namhyung Kim <[email protected]> AuthorDate: Mon, 17 Dec 2012 16:25:01 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 24 Jan 2013 16:40:10 -0300
perf tests: Check python path on attr and binding test
Current perf test code tries to execute python version 2 in order to test attributes on perf_event_open syscall. However it's not default python version anymore a system can have python v3 only or v2 with a different name (e.g. python2). So if there's no such python interpreter with the name 'python', the test would fail like this (yes, it's happened on my new archlinux laptop :).
13: struct perf_event_attr setup :sh: python: command not found
FAILED!
As we can pass name of the python interpreter on make, use it for the attr test also.
--- tools/perf/Makefile | 7 +++++-- tools/perf/tests/attr.c | 2 +- tools/perf/tests/python-use.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-)
tools/perf/Makefile +5 -2
@@ -953,11 +953,14 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS $(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ - '-DBINDIR="$(bindir_SQ)"' \ + '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \ $< $(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPYTHONPATH='"$(OUTPUT)/python"' $< + $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ + -DPYTHONPATH='"$(OUTPUT)/python"' \ + -DPYTHON='"$(PYTHON_WORD)"' \ + $< $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
tools/perf/tests/attr.c +1 -1
@@ -144,7 +144,7 @@ static int run_dir(const char *d, const char *perf) {char cmd[3 *PATH_MAX ]; -snprintf (cmd,3 *PATH_MAX ,"python %s/attr.py -d %s/attr/ -p %s %s" , +snprintf (cmd,3 *PATH_MAX ,PYTHON " %s/attr.py -d %s/attr/ -p %s %s" , d, d, perf, verbose ?"-v" :"" );return system (cmd);
tools/perf/tests/python-use.c +2 -2
@@ -13,8 +13,8 @@ int test__python_use(void)char *cmd;int ret; -if (asprintf (&cmd,"echo \"import sys ; sys.path.append('%s'); import perf\" | python %s" , -PYTHONPATH , verbose ?"" :"2> /dev/null" ) <0 ) +if (asprintf (&cmd,"echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s" , +PYTHONPATH ,PYTHON , verbose ?"" :"2> /dev/null" ) <0 )return -1 ; ret =system (cmd) ?-1 :0 ;