Arnaldo Carvalho de Melo | 54359d3 | 2012-12-14 13:06:13 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Just test if we can load the python binding. |
| 3 | */ |
| 4 | |
| 5 | #include <stdio.h> |
| 6 | #include <stdlib.h> |
Arnaldo Carvalho de Melo | 721a1f5 | 2015-11-19 12:01:48 -0300 | [diff] [blame] | 7 | #include <linux/compiler.h> |
Arnaldo Carvalho de Melo | 54359d3 | 2012-12-14 13:06:13 -0300 | [diff] [blame] | 8 | #include "tests.h" |
| 9 | |
| 10 | extern int verbose; |
| 11 | |
Arnaldo Carvalho de Melo | 721a1f5 | 2015-11-19 12:01:48 -0300 | [diff] [blame] | 12 | int test__python_use(int subtest __maybe_unused) |
Arnaldo Carvalho de Melo | 54359d3 | 2012-12-14 13:06:13 -0300 | [diff] [blame] | 13 | { |
| 14 | char *cmd; |
| 15 | int ret; |
| 16 | |
Namhyung Kim | 000ae33 | 2012-12-17 16:25:01 +0900 | [diff] [blame] | 17 | if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s", |
Namhyung Kim | bb963e1 | 2017-02-17 17:17:38 +0900 | [diff] [blame] | 18 | PYTHONPATH, PYTHON, verbose > 0 ? "" : "2> /dev/null") < 0) |
Arnaldo Carvalho de Melo | 54359d3 | 2012-12-14 13:06:13 -0300 | [diff] [blame] | 19 | return -1; |
| 20 | |
| 21 | ret = system(cmd) ? -1 : 0; |
| 22 | free(cmd); |
| 23 | return ret; |
| 24 | } |