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 | |
122 except IOError, e: | 120 except IOError, e: |
123 assert self.terminate | 121 assert self.terminate |
124 return | 122 return |
125 if self.terminate: | 123 if self.terminate: |
126 return | 124 return |
127 self.lock.acquire() | 125 self.lock.acquire() |
128 if output.UnexpectedOutput(): | 126 if output.UnexpectedOutput(): |
129 self.failed.append(output) | 127 self.failed.append(output) |
130 if output.HasCrashed(): | 128 if output.HasCrashed(): |
131 self.crashed += 1 | 129 self.crashed += 1 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 'dots': DotsProgressIndicator, | 311 'dots': DotsProgressIndicator, |
314 'color': ColorProgressIndicator, | 312 'color': ColorProgressIndicator, |
315 'mono': MonochromeProgressIndicator | 313 'mono': MonochromeProgressIndicator |
316 } | 314 } |
317 | 315 |
318 | 316 |
319 # ------------------------- | 317 # ------------------------- |
320 # --- F r a m e w o r k --- | 318 # --- F r a m e w o r k --- |
321 # ------------------------- | 319 # ------------------------- |
322 | 320 |
323 class BreakNowException(Exception): | |
324 def __init__(self, value): | |
325 self.value = value | |
326 def __str__(self): | |
327 return repr(self.value) | |
328 | |
329 | 321 |
330 class CommandOutput(object): | 322 class CommandOutput(object): |
331 | 323 |
332 def __init__(self, exit_code, timed_out, stdout, stderr): | 324 def __init__(self, exit_code, timed_out, stdout, stderr): |
333 self.exit_code = exit_code | 325 self.exit_code = exit_code |
334 self.timed_out = timed_out | 326 self.timed_out = timed_out |
335 self.stdout = stdout | 327 self.stdout = stdout |
336 self.stderr = stderr | 328 self.stderr = stderr |
337 self.failed = None | 329 self.failed = None |
338 | 330 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 pass | 372 pass |
381 | 373 |
382 def AfterRun(self, result): | 374 def AfterRun(self, result): |
383 pass | 375 pass |
384 | 376 |
385 def GetCustomFlags(self, mode): | 377 def GetCustomFlags(self, mode): |
386 return None | 378 return None |
387 | 379 |
388 def Run(self): | 380 def Run(self): |
389 self.BeforeRun() | 381 self.BeforeRun() |
390 result = None; | 382 result = "exception" |
391 try: | 383 try: |
392 result = self.RunCommand(self.GetCommand()) | 384 result = self.RunCommand(self.GetCommand()) |
393 except: | |
394 self.terminate = True; | |
395 raise BreakNowException("Used pressed CTRL+C or IO went wrong") | |
396 finally: | 385 finally: |
397 self.AfterRun(result) | 386 self.AfterRun(result) |
398 return result | 387 return result |
399 | 388 |
400 def Cleanup(self): | 389 def Cleanup(self): |
401 return | 390 return |
402 | 391 |
403 | 392 |
404 class TestOutput(object): | 393 class TestOutput(object): |
405 | 394 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 695 |
707 def GetTimeout(self, testcase, mode): | 696 def GetTimeout(self, testcase, mode): |
708 result = self.timeout * TIMEOUT_SCALEFACTOR[mode] | 697 result = self.timeout * TIMEOUT_SCALEFACTOR[mode] |
709 if '--stress-opt' in self.GetVmFlags(testcase, mode): | 698 if '--stress-opt' in self.GetVmFlags(testcase, mode): |
710 return result * 2 | 699 return result * 2 |
711 else: | 700 else: |
712 return result | 701 return result |
713 | 702 |
714 def RunTestCases(cases_to_run, progress, tasks): | 703 def RunTestCases(cases_to_run, progress, tasks): |
715 progress = PROGRESS_INDICATORS[progress](cases_to_run) | 704 progress = PROGRESS_INDICATORS[progress](cases_to_run) |
716 result = 0; | 705 return progress.Run(tasks) |
717 try: | |
718 result = progress.Run(tasks) | |
719 except Exception, e: | |
720 print "\n", e | |
721 return result | |
722 | 706 |
723 | 707 |
724 def BuildRequirements(context, requirements, mode, scons_flags): | 708 def BuildRequirements(context, requirements, mode, scons_flags): |
725 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] | 709 command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)] |
726 + requirements | 710 + requirements |
727 + scons_flags) | 711 + scons_flags) |
728 output = ExecuteNoCapture(command_line, context) | 712 output = ExecuteNoCapture(command_line, context) |
729 return output.exit_code == 0 | 713 return output.exit_code == 0 |
730 | 714 |
731 | 715 |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 for entry in timed_tests[:20]: | 1481 for entry in timed_tests[:20]: |
1498 t = FormatTime(entry.duration) | 1482 t = FormatTime(entry.duration) |
1499 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1483 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
1500 index += 1 | 1484 index += 1 |
1501 | 1485 |
1502 return result | 1486 return result |
1503 | 1487 |
1504 | 1488 |
1505 if __name__ == '__main__': | 1489 if __name__ == '__main__': |
1506 sys.exit(Main()) | 1490 sys.exit(Main()) |
OLD | NEW |