OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2008 the V8 project authors. All rights reserved. | 3 # Copyright 2008 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 except Empty: | 110 except Empty: |
111 return | 111 return |
112 case = test.case | 112 case = test.case |
113 self.lock.acquire() | 113 self.lock.acquire() |
114 self.AboutToRun(case) | 114 self.AboutToRun(case) |
115 self.lock.release() | 115 self.lock.release() |
116 try: | 116 try: |
117 start = time.time() | 117 start = time.time() |
118 output = case.Run() | 118 output = case.Run() |
119 case.duration = (time.time() - start) | 119 case.duration = (time.time() - start) |
| 120 except BreakNowException: |
| 121 self.terminate = True |
120 except IOError, e: | 122 except IOError, e: |
121 assert self.terminate | 123 assert self.terminate |
122 return | 124 return |
123 if self.terminate: | 125 if self.terminate: |
124 return | 126 return |
125 self.lock.acquire() | 127 self.lock.acquire() |
126 if output.UnexpectedOutput(): | 128 if output.UnexpectedOutput(): |
127 self.failed.append(output) | 129 self.failed.append(output) |
128 if output.HasCrashed(): | 130 if output.HasCrashed(): |
129 self.crashed += 1 | 131 self.crashed += 1 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 'dots': DotsProgressIndicator, | 313 'dots': DotsProgressIndicator, |
312 'color': ColorProgressIndicator, | 314 'color': ColorProgressIndicator, |
313 'mono': MonochromeProgressIndicator | 315 'mono': MonochromeProgressIndicator |
314 } | 316 } |
315 | 317 |
316 | 318 |
317 # ------------------------- | 319 # ------------------------- |
318 # --- F r a m e w o r k --- | 320 # --- F r a m e w o r k --- |
319 # ------------------------- | 321 # ------------------------- |
320 | 322 |
| 323 class BreakNowException(Exception): |
| 324 def __init__(self, value): |
| 325 self.value = value |
| 326 def __str__(self): |
| 327 return repr(self.value) |
| 328 |
321 | 329 |
322 class CommandOutput(object): | 330 class CommandOutput(object): |
323 | 331 |
324 def __init__(self, exit_code, timed_out, stdout, stderr): | 332 def __init__(self, exit_code, timed_out, stdout, stderr): |
325 self.exit_code = exit_code | 333 self.exit_code = exit_code |
326 self.timed_out = timed_out | 334 self.timed_out = timed_out |
327 self.stdout = stdout | 335 self.stdout = stdout |
328 self.stderr = stderr | 336 self.stderr = stderr |
329 self.failed = None | 337 self.failed = None |
330 | 338 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 pass | 380 pass |
373 | 381 |
374 def AfterRun(self, result): | 382 def AfterRun(self, result): |
375 pass | 383 pass |
376 | 384 |
377 def GetCustomFlags(self, mode): | 385 def GetCustomFlags(self, mode): |
378 return None | 386 return None |
379 | 387 |
380 def Run(self): | 388 def Run(self): |
381 self.BeforeRun() | 389 self.BeforeRun() |
382 result = "exception" | 390 result = None; |
383 try: | 391 try: |
384 result = self.RunCommand(self.GetCommand()) | 392 result = self.RunCommand(self.GetCommand()) |
| 393 except: |
| 394 self.terminate = True; |
| 395 raise BreakNowException("Used pressed CTRL+C or IO went wrong") |
385 finally: | 396 finally: |
386 self.AfterRun(result) | 397 self.AfterRun(result) |
387 return result | 398 return result |
388 | 399 |
389 def Cleanup(self): | 400 def Cleanup(self): |
390 return | 401 return |
391 | 402 |
392 | 403 |
393 class TestOutput(object): | 404 class TestOutput(object): |
394 | 405 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 706 |
696 def GetTimeout(self, testcase, mode): | 707 def GetTimeout(self, testcase, mode): |
697 result = self.timeout * TIMEOUT_SCALEFACTOR[mode] | 708 result = self.timeout * TIMEOUT_SCALEFACTOR[mode] |
698 if '--stress-opt' in self.GetVmFlags(testcase, mode): | 709 if '--stress-opt' in self.GetVmFlags(testcase, mode): |
699 return result * 2 | 710 return result * 2 |
700 else: | 711 else: |
701 return result | 712 return result |
702 | 713 |
703 def RunTestCases(cases_to_run, progress, tasks): | 714 def RunTestCases(cases_to_run, progress, tasks): |
704 progress = PROGRESS_INDICATORS[progress](cases_to_run) | 715 progress = PROGRESS_INDICATORS[progress](cases_to_run) |
705 return progress.Run(tasks) | 716 result = 0; |
| 717 try: |
| 718 result = progress.Run(tasks) |
| 719 except Exception, e: |
| 720 print "\n", e |
| 721 return result |
706 | 722 |
707 | 723 |
708 def BuildRequirements(context, requirements, mode, scons_flags): | 724 def BuildRequirements(context, requirements, mode, scons_flags): |
709 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] | 725 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] |
710 + requirements | 726 + requirements |
711 + scons_flags) | 727 + scons_flags) |
712 output = ExecuteNoCapture(command_line, context) | 728 output = ExecuteNoCapture(command_line, context) |
713 return output.exit_code == 0 | 729 return output.exit_code == 0 |
714 | 730 |
715 | 731 |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 for entry in timed_tests[:20]: | 1497 for entry in timed_tests[:20]: |
1482 t = FormatTime(entry.duration) | 1498 t = FormatTime(entry.duration) |
1483 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1499 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
1484 index += 1 | 1500 index += 1 |
1485 | 1501 |
1486 return result | 1502 return result |
1487 | 1503 |
1488 | 1504 |
1489 if __name__ == '__main__': | 1505 if __name__ == '__main__': |
1490 sys.exit(Main()) | 1506 sys.exit(Main()) |
OLD | NEW |