@@ -2097,8 +2097,16 @@ def build_test_worker(*args, **kwargs):
2097
2097
ret ['bin_file' ] = bin_file
2098
2098
ret ['kwargs' ] = kwargs
2099
2099
2100
+ except NotSupportedException , e :
2101
+ ret ['reason' ] = e
2102
+ except ToolException , e :
2103
+ ret ['reason' ] = e
2104
+ except KeyboardInterrupt , e :
2105
+ ret ['reason' ] = e
2100
2106
except :
2101
- ret ['reason' ] = sys .exc_info ()[1 ]
2107
+ # Print unhandled exceptions here
2108
+ import traceback
2109
+ traceback .print_exc (file = sys .stdout )
2102
2110
2103
2111
return ret
2104
2112
@@ -2132,7 +2140,6 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
2132
2140
2133
2141
jobs_count = int (jobs if jobs else cpu_count ())
2134
2142
p = Pool (processes = jobs_count )
2135
-
2136
2143
results = []
2137
2144
for test_name , test_path in tests .iteritems ():
2138
2145
test_build_path = os .path .join (build_path , test_path )
@@ -2166,51 +2173,61 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
2166
2173
p .terminate ()
2167
2174
p .join ()
2168
2175
raise ToolException ("Compile did not finish in 10 minutes" )
2176
+ else :
2177
+ sleep (0.01 )
2178
+ pending = 0
2179
+ for r in results :
2180
+ if r .ready () is True :
2181
+ try :
2182
+ worker_result = r .get ()
2183
+ results .remove (r )
2169
2184
2170
- sleep (0.01 )
2171
- pending = 0
2172
- for r in results :
2173
- if r .ready () is True :
2174
- try :
2175
- worker_result = r .get ()
2176
- results .remove (r )
2177
-
2178
- # Take report from the kwargs and merge it into existing report
2179
- report_entry = worker_result ['kwargs' ]['report' ][target_name ][toolchain_name ]
2180
- for test_key in report_entry .keys ():
2181
- report [target_name ][toolchain_name ][test_key ] = report_entry [test_key ]
2182
-
2183
- # Set the overall result to a failure if a build failure occurred
2184
- if not worker_result ['result' ] and not isinstance (worker_result ['reason' ], NotSupportedException ):
2185
- result = False
2186
-
2187
- # Adding binary path to test build result
2188
- if worker_result ['result' ] and 'bin_file' in worker_result :
2189
- bin_file = norm_relative_path (worker_result ['bin_file' ], execution_directory )
2190
-
2191
- test_build ['tests' ][worker_result ['kwargs' ]['project_id' ]] = {
2192
- "binaries" : [
2193
- {
2194
- "path" : bin_file
2195
- }
2196
- ]
2197
- }
2185
+ # Take report from the kwargs and merge it into existing report
2186
+ report_entry = worker_result ['kwargs' ]['report' ][target_name ][toolchain_name ]
2187
+ for test_key in report_entry .keys ():
2188
+ report [target_name ][toolchain_name ][test_key ] = report_entry [test_key ]
2198
2189
2199
- test_key = worker_result ['kwargs' ]['project_id' ].upper ()
2200
- print report [target_name ][toolchain_name ][test_key ][0 ][0 ]['output' ].rstrip ()
2201
- print 'Image: %s\n ' % bin_file
2202
-
2203
- except ToolException , err :
2204
- if p ._taskqueue .queue :
2205
- p ._taskqueue .queue .clear ()
2206
- sleep (0.5 )
2207
- p .terminate ()
2208
- p .join ()
2209
- raise ToolException (err )
2210
- else :
2211
- pending += 1
2212
- if pending >= jobs_count :
2213
- break
2190
+ # Set the overall result to a failure if a build failure occurred
2191
+ if not worker_result ['result' ] and not isinstance (worker_result ['reason' ], NotSupportedException ):
2192
+ result = False
2193
+ break
2194
+
2195
+ # Adding binary path to test build result
2196
+ if worker_result ['result' ] and 'bin_file' in worker_result :
2197
+ bin_file = norm_relative_path (worker_result ['bin_file' ], execution_directory )
2198
+
2199
+ test_build ['tests' ][worker_result ['kwargs' ]['project_id' ]] = {
2200
+ "binaries" : [
2201
+ {
2202
+ "path" : bin_file
2203
+ }
2204
+ ]
2205
+ }
2206
+
2207
+ test_key = worker_result ['kwargs' ]['project_id' ].upper ()
2208
+ print report [target_name ][toolchain_name ][test_key ][0 ][0 ]['output' ].rstrip ()
2209
+ print 'Image: %s\n ' % bin_file
2210
+
2211
+ except :
2212
+ if p ._taskqueue .queue :
2213
+ p ._taskqueue .queue .clear ()
2214
+ sleep (0.5 )
2215
+ p .terminate ()
2216
+ p .join ()
2217
+ raise
2218
+ else :
2219
+ pending += 1
2220
+ if pending >= jobs_count :
2221
+ break
2222
+
2223
+ # Break as soon as possible if there is a failure and we are not
2224
+ # continuing on build failures
2225
+ if not result and not continue_on_build_fail :
2226
+ if p ._taskqueue .queue :
2227
+ p ._taskqueue .queue .clear ()
2228
+ sleep (0.5 )
2229
+ p .terminate ()
2230
+ break
2214
2231
2215
2232
p .join ()
2216
2233
0 commit comments