All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test: Check python path on attr test
@ 2012-12-17  7:25 Namhyung Kim
  2012-12-17 13:44 ` Jiri Olsa
  2013-01-25 11:04 ` [tip:perf/core] perf tests: Check python path on attr and binding test tip-bot for Namhyung Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Namhyung Kim @ 2012-12-17  7:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, LKML, Namhyung Kim,
	Jiri Olsa

From: Namhyung Kim <namhyung.kim@lge.com>

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.

Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Makefile     | 2 +-
 tools/perf/tests/attr.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7d6d2846477b..2e9a287b3a23 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 25638a986257..6a6be5ea1311 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -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);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf test: Check python path on attr test
  2012-12-17  7:25 [PATCH] perf test: Check python path on attr test Namhyung Kim
@ 2012-12-17 13:44 ` Jiri Olsa
  2013-01-25 11:04 ` [tip:perf/core] perf tests: Check python path on attr and binding test tip-bot for Namhyung Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2012-12-17 13:44 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras,
	Ingo Molnar, LKML, Namhyung Kim

On Mon, Dec 17, 2012 at 04:25:01PM +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
> 
> 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.
> 
> Cc: Jiri Olsa <jolsa@redhat.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Jiri Olsa <jolsa@redhat.com>

jirka

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/core] perf tests: Check python path on attr and binding test
  2012-12-17  7:25 [PATCH] perf test: Check python path on attr test Namhyung Kim
  2012-12-17 13:44 ` Jiri Olsa
@ 2013-01-25 11:04 ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Namhyung Kim @ 2013-01-25 11:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
	namhyung.kim, namhyung, jolsa, tglx

Commit-ID:  000ae33fdb5ff7bc7ae985b43e6278024a4985c2
Gitweb:     http://git.kernel.org/tip/000ae33fdb5ff7bc7ae985b43e6278024a4985c2
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Mon, 17 Dec 2012 16:25:01 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1355729101-31317-1-git-send-email-namhyung@kernel.org
[ committer note: Added the same mechanism to the python binding test ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile           | 7 +++++--
 tools/perf/tests/attr.c       | 2 +-
 tools/perf/tests/python-use.c | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d0d7957..3158f45 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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)"' $<
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 05b5acb..f61dd3f 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -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);
diff --git a/tools/perf/tests/python-use.c b/tools/perf/tests/python-use.c
index 15301f4..7760277 100644
--- a/tools/perf/tests/python-use.c
+++ b/tools/perf/tests/python-use.c
@@ -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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-25 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-17  7:25 [PATCH] perf test: Check python path on attr test Namhyung Kim
2012-12-17 13:44 ` Jiri Olsa
2013-01-25 11:04 ` [tip:perf/core] perf tests: Check python path on attr and binding test tip-bot for Namhyung Kim

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.