2017-11-01 15:07:57 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2012-12-14 13:06:13 -03:00
|
|
|
/*
|
|
|
|
|
* Just test if we can load the python binding.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
2015-11-19 12:01:48 -03:00
|
|
|
#include <linux/compiler.h>
|
2012-12-14 13:06:13 -03:00
|
|
|
#include "tests.h"
|
2018-05-28 15:48:17 +02:00
|
|
|
#include "util/debug.h"
|
2012-12-14 13:06:13 -03:00
|
|
|
|
2017-08-03 15:16:31 -03:00
|
|
|
int test__python_use(struct test *test __maybe_unused, int subtest __maybe_unused)
|
2012-12-14 13:06:13 -03:00
|
|
|
{
|
|
|
|
|
char *cmd;
|
|
|
|
|
int ret;
|
|
|
|
|
|
2012-12-17 16:25:01 +09:00
|
|
|
if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s",
|
2017-02-17 17:17:38 +09:00
|
|
|
PYTHONPATH, PYTHON, verbose > 0 ? "" : "2> /dev/null") < 0)
|
2012-12-14 13:06:13 -03:00
|
|
|
return -1;
|
|
|
|
|
|
2020-10-13 16:22:03 -03:00
|
|
|
pr_debug("python usage test: \"%s\"\n", cmd);
|
2012-12-14 13:06:13 -03:00
|
|
|
ret = system(cmd) ? -1 : 0;
|
|
|
|
|
free(cmd);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|