Changes in tests/test.py [35a408b7:f806b61]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/test.py
r35a408b7 rf806b61 202 202 if error : 203 203 text = text + '\n' + error 204 205 return retcode == TestResult.SUCCESS, text 204 out = sys.stderr 205 206 print(text, file = out) 207 sys.stdout.flush() 208 sys.stderr.flush() 209 210 return retcode != TestResult.SUCCESS 206 211 except KeyboardInterrupt: 207 return False, "" 208 except: 209 print("Unexpected error in worker thread", file=sys.stderr) 210 sys.stderr.flush() 211 return False, "" 212 212 False 213 213 214 214 # run the given list of tests with the given parameters … … 220 220 pool = multiprocessing.Pool(jobs) 221 221 222 failed = False223 224 222 # for each test to run 225 223 try : 226 num = len(tests) 227 fancy = sys.stdout.isatty() 228 results = pool.imap_unordered( 224 results = pool.map_async( 229 225 run_test_worker, 230 226 tests, 231 227 chunksize = 1 232 ) 233 234 for i, (succ, txt) in enumerate(timed(results, timeout = settings.timeout.total), 1) : 235 if not succ : 236 failed = True 237 238 print(" " + txt) 239 240 if(fancy and i != num): 241 print("%d/%d" % (i, num), end='\r') 242 sys.stdout.flush() 243 228 ).get(settings.timeout.total) 244 229 except KeyboardInterrupt: 245 print("Tests interrupted by user", file=sys.stderr)246 230 pool.terminate() 247 pool.join() 248 failed = True 249 except multiprocessing.TimeoutError: 250 print("ERROR: Test suite timed out", file=sys.stderr) 251 pool.terminate() 252 pool.join() 253 failed = True 254 killgroup() # needed to cleanly kill all children 255 231 print("Tests interrupted by user") 232 sys.exit(1) 256 233 257 234 # clean the workspace 258 235 make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL) 259 236 260 return 1 if failed else 0 237 for failed in results: 238 if failed : 239 return 1 240 241 return 0 261 242 262 243
Note: See TracChangeset
for help on using the changeset viewer.