2017-10-30 10:38:50 +00:00
|
|
|
#!/bin/bash
|
2018-02-28 21:34:27 +00:00
|
|
|
|
|
|
|
timeout()
|
|
|
|
{
|
|
|
|
python -c '
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
|
|
|
|
deadline = time.time() + float(sys.argv[1])
|
|
|
|
proc = subprocess.Popen(sys.argv[2:])
|
|
|
|
while time.time() < deadline and proc.poll() is None:
|
|
|
|
time.sleep(1.0)
|
|
|
|
|
|
|
|
if proc.poll() is not None:
|
|
|
|
sys.exit(proc.returncode)
|
|
|
|
proc.terminate()
|
|
|
|
print
|
|
|
|
print >> sys.stderr, "Timeout! Command was:", sys.argv[2:]
|
|
|
|
print
|
|
|
|
sys.exit(1)
|
|
|
|
' "$@"
|
|
|
|
}
|
|
|
|
|
2018-03-08 21:35:38 +00:00
|
|
|
for f in tests/*_test.py; do
|
|
|
|
echo $f
|
|
|
|
timeout 10 python $f
|
|
|
|
done
|