def update_all_test_expectations_files(self, deleted_tests, renamed_tests):
     """Updates all test expectations files for tests that have been deleted or renamed."""
     port = self.host.port_factory.get()
     for path, file_contents in port.all_expectations_dict().iteritems():
         parser = TestExpectationParser(port, all_tests=None, is_lint_mode=False)
         expectation_lines = parser.parse(path, file_contents)
         self._update_single_test_expectations_file(path, expectation_lines, deleted_tests, renamed_tests)
    def check_test_expectations(self, expectations_str, tests=None):
        parser = TestExpectationParser(self._port_obj, tests, False)
        expectations = parser.parse('expectations', expectations_str)

        level = 5
        for expectation_line in expectations:
            for warning in expectation_line.warnings:
                self._handle_style_error(expectation_line.line_number,
                                         'test/expectations', level, warning)
Beispiel #3
0
 def __init__(self, tool, port):
     self._converter = TestConfigurationConverter(
         port.all_test_configurations(),
         port.configuration_specifier_macros())
     self._extrapolator = BuildCoverageExtrapolator(self._converter)
     self._parser = TestExpectationParser(port, [],
                                          allow_rebaseline_modifier=False)
     self._path_to_test_expectations_file = port.path_to_test_expectations_file(
     )
     self._tool = tool
Beispiel #4
0
 def _init_paths_from_expectations(self, file_path):
     if not self._filesystem.isfile(file_path):
         _log.warning('Unable to read import expectation file: %s' % file_path)
         return
     parser = TestExpectationParser(self._host.port_factory.get(), (), False)
     for line in parser.parse(file_path, self._filesystem.read_text_file(file_path)):
         if 'SKIP' in line.modifiers:
             self.paths_to_skip.append(line.name)
         elif 'PASS' in line.expectations:
             self.paths_to_import.append(line.name)
Beispiel #5
0
    def check_test_expectations(self, expectations_str, tests=None, overrides=None):
        # FIXME: we should pass in the filenames here if possible, and ensure
        # that this works with with cascading expectations files and remove the overrides param.
        parser = TestExpectationParser(self._port_obj, tests, False)
        expectations = parser.parse('expectations', expectations_str)
        if overrides:
            expectations += parser.parse('overrides', overrides)

        level = 5
        for expectation_line in expectations:
            for warning in expectation_line.warnings:
                self._handle_style_error(expectation_line.line_number, 'test/expectations', level, warning)
Beispiel #6
0
 def find_paths_to_skip(self):
     paths_to_skip = set()
     port = self.host.port_factory.get()
     w3c_import_expectations_path = self.webkit_finder.path_from_webkit_base('LayoutTests', 'W3CImportExpectations')
     w3c_import_expectations = self.filesystem.read_text_file(w3c_import_expectations_path)
     parser = TestExpectationParser(port, all_tests=(), is_lint_mode=False)
     expectation_lines = parser.parse(w3c_import_expectations_path, w3c_import_expectations)
     for line in expectation_lines:
         if 'SKIP' in line.expectations:
             if line.specifiers:
                 _log.warning('W3CImportExpectations:%s should not have any specifiers', line.line_numbers)
                 continue
             paths_to_skip.add(line.name)
     return paths_to_skip
Beispiel #7
0
 def print_stale_tests(self):
     port = self.host.port_factory.get()
     expectations = port.expectations_dict()
     parser = TestExpectationParser(port, all_tests=(), is_lint_mode=False)
     expectations_file, expectations_contents = expectations.items()[0]
     expectation_lines = parser.parse(expectations_file,
                                      expectations_contents)
     csv_rows = []
     for line in expectation_lines:
         row = self.check_expectations_line(line)
         if row:
             csv_rows.append(row)
     if self.csv_filename:
         self.write_csv(csv_rows)
Beispiel #8
0
 def execute(self, options, args, tool):
     port = tool.port_factory.get(
         "chromium-win-win7")  # FIXME: This should be selectable.
     expectation_lines = TestExpectationParser.tokenize_list(
         port.test_expectations())
     parser = TestExpectationParser(port, [],
                                    allow_rebaseline_modifier=False)
     for expectation_line in expectation_lines:
         parser.parse(expectation_line)
     converter = TestConfigurationConverter(
         port.all_test_configurations(),
         port.configuration_specifier_macros())
     tool.filesystem.write_text_file(
         port.path_to_test_expectations_file(),
         TestExpectationSerializer.list_to_string(expectation_lines,
                                                  converter))