Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Arnaldo Carvalho de Melo | 54359d3 | 2012-12-14 13:06:13 -0300 | [diff] [blame] | 2 | /* |
| 3 | * Just test if we can load the python binding. |
| 4 | */ |
| 5 | |
| 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> |
Arnaldo Carvalho de Melo | 721a1f5 | 2015-11-19 12:01:48 -0300 | [diff] [blame] | 8 | #include <linux/compiler.h> |
Arnaldo Carvalho de Melo | 54359d3 | 2012-12-14 13:06:13 -0300 | [diff] [blame] | 9 | #include "tests.h" |
Thomas Richter | e9ee0dc | 2018-05-28 15:48:17 +0200 | [diff] [blame] | 10 | #include "util/debug.h" |
Arnaldo Carvalho de Melo | 54359d3 | 2012-12-14 13:06:13 -0300 | [diff] [blame] | 11 | |
Arnaldo Carvalho de Melo | 81f17c9 | 2017-08-03 15:16:31 -0300 | [diff] [blame] | 12 | int test__python_use(struct test *test __maybe_unused, 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 | } |