You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
483 B
Bash
29 lines
483 B
Bash
#!/bin/bash
|
|
|
|
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)
|
|
' "$@"
|
|
}
|
|
|
|
for f in tests/*_test.py; do
|
|
echo $f
|
|
timeout 10 python $f
|
|
done
|