Changeset 106038 in webkit
- Timestamp:
- Jan 26, 2012 1:46:36 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r106035 r106038 1 2012-01-25 Ojan Vafai <ojan@chromium.org> 2 3 Parsing test_expecations.txt + Skipped lists takes too long 4 https://bugs.webkit.org/show_bug.cgi?id=77059 5 6 Reviewed by Dirk Pranke. 7 8 This saves ~100ms on the Apple Mac port. 9 -memoize a bunch of path methods. 10 -Avoid doing multiple disk accesses per line. 11 -Parse the skipped list directly instead of turning it into a test_expecations.txt 12 formatting string and parsing that. 13 14 * Scripts/webkitpy/layout_tests/models/test_expectations.py: 15 (TestExpectationParser): 16 (TestExpectationParser.parse_skipped_tests): 17 (TestExpectationParser._parse_line): 18 (TestExpectationParser._collect_matching_tests): 19 (TestExpectations.__init__): 20 (TestExpectations._add_skipped_tests): 21 * Scripts/webkitpy/layout_tests/port/base.py: 22 (Port): 23 (Port.test_isfile): 24 (Port.normalize_test_name): 25 (Port.layout_tests_dir): 26 (Port.abspath_for_test): 27 1 28 2012-01-25 Ojan Vafai <ojan@chromium.org> 2 29 -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
r105948 r106038 188 188 BUG_MODIFIER_REGEX = 'bug\d+' 189 189 REBASELINE_MODIFIER = 'rebaseline' 190 FAIL_EXPECTATION = 'fail' 190 191 SKIP_MODIFIER = 'skip' 191 192 SLOW_MODIFIER = 'slow' … … 206 207 return expectations 207 208 209 def expectation_for_skipped_test(self, test_name): 210 expectation_line = TestExpectationLine() 211 expectation_line.original_string = test_name 212 expectation_line.modifiers = [TestExpectationParser.SKIP_MODIFIER] 213 expectation_line.name = test_name 214 expectation_line.expectations = [TestExpectationParser.FAIL_EXPECTATION] 215 self._parse_line(expectation_line) 216 return expectation_line 217 208 218 def _parse_line(self, expectation_line): 209 219 if not expectation_line.name: … … 211 221 212 222 self._check_modifiers_against_expectations(expectation_line) 213 if self._check_path_does_not_exist(expectation_line): 223 224 expectation_line.is_file = self._port.test_isfile(expectation_line.name) 225 if not expectation_line.is_file and self._check_path_does_not_exist(expectation_line): 214 226 return 215 227 216 expectation_line.path = self._port.normalize_test_name(expectation_line.name) 228 if expectation_line.is_file: 229 expectation_line.path = expectation_line.name 230 else: 231 expectation_line.path = self._port.normalize_test_name(expectation_line.name) 232 217 233 self._collect_matching_tests(expectation_line) 218 234 … … 286 302 return 287 303 288 if self._port.test_isdir(expectation_line.path):304 if not expectation_line.is_file: 289 305 # this is a test category, return all the tests of the category. 290 306 expectation_line.matching_tests = [test for test in self._full_test_list if test.startswith(expectation_line.path)] … … 703 719 self._parser = TestExpectationParser(port, tests, is_lint_mode) 704 720 self._port = port 705 self._test_configuration_converter = TestConfigurationConverter(port.all_test_configurations(), port.configuration_specifier_macros())706 721 self._skipped_tests_warnings = [] 707 722 … … 836 851 if test.name and test.name in tests_to_skip: 837 852 self._skipped_tests_warnings.append(':%d %s is also in a Skipped file.' % (index, test.name)) 838 skipped_tests = '\n'.join(map(lambda test_path: 'BUG_SKIPPED SKIP : %s = FAIL' % test_path, tests_to_skip)) 839 for test in self._parser.parse(skipped_tests): 840 self._model.add_expectation_line(test, overrides_allowed=True) 853 for test_name in tests_to_skip: 854 self._model.add_expectation_line(self._parser.expectation_for_skipped_test(test_name), overrides_allowed=True) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py
r105644 r106038 519 519 self._filesystem.listdir(layout_tests_dir)) 520 520 521 @memoized 522 def test_isfile(self, test_name): 523 """Return True if the test name refers to a directory of tests.""" 524 # Used by test_expectations.py to apply rules to whole directories. 525 test_path = self.abspath_for_test(test_name) 526 return self._filesystem.isfile(test_path) 527 528 @memoized 521 529 def test_isdir(self, test_name): 522 530 """Return True if the test name refers to a directory of tests.""" … … 541 549 def normalize_test_name(self, test_name): 542 550 """Returns a normalized version of the test name or test directory.""" 543 if self.test_isdir(test_name) and not test_name.endswith('/'): 551 if test_name.endswith('/'): 552 return test_name 553 if self.test_isdir(test_name): 544 554 return test_name + '/' 545 555 return test_name … … 561 571 self._filesystem.write_binary_file(baseline_path, data) 562 572 573 @memoized 563 574 def layout_tests_dir(self): 564 575 """Return the absolute path to the top of the LayoutTests directory.""" 565 return self. path_from_webkit_base('LayoutTests')576 return self._filesystem.normpath(self.path_from_webkit_base('LayoutTests')) 566 577 567 578 def perf_tests_dir(self): … … 698 709 return filename[len(self.perf_tests_dir()) + 1:] 699 710 711 @memoized 700 712 def abspath_for_test(self, test_name): 701 713 """Returns the full path to the file for a given test name. This is the 702 714 inverse of relative_test_filename().""" 703 return self._filesystem. normpath(self._filesystem.join(self.layout_tests_dir(), test_name))715 return self._filesystem.join(self.layout_tests_dir(), test_name) 704 716 705 717 def results_directory(self):
Note: See TracChangeset
for help on using the changeset viewer.