Changeset 205476 in webkit
- Timestamp:
- Sep 6, 2016 5:30:51 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205473 r205476 1 2016-09-06 Youenn Fablet <youenn@apple.com> 2 3 W3C test importer should be able to identify slow test 4 https://bugs.webkit.org/show_bug.cgi?id=161601 5 6 Reviewed by Darin Adler. 7 8 * tests-options.json: Added. 9 1 10 2016-09-06 Youenn Fablet <youenn@apple.com> 2 11 -
trunk/Tools/ChangeLog
r205472 r205476 1 2016-09-06 Youenn Fablet <youenn@apple.com> 2 3 W3C test importer should be able to identify slow test 4 https://bugs.webkit.org/show_bug.cgi?id=161601 5 6 Reviewed by Darin Adler. 7 8 Test parser is now identifying slow tests based on "meta element name=timeout content=long" elements. 9 Test importer is updating test-options.json file according that information. 10 11 In case of clean import, the test-options.json is cleaned from 'slow' options for all W3C tests. 12 13 * Scripts/webkitpy/w3c/test_importer.py: 14 (TestImporter.__init__): 15 (TestImporter.find_importable_tests): 16 (TestImporter.import_tests): 17 (TestImporter.update_test_options): 18 (TestImporter): 19 (TestImporter.remove_slow_from_w3c_test_options): 20 * Scripts/webkitpy/w3c/test_parser.py: 21 (TestParser.analyze_test): 22 (TestParser.is_slow_test): 23 (TestParser.potential_ref_filename): 24 1 25 2016-09-06 Per Arne Vollan <pvollan@apple.com> 2 26 -
trunk/Tools/Scripts/webkitpy/w3c/test_importer.py
r205453 r205476 169 169 self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination) 170 170 self.tests_w3c_relative_path = self.filesystem.join('imported', 'w3c') 171 self.layout_tests_w3c_path = webkit_finder.path_from_webkit_base('LayoutTests', self.tests_w3c_relative_path) 171 self.layout_tests_path = webkit_finder.path_from_webkit_base('LayoutTests') 172 self.layout_tests_w3c_path = self.filesystem.join(self.layout_tests_path, self.tests_w3c_relative_path) 172 173 self.tests_download_path = webkit_finder.path_from_webkit_base('WebKitBuild', 'w3c-tests') 173 174 … … 181 182 self._test_resource_files_json_path = self.filesystem.join(self.layout_tests_w3c_path, "resources", "resource-files.json") 182 183 self._test_resource_files = json.loads(self.filesystem.read_text_file(self._test_resource_files_json_path)) if self.filesystem.exists(self._test_resource_files_json_path) else None 184 185 self._tests_options_json_path = self.filesystem.join(self.layout_tests_path, 'tests-options.json') 186 self._tests_options = json.loads(self.filesystem.read_text_file(self._tests_options_json_path)) if self.filesystem.exists(self._tests_options_json_path) else None 187 self._slow_tests = [] 188 183 189 if self.options.clean_destination_directory and self._test_resource_files: 184 190 self._test_resource_files["files"] = [] 191 if self._tests_options: 192 self.remove_slow_from_w3c_tests_options() 185 193 186 194 def do_import(self): … … 305 313 elif self._is_in_resources_directory(fullpath): 306 314 _log.warning('%s is a test located in a "resources" folder. This test will be skipped by WebKit test runners.', fullpath) 315 316 if 'slow' in test_info: 317 self._slow_tests.append(fullpath) 307 318 308 319 if 'manualtest' in test_info.keys(): … … 481 492 self.filesystem.write_text_file(self._test_resource_files_json_path, json.dumps(self._test_resource_files, sort_keys=True, indent=4).replace(' \n', '\n')) 482 493 494 if self._tests_options: 495 self.update_tests_options() 496 483 497 def _already_identified_as_resource_file(self, path): 484 498 if path in self._test_resource_files["files"]: … … 488 502 def _is_in_resources_directory(self, path): 489 503 return "resources" in path.split(self.filesystem.sep) 504 505 def update_tests_options(self): 506 should_update = self.options.clean_destination_directory 507 for full_path in self._slow_tests: 508 w3c_test_path = self.filesystem.relpath(full_path, self.source_directory) 509 # No need to mark tests as slow if they are in skipped directories 510 if self._already_identified_as_resource_file(w3c_test_path): 511 continue 512 513 test_path = self.filesystem.join(self.tests_w3c_relative_path, w3c_test_path) 514 options = self._tests_options.get(test_path, []) 515 if not 'slow' in options: 516 options.append('slow') 517 self._tests_options[test_path] = options 518 should_update = True 519 520 if should_update: 521 self.filesystem.write_text_file(self._tests_options_json_path, json.dumps(self._tests_options, sort_keys=True, indent=4).replace(' \n', '\n')) 522 523 def remove_slow_from_w3c_tests_options(self): 524 for test_path in self._tests_options.keys(): 525 if self.tests_w3c_relative_path in test_path: 526 options = self._tests_options[test_path] 527 options.remove('slow') 528 if not options: 529 self._tests_options.pop(test_path) 490 530 491 531 def remove_deleted_files(self, import_directory, new_file_list): -
trunk/Tools/Scripts/webkitpy/w3c/test_parser.py
r191380 r205476 126 126 test_info = {'test': self.filename} 127 127 128 if test_info and self.is_slow_test(): 129 test_info['slow'] = True 130 128 131 return test_info 129 132 … … 139 142 return self.filename.endswith('-manual.htm') or self.filename.endswith('-manual.html') 140 143 144 def is_slow_test(self): 145 return any([match.name == 'meta' and match['name'] == 'timeout' for match in self.test_doc.findAll(content='long')]) 146 141 147 def potential_ref_filename(self): 142 148 parts = self.filesystem.splitext(self.filename) 143 return 149 return parts[0] + '-ref' + parts[1] 144 150 145 151 def is_wpt_reftest(self):
Note: See TracChangeset
for help on using the changeset viewer.