Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Just test if we can load the python binding.
0004  */
0005 
0006 #include <stdio.h>
0007 #include <stdlib.h>
0008 #include <linux/compiler.h>
0009 #include "tests.h"
0010 #include "util/debug.h"
0011 
0012 static int test__python_use(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
0013 {
0014     char *cmd;
0015     int ret;
0016 
0017     if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s",
0018              PYTHONPATH, PYTHON, verbose > 0 ? "" : "2> /dev/null") < 0)
0019         return -1;
0020 
0021     pr_debug("python usage test: \"%s\"\n", cmd);
0022     ret = system(cmd) ? -1 : 0;
0023     free(cmd);
0024     return ret;
0025 }
0026 
0027 DEFINE_SUITE("'import perf' in python", python_use);