with_crash_on_timeout.py 544 B

12345678910111213141516171819202122
  1. # TODO prettyboy remove after ya-bin release
  2. import os
  3. import sys
  4. import subprocess
  5. import json
  6. def main(args):
  7. meta_path = os.path.abspath(args[0])
  8. timeout_code = int(args[1])
  9. subprocess.check_call(args[2:])
  10. with open(meta_path) as f:
  11. meta_info = json.loads(f.read())
  12. if meta_info["exit_code"] == timeout_code:
  13. print >> sys.stderr, meta_info["project"], 'crashed by timeout, use --test-disable-timeout option'
  14. return 1
  15. return 0
  16. if __name__ == '__main__':
  17. main(sys.argv[1:])