Example #1
0
    def Extract(self, failure_log, *_):
        signal = FailureSignal()

        for line in reversed(failure_log.splitlines()):
            if line.startswith('FAILED'):  # pragma: no cover
                # This is where the failure message starts.
                # As we do reverse check, we should stop here.
                break

            # Extract files.
            for match in extractor_util.FILE_PATH_LINE_PATTERN.finditer(line):
                file_path, line_number = match.groups()
                signal.AddFile(extractor_util.NormalizeFilePath(file_path),
                               line_number)

        return signal
 def testAddFileWithoutLineNumber(self):
     signal = FailureSignal()
     signal.AddFile('a.cc', None)
     self.assertEqual({'a.cc': []}, signal.files)
 def testAddFileWithLineNumber(self):
     signal = FailureSignal()
     signal.AddFile('a.cc', 1)
     signal.AddFile('a.cc', 11)
     signal.AddFile('a.cc', 11)
     self.assertEqual({'a.cc': [1, 11]}, signal.files)