Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Just test if we can load the python binding. |
| 4 | */ |
| 5 | |
| 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> |
| 8 | #include <linux/compiler.h> |
| 9 | #include "tests.h" |
| 10 | #include "util/debug.h" |
| 11 | |
| 12 | int test__python_use(struct test *test __maybe_unused, int subtest __maybe_unused) |
| 13 | { |
| 14 | char *cmd; |
| 15 | int ret; |
| 16 | |
| 17 | if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s", |
| 18 | PYTHONPATH, PYTHON, verbose > 0 ? "" : "2> /dev/null") < 0) |
| 19 | return -1; |
| 20 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 21 | pr_debug("python usage test: \"%s\"\n", cmd); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 22 | ret = system(cmd) ? -1 : 0; |
| 23 | free(cmd); |
| 24 | return ret; |
| 25 | } |