| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 | 28 |
| 29 from functools import wraps | 29 from functools import wraps |
| 30 import json | 30 import json |
| 31 import os | 31 import os |
| 32 import sys | 32 import sys |
| 33 import time | 33 import time |
| 34 | 34 |
| 35 from . import execution | 35 from . import execution |
| 36 from . import junit_output | 36 from . import junit_output |
| 37 from . import statusfile |
| 37 | 38 |
| 38 | 39 |
| 39 ABS_PATH_PREFIX = os.getcwd() + os.sep | 40 ABS_PATH_PREFIX = os.getcwd() + os.sep |
| 40 | 41 |
| 41 | 42 |
| 42 class ProgressIndicator(object): | 43 class ProgressIndicator(object): |
| 43 | 44 |
| 44 def __init__(self): | 45 def __init__(self): |
| 45 self.runner = None | 46 self.runner = None |
| 46 | 47 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 self.results = [] | 323 self.results = [] |
| 323 self.tests = [] | 324 self.tests = [] |
| 324 | 325 |
| 325 def Done(self): | 326 def Done(self): |
| 326 complete_results = [] | 327 complete_results = [] |
| 327 if os.path.exists(self.json_test_results): | 328 if os.path.exists(self.json_test_results): |
| 328 with open(self.json_test_results, "r") as f: | 329 with open(self.json_test_results, "r") as f: |
| 329 # Buildbot might start out with an empty file. | 330 # Buildbot might start out with an empty file. |
| 330 complete_results = json.loads(f.read() or "[]") | 331 complete_results = json.loads(f.read() or "[]") |
| 331 | 332 |
| 333 duration_mean = None |
| 334 if self.tests: |
| 335 # Get duration mean. |
| 336 duration_mean = ( |
| 337 sum(t.duration for t in self.tests) / float(len(self.tests))) |
| 338 |
| 332 # Sort tests by duration. | 339 # Sort tests by duration. |
| 333 timed_tests = [t for t in self.tests if t.duration is not None] | 340 timed_tests = [t for t in self.tests if t.duration is not None] |
| 334 timed_tests.sort(lambda a, b: cmp(b.duration, a.duration)) | 341 timed_tests.sort(lambda a, b: cmp(b.duration, a.duration)) |
| 335 slowest_tests = [ | 342 slowest_tests = [ |
| 336 { | 343 { |
| 337 "name": test.GetLabel(), | 344 "name": test.GetLabel(), |
| 338 "flags": test.flags, | 345 "flags": test.flags, |
| 339 "command": self._EscapeCommand(test).replace(ABS_PATH_PREFIX, ""), | 346 "command": self._EscapeCommand(test).replace(ABS_PATH_PREFIX, ""), |
| 340 "duration": test.duration, | 347 "duration": test.duration, |
| 348 "marked_slow": statusfile.IsSlow(test.outcomes), |
| 341 } for test in timed_tests[:20] | 349 } for test in timed_tests[:20] |
| 342 ] | 350 ] |
| 343 | 351 |
| 344 complete_results.append({ | 352 complete_results.append({ |
| 345 "arch": self.arch, | 353 "arch": self.arch, |
| 346 "mode": self.mode, | 354 "mode": self.mode, |
| 347 "results": self.results, | 355 "results": self.results, |
| 348 "slowest_tests": slowest_tests, | 356 "slowest_tests": slowest_tests, |
| 357 "duration_mean": duration_mean, |
| 358 "test_total": len(self.tests), |
| 349 }) | 359 }) |
| 350 | 360 |
| 351 with open(self.json_test_results, "w") as f: | 361 with open(self.json_test_results, "w") as f: |
| 352 f.write(json.dumps(complete_results)) | 362 f.write(json.dumps(complete_results)) |
| 353 | 363 |
| 354 def HasRun(self, test, has_unexpected_output): | 364 def HasRun(self, test, has_unexpected_output): |
| 355 # Buffer all tests for sorting the durations in the end. | 365 # Buffer all tests for sorting the durations in the end. |
| 356 self.tests.append(test) | 366 self.tests.append(test) |
| 357 if not has_unexpected_output: | 367 if not has_unexpected_output: |
| 358 # Omit tests that run as expected. Passing tests of reruns after failures | 368 # Omit tests that run as expected. Passing tests of reruns after failures |
| (...skipping 19 matching lines...) Expand all Loading... |
| 378 "variant": test.variant, | 388 "variant": test.variant, |
| 379 }) | 389 }) |
| 380 | 390 |
| 381 | 391 |
| 382 PROGRESS_INDICATORS = { | 392 PROGRESS_INDICATORS = { |
| 383 'verbose': VerboseProgressIndicator, | 393 'verbose': VerboseProgressIndicator, |
| 384 'dots': DotsProgressIndicator, | 394 'dots': DotsProgressIndicator, |
| 385 'color': ColorProgressIndicator, | 395 'color': ColorProgressIndicator, |
| 386 'mono': MonochromeProgressIndicator | 396 'mono': MonochromeProgressIndicator |
| 387 } | 397 } |
| OLD | NEW |