- Timestamp:
- Jun 26, 2019, 1:51:28 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b0ab7853, e507c11
- Parents:
- 05c34c3
- Location:
- tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/tools.py
r05c34c3 r35a408b7 179 179 os.chdir(cwd) 180 180 181 def killgroup(): 182 try: 183 os.killpg(os.getpgrp(), signal.SIGINT) 184 except KeyboardInterrupt: 185 pass # expected 186 except Exception as exc: 187 print("Unexpected exception", file=sys.stderr) 188 print(exc, file=sys.stderr) 189 sys.stderr.flush() 190 sys.exit(2) 191 181 192 ################################################################################ 182 193 # file handling … … 301 312 self.end = time.time() 302 313 self.duration = self.end - self.start 314 315 def timed(src, timeout): 316 expire = time.time() + timeout 317 i = iter(src) 318 while True: 319 yield i.next(max(expire - time.time(), 0)) -
tests/test.py
r05c34c3 r35a408b7 205 205 return retcode == TestResult.SUCCESS, text 206 206 except KeyboardInterrupt: 207 False, "" 207 return False, "" 208 except: 209 print("Unexpected error in worker thread", file=sys.stderr) 210 sys.stderr.flush() 211 return False, "" 212 208 213 209 214 # run the given list of tests with the given parameters … … 221 226 num = len(tests) 222 227 fancy = sys.stdout.isatty() 223 for i, (succ, txt) in enumerate(pool.imap(228 results = pool.imap_unordered( 224 229 run_test_worker, 225 230 tests, 226 231 chunksize = 1 227 )) : 232 ) 233 234 for i, (succ, txt) in enumerate(timed(results, timeout = settings.timeout.total), 1) : 228 235 if not succ : 229 236 failed = True … … 236 243 237 244 except KeyboardInterrupt: 245 print("Tests interrupted by user", file=sys.stderr) 238 246 pool.terminate() 239 p rint("Tests interrupted by user", file=sys.stderr)247 pool.join() 240 248 failed = True 241 249 except multiprocessing.TimeoutError: 250 print("ERROR: Test suite timed out", file=sys.stderr) 242 251 pool.terminate() 243 p rint("ERROR: Test suite timed out", file=sys.stderr)252 pool.join() 244 253 failed = True 254 killgroup() # needed to cleanly kill all children 255 245 256 246 257 # clean the workspace
Note: See TracChangeset
for help on using the changeset viewer.