python-use.c 459 B

123456789101112131415161718192021222324
  1. /*
  2. * Just test if we can load the python binding.
  3. */
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <linux/compiler.h>
  7. #include "tests.h"
  8. extern int verbose;
  9. int test__python_use(int subtest __maybe_unused)
  10. {
  11. char *cmd;
  12. int ret;
  13. if (asprintf(&cmd, "echo \"import sys ; sys.path.append('%s'); import perf\" | %s %s",
  14. PYTHONPATH, PYTHON, verbose ? "" : "2> /dev/null") < 0)
  15. return -1;
  16. ret = system(cmd) ? -1 : 0;
  17. free(cmd);
  18. return ret;
  19. }