Skip to content

Commit 72c2b4b

Browse files
committed
Merge pull request #204 from diydrones/tcr-appveyor
Updates SITL resiliency and caching on Appveyor.
2 parents d3ed940 + 19045e6 commit 72c2b4b

File tree

2 files changed

+47
-10
lines changed

2 files changed

+47
-10
lines changed

appveyor.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
environment:
22
global: {}
33
init: []
4+
cache:
5+
- "c:/Users/appveyor/.pip-wheelhouse"
46
install:
5-
- cmd: 'setlocal & python -m pip install pip -U & endlocal'
7+
- ps: |
8+
New-Item -ItemType Directory -Force -Path c:\Users\appveyor\pip\
9+
@'
10+
[global]
11+
find-links = file://c:/Users/appveyor/.pip-wheelhouse
12+
13+
[wheel]
14+
wheel-dir = c:/Users/appveyor/.pip-wheelhouse
15+
'@ | out-file -Encoding ascii -FilePath c:\Users\appveyor\pip\pip.ini
16+
- cmd: 'setlocal & python -m pip install pip wheel -U & endlocal'
17+
- cmd: "setlocal & SET PATH=%PYTHON%;c:\\Python27\\Scripts;%PATH% & pip2 wheel numpy & endlocal"
618
- cmd: "setlocal & SET PATH=%PYTHON%;c:\\Python27\\Scripts;%PATH% & pip2 install nose numpy psutil & endlocal"
719
- cmd: "setlocal & SET PATH=%PYTHON%;c:\\Python27\\Scripts;%PATH% & pip2 install git+https://github.com/3drobotics/dronekit-sitl-runner.git & endlocal"
820
build_script:
921
- cmd: 'setlocal & python setup.py install & endlocal'
10-
- cmd: "setlocal & SET PATH=%PYTHON%;c:\\Python27\\Scripts;%PATH% & nosetests tests\\web & endlocal"
11-
- cmd: "setlocal & SET PATH=%PYTHON%;c:\\Python27\\Scripts;%PATH% & cd tests & python -m sitl & endlocal"
1222
clone_depth: 10
13-
cache:
14-
- '%CYG_CACHE%'
1523
test: 'off'
1624
branches:
1725
only:

tests/sitl/__main__.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def wrap_fd(pipeout):
6666
return (str(pipeout), None)
6767

6868
def lets_run_a_test(name):
69-
sitl = Popen(['dronekit-sitl', 'copter-3.3-rc5', '-I0', '-S', '--model', 'quad', '--home=-35.363261,149.165230,584,353'], stdout=PIPE, stderr=PIPE)
69+
sitl_args = ['dronekit-sitl', 'copter-3.3-rc5', '-I0', '-S', '--model', 'quad', '--home=-35.363261,149.165230,584,353']
70+
if sys.platform == 'win32':
71+
sitl = Popen(['start', '/affinity', '14', '/realtime', '/b', '/wait'] + sitl_args, shell=True, stdout=PIPE, stderr=PIPE)
72+
else:
73+
sitl = Popen(sitl_args, stdout=PIPE, stderr=PIPE)
7074
bg.append(sitl)
7175

7276
while sitl.poll() == None:
@@ -100,12 +104,37 @@ def lets_run_a_test(name):
100104
sys.stdout.flush()
101105
sys.stderr.flush()
102106

103-
timeout = 300
107+
# APPVEYOR = SLOW
108+
timeout = 15*60 if sys.platform == 'win32' else 5*60
104109
try:
105-
p = Popen([sys.executable, '-m', 'MAVProxy.mavproxy', '--logfile=' + tempfile.mkstemp()[1], '--master=tcp:127.0.0.1:5760', '--cmd=module load droneapi.module.api; ; api start testlib.py'], cwd=testpath, env=newenv, stdout=PIPE, stderr=PIPE)
110+
p = Popen([sys.executable, '-m', 'MAVProxy.mavproxy', '--logfile=' + tempfile.mkstemp()[1], '--master=tcp:127.0.0.1:5760'], cwd=testpath, env=newenv, stdin=PIPE, stdout=PIPE)#, stderr=PIPE)
106111
bg.append(p)
107-
wait_timeout(p, timeout)
108-
except TimeoutExpired:
112+
113+
while p.poll() == None:
114+
line = p.stdout.readline()
115+
sys.stdout.write(line)
116+
sys.stdout.flush()
117+
if 'parameters' in line:
118+
break
119+
120+
# TODO this sleep is only for us to waiting until
121+
# all parameters to be received; would prefer to
122+
# move this to testlib.py and happen asap
123+
time.sleep(3)
124+
p.stdin.write('module load droneapi.module.api\n')
125+
p.stdin.write('param set ARMING_CHECK 0\n')
126+
p.stdin.write('api start testlib.py\n')
127+
p.stdin.flush()
128+
129+
while True:
130+
nextline = p.stdout.readline()
131+
if nextline == '' and p.poll() != None:
132+
break
133+
sys.stdout.write(nextline)
134+
sys.stdout.flush()
135+
136+
# wait_timeout(p, timeout)
137+
except RuntimeError:
109138
kill(p.pid)
110139
p.returncode = 143
111140
print('Error: Timeout after ' + str(timeout) + ' seconds.')

0 commit comments

Comments
 (0)