OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import collections | 6 import collections |
7 import glob | 7 import glob |
8 import hashlib | 8 import hashlib |
9 import json | 9 import json |
10 import multiprocessing | 10 import multiprocessing |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 def _ParseLayoutTestResults(results): | 316 def _ParseLayoutTestResults(results): |
317 """Extract the failures from the test run.""" | 317 """Extract the failures from the test run.""" |
318 # Cloned from third_party/WebKit/Tools/Scripts/print-json-test-results | 318 # Cloned from third_party/WebKit/Tools/Scripts/print-json-test-results |
319 tests = _ConvertTrieToFlatPaths(results['tests']) | 319 tests = _ConvertTrieToFlatPaths(results['tests']) |
320 failures = {} | 320 failures = {} |
321 flakes = {} | 321 flakes = {} |
322 passes = {} | 322 passes = {} |
323 for (test, result) in tests.iteritems(): | 323 for (test, result) in tests.iteritems(): |
324 if result.get('is_unexpected'): | 324 if result.get('is_unexpected'): |
325 actual_result = result['actual'] | 325 actual_results = result['actual'].split() |
326 if ' PASS' in actual_result: | 326 expected_results = result['expected'].split() |
327 flakes[test] = actual_result | 327 if len(actual_results) > 1: |
328 elif actual_result == 'PASS': | 328 # We report the first failure type back, even if the second |
| 329 # was more severe. |
| 330 if actual_results[1] in expected_results: |
| 331 flakes[test] = actual_results[0] |
| 332 else: |
| 333 failures[test] = actual_results[0] |
| 334 elif actual_results[0] == 'PASS': |
329 passes[test] = result | 335 passes[test] = result |
330 else: | 336 else: |
331 failures[test] = actual_result | 337 failures[test] = actual_results[0] |
332 | 338 |
333 return (passes, failures, flakes) | 339 return (passes, failures, flakes) |
334 | 340 |
335 | 341 |
336 def _ConvertTrieToFlatPaths(trie, prefix=None): | 342 def _ConvertTrieToFlatPaths(trie, prefix=None): |
337 """Flatten the trie of failures into a list.""" | 343 """Flatten the trie of failures into a list.""" |
338 # Cloned from third_party/WebKit/Tools/Scripts/print-json-test-results | 344 # Cloned from third_party/WebKit/Tools/Scripts/print-json-test-results |
339 result = {} | 345 result = {} |
340 for name, data in trie.iteritems(): | 346 for name, data in trie.iteritems(): |
341 if prefix: | 347 if prefix: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 594 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
589 if options.coverage_bucket: | 595 if options.coverage_bucket: |
590 setattr(options, 'coverage_dir', | 596 setattr(options, 'coverage_dir', |
591 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 597 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
592 | 598 |
593 MainTestWrapper(options) | 599 MainTestWrapper(options) |
594 | 600 |
595 | 601 |
596 if __name__ == '__main__': | 602 if __name__ == '__main__': |
597 sys.exit(main(sys.argv)) | 603 sys.exit(main(sys.argv)) |
OLD | NEW |