blob: fa79509da535403888c41cfa33a3ca3ff89033fd [file] [log] [blame]
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -03001/*
2 * Just test if we can load the python binding.
3 */
4
5#include <stdio.h>
6#include <stdlib.h>
Arnaldo Carvalho de Melo721a1f52015-11-19 12:01:48 -03007#include <linux/compiler.h>
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -03008#include "tests.h"
9
10extern int verbose;
11
Arnaldo Carvalho de Melo721a1f52015-11-19 12:01:48 -030012int test__python_use(int subtest __maybe_unused)
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -030013{
14 char *cmd;
15 int ret;
16
Namhyung Kim000ae332012-12-17 16:25:01 +090017 if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s",
Namhyung Kimbb963e12017-02-17 17:17:38 +090018 PYTHONPATH, PYTHON, verbose > 0 ? "" : "2> /dev/null") < 0)
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -030019 return -1;
20
21 ret = system(cmd) ? -1 : 0;
22 free(cmd);
23 return ret;
24}