test.sh: make it work on OS X out of the box
This commit is contained in:
parent
1b2cbf1e00
commit
e48b6ca7f4
27
test.sh
27
test.sh
|
@ -1,4 +1,31 @@
|
||||||
#!/bin/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:
|
||||||
|
if proc.returncode:
|
||||||
|
print
|
||||||
|
print >> sys.stderr, "Command failed:", sys.argv[2:]
|
||||||
|
print
|
||||||
|
sys.exit(proc.returncode)
|
||||||
|
proc.terminate()
|
||||||
|
print
|
||||||
|
print >> sys.stderr, "Timeout! Command was:", sys.argv[2:]
|
||||||
|
print
|
||||||
|
sys.exit(1)
|
||||||
|
' "$@"
|
||||||
|
}
|
||||||
|
|
||||||
timeout 05.0 python tests/call_function_test.py
|
timeout 05.0 python tests/call_function_test.py
|
||||||
timeout 05.0 python tests/channel_test.py
|
timeout 05.0 python tests/channel_test.py
|
||||||
timeout 05.0 python tests/first_stage_test.py
|
timeout 05.0 python tests/first_stage_test.py
|
||||||
|
|
Loading…
Reference in New Issue