From 54359d3340241b4cf53e42ecd5c429d7ba6fbef3 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Fri, 14 Dec 2012 13:06:13 -0300 Subject: perf test: Check for linking problems in the python binding It just will add the O= builddir to PYTHONPATH and try to 'use perf', which will, in verbose mode show the python backtrace with the missing symbols, such as in the problem fixed in the patch after this one: # perf test -v 15 15: Try 'use perf' in python, checking link problems : --- start --- Traceback (most recent call last): File "", line 1, in ImportError: /home/acme/git/build/perf//python/perf.so: undefined symbol: test_attr__enabled ---- end ---- Try 'use perf' in python, checking link problems: FAILED! # Loooong overdue, done. Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-zmd2oq9gz6t1u145ub7qm2nv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/python-use.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tools/perf/tests/python-use.c (limited to 'tools/perf/tests/python-use.c') diff --git a/tools/perf/tests/python-use.c b/tools/perf/tests/python-use.c new file mode 100644 index 000000000000..15301f4ac3f1 --- /dev/null +++ b/tools/perf/tests/python-use.c @@ -0,0 +1,23 @@ +/* + * Just test if we can load the python binding. + */ + +#include +#include +#include "tests.h" + +extern int verbose; + +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) + return -1; + + ret = system(cmd) ? -1 : 0; + free(cmd); + return ret; +} -- cgit v1.2.1