OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import argparse | 5 import argparse |
6 import contextlib | 6 import contextlib |
7 import json | 7 import json |
8 import os | 8 import os |
9 import subprocess | 9 import subprocess |
10 import tempfile | 10 import tempfile |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 @contextlib.contextmanager | 58 @contextlib.contextmanager |
59 def temporary_file(): | 59 def temporary_file(): |
60 fd, path = tempfile.mkstemp() | 60 fd, path = tempfile.mkstemp() |
61 os.close(fd) | 61 os.close(fd) |
62 try: | 62 try: |
63 yield path | 63 yield path |
64 finally: | 64 finally: |
65 os.remove(path) | 65 os.remove(path) |
66 | 66 |
67 | 67 |
68 def parse_common_test_results(json_results): | 68 def parse_common_test_results(json_results, test_separator='/'): |
69 def convert_trie_to_flat_paths(trie, prefix=None): | 69 def convert_trie_to_flat_paths(trie, prefix=None): |
70 # Also see webkitpy.layout_tests.layout_package.json_results_generator | 70 # Also see webkitpy.layout_tests.layout_package.json_results_generator |
71 result = {} | 71 result = {} |
72 for name, data in trie.iteritems(): | 72 for name, data in trie.iteritems(): |
73 if prefix: | 73 if prefix: |
74 name = prefix + '/' + name | 74 name = prefix + test_separator + name |
75 if len(data) and not 'actual' in data and not 'expected' in data: | 75 if len(data) and not 'actual' in data and not 'expected' in data: |
76 result.update(convert_trie_to_flat_paths(data, name)) | 76 result.update(convert_trie_to_flat_paths(data, name)) |
77 else: | 77 else: |
78 result[name] = data | 78 result[name] = data |
79 return result | 79 return result |
80 | 80 |
81 results = { | 81 results = { |
82 'passes': {}, | 82 'passes': {}, |
83 'unexpected_passes': {}, | 83 'unexpected_passes': {}, |
84 'failures': {}, | 84 'failures': {}, |
(...skipping 23 matching lines...) Expand all Loading... |
108 key += 'passes' | 108 key += 'passes' |
109 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result | 109 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result |
110 # instead of actual_result here. Do we even need these things to be | 110 # instead of actual_result here. Do we even need these things to be |
111 # hashes, or just lists? | 111 # hashes, or just lists? |
112 data = result | 112 data = result |
113 else: | 113 else: |
114 key += 'failures' | 114 key += 'failures' |
115 results[key][test] = data | 115 results[key][test] = data |
116 | 116 |
117 return results | 117 return results |
OLD | NEW |