blob: 40ab72149ce1fd867dc2093adc4521e77a452b67 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -03002/*
3 * Just test if we can load the python binding.
4 */
5
6#include <stdio.h>
7#include <stdlib.h>
Arnaldo Carvalho de Melo721a1f52015-11-19 12:01:48 -03008#include <linux/compiler.h>
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -03009#include "tests.h"
Thomas Richtere9ee0dc2018-05-28 15:48:17 +020010#include "util/debug.h"
Arnaldo Carvalho de Melo54359d32012-12-14 13:06:13 -030011
Arnaldo Carvalho de Melo81f17c92017-08-03 15:16:31 -030012int test__python_use(struct test *test __maybe_unused, 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}