Changeset 87080 in webkit
- Timestamp:
- May 23, 2011 10:56:03 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r87078 r87080 1 2011-05-23 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r87078. 4 http://trac.webkit.org/changeset/87078 5 https://bugs.webkit.org/show_bug.cgi?id=61294 6 7 Patch contains errors and seems likely to break a bunch of 8 bots (Requested by abarth on #webkit). 9 10 * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py: 11 * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py: 12 * Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py: 13 1 14 2011-05-23 Alice Boxhall <aboxhall@chromium.org> 2 15 -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
r87078 r87080 131 131 132 132 # override 133 def _convert_json_to_current_version(self, results_json): 134 archive_version = None 135 if self.VERSION_KEY in results_json: 136 archive_version = results_json[self.VERSION_KEY] 137 138 super(JSONLayoutResultsGenerator, 139 self)._convert_json_to_current_version(results_json) 140 141 # version 2->3 142 if archive_version == 2: 143 for results_for_builder in results_json.itervalues(): 144 try: 145 test_results = results_for_builder[self.TESTS] 146 except: 147 continue 148 149 for test in test_results: 150 # Make sure all paths are relative 151 test_path = self._get_path_relative_to_layout_test_root(test) 152 if test_path != test: 153 test_results[test_path] = test_results[test] 154 del test_results[test] 155 156 # override 133 157 def _insert_failure_summaries(self, results_for_builder): 134 158 summary = self._result_summary -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
r87078 r87080 68 68 filesystem.write_text_file(file_path, json_string) 69 69 70 71 def convert_trie_to_flat_paths(trie, prefix=None):72 """Flattens a trie directory structure into a flat structure.73 74 Args:75 trie: trie structure.76 prefix: aleady-computed path to prepend to the eventual path, if any.77 78 Returns:79 The flattened directory structure.80 """81 result = {}82 for name, data in trie.iteritems():83 if prefix:84 fullname = prefix + "/" + name85 else:86 fullname = name87 88 if not isinstance(data, dict) or not len(data) or "results" in data:89 result[fullname] = data90 else:91 result.update(convert_trie_to_flat_paths(data, fullname))92 93 return result94 95 96 def add_path_to_trie(path, value, trie):97 """Inserts a single flat path key and value into a trie structure.98 99 Args:100 path: the path to parse.101 value: the data value to insert into the trie.102 trie: the trie into which to insert the path and value.103 """104 if not "/" in path:105 trie[path] = value106 return107 108 directory, slash, rest = path.partition("/")109 if not directory in trie:110 trie[directory] = {}111 add_path_to_trie(rest, value, trie[directory])112 113 70 def test_timings_trie(port, individual_test_timings): 114 71 """Breaks a filename into chunks by directory and puts the test time as a value in the lowest part, e.g. … … 132 89 test = test_result.filename 133 90 134 add_path_to_trie(test, int(1000 * test_result.test_run_time), trie) 135 91 parts = test.split('/') 92 current_map = trie 93 for i, part in enumerate(parts): 94 if i == (len(parts) - 1): 95 current_map[part] = int(1000 * test_result.test_run_time) 96 break 97 98 if part not in current_map: 99 current_map[part] = {} 100 current_map = current_map[part] 136 101 return trie 137 102 … … 189 154 TestResult.FLAKY: FLAKY_RESULT} 190 155 191 VERSION = 4156 VERSION = 3 192 157 VERSION_KEY = "version" 193 158 RESULTS = "results" … … 307 272 tests = results_for_builder[self.TESTS] 308 273 all_failing_tests = self._get_failed_test_names() 309 all_failing_tests.update(convert_trie_to_flat_paths(tests)) 310 274 all_failing_tests.update(tests.iterkeys()) 311 275 for test in all_failing_tests: 312 276 self._insert_test_time_and_result(test, tests) … … 549 513 self.TIME) 550 514 551 552 515 def _insert_test_time_and_result(self, test_name, tests): 553 516 """ Insert a test item with its results to the given tests dictionary. … … 560 523 time = self._get_test_timing(test_name) 561 524 562 thisTest = tests 563 for segment in test_name.split("/"): 564 if segment not in thisTest: 565 thisTest[segment] = {} 566 thisTest = thisTest[segment] 567 568 if not len(thisTest): 569 self._populate_results_and_times_json(thisTest) 570 525 if test_name not in tests: 526 tests[test_name] = self._create_results_and_times_json() 527 528 thisTest = tests[test_name] 571 529 if self.RESULTS in thisTest: 572 530 self._insert_item_run_length_encoded(result, thisTest[self.RESULTS]) … … 583 541 current version and adds in the new version number. 584 542 """ 585 if self.VERSION_KEY in results_json: 586 archive_version = results_json[self.VERSION_KEY] 587 if archive_version == self.VERSION: 588 return 589 else: 590 archive_version = 3 591 592 # version 3->4 593 if archive_version == 3: 594 num_results = len(results_json.values()) 595 for builder, results in results_json.iteritems(): 596 if not self.TESTS in results: 597 continue 598 599 test_results = results[self.TESTS] 600 test_results_trie = {} 601 for test in test_results.iterkeys(): 602 test_path = self._get_path_relative_to_layout_test_root(test) 603 single_test_result = test_results[test] 604 add_path_to_trie(test_path, single_test_result, test_results_trie) 605 606 results[self.TESTS] = test_results_trie 543 if (self.VERSION_KEY in results_json and 544 results_json[self.VERSION_KEY] == self.VERSION): 545 return 607 546 608 547 results_json[self.VERSION_KEY] = self.VERSION 609 548 610 def _populate_results_and_times_json(self, results_and_times): 549 def _create_results_and_times_json(self): 550 results_and_times = {} 611 551 results_and_times[self.RESULTS] = [] 612 552 results_and_times[self.TIMES] = [] -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py
r87078 r87080 157 157 tests = buildinfo[JRG.TESTS] 158 158 for test_name in failed_count_map.iterkeys(): 159 test = self._find_test_in_trie(test_name, tests) 159 self.assertTrue(test_name in tests) 160 test = tests[test_name] 160 161 161 162 failed = 0 … … 173 174 if fixable_count: 174 175 self.assertEqual(sum(buildinfo[JRG.FIXABLE_COUNT]), fixable_count) 175 176 def _find_test_in_trie(self, path, trie):177 sub_trie = trie178 nodes = path.split("/")179 for node in nodes:180 self.assertTrue(node in sub_trie)181 sub_trie = sub_trie[node]182 return sub_trie183 176 184 177 def test_json_generation(self): … … 204 197 ['FLAKY_B', 'DISABLED_C', 'FAILS_D'], 205 198 ['A', 'FLAKY_E']) 206 207 def test_hierarchical_json_generation(self):208 # FIXME(aboxhall): re-work tests to be more comprehensible and comprehensive.209 self._test_json_generation(['foo/A'], ['foo/B', 'bar/C'])210 199 211 200 def test_test_timings_trie(self):
Note: See TracChangeset
for help on using the changeset viewer.