python-use.c 409 B

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