Commit 6805dc08 authored by Denis Bilenko's avatar Denis Bilenko

test__benchmarks.py: kill the spawned processes after timeout

parent 59c5c154
import sys
import os
import glob
import mysubprocess as subprocess
import time
def system(command):
p = subprocess.Popen(command, shell=True)
try:
start = time.time()
while time.time() < start + 10 and p.poll() is None:
time.sleep(0.1)
if p.poll() is None:
p.kill()
return 'KILLED'
return p.poll()
finally:
if p.poll() is None:
p.kill()
modules = set()
......@@ -16,7 +32,7 @@ if __name__ == '__main__':
for path in modules:
print path
sys.stdout.flush()
res = os.system('%s %s all' % (sys.executable, path))
res = system('%s %s all' % (sys.executable, path))
if res:
error = 1
print path, 'failed'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment