@@ -66,7 +66,11 @@ def wrap_fd(pipeout):
66
66
return (str (pipeout ), None )
67
67
68
68
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 )
70
74
bg .append (sitl )
71
75
72
76
while sitl .poll () == None :
@@ -100,12 +104,37 @@ def lets_run_a_test(name):
100
104
sys .stdout .flush ()
101
105
sys .stderr .flush ()
102
106
103
- timeout = 300
107
+ # APPVEYOR = SLOW
108
+ timeout = 15 * 60 if sys .platform == 'win32' else 5 * 60
104
109
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)
106
111
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 :
109
138
kill (p .pid )
110
139
p .returncode = 143
111
140
print ('Error: Timeout after ' + str (timeout ) + ' seconds.' )
0 commit comments