Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / tests / python-use.c
blob0ebc22ac8d5b47ed532bd59618ce487d71b56eb2
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Just test if we can load the python binding.
4 */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <linux/compiler.h>
9 #include "tests.h"
10 #include "util/debug.h"
12 static int test__python_use(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
14 char *cmd;
15 int ret;
17 if (asprintf(&cmd, "echo \"import sys ; sys.path.insert(0, '%s'); import perf\" | %s %s",
18 PYTHONPATH, PYTHON, verbose > 0 ? "" : "2> /dev/null") < 0)
19 return -1;
21 pr_debug("python usage test: \"%s\"\n", cmd);
22 ret = system(cmd) ? -1 : 0;
23 free(cmd);
24 return ret;
27 DEFINE_SUITE("'import perf' in python", python_use);