Beispiel #1
0
    def _ExtractNinjaOutputJson(self, ninja_output, bot_name, master_name):
        signal = FailureSignal()
        strict_regex = waterfall_config.EnableStrictRegexForCompileLinkFailures(
            master_name, bot_name)
        failed_output_nodes = []
        for failure in ninja_output['failures']:
            lines = failure['output'].splitlines()
            del failure['output']
            failure['dependencies'] = map(extractor_util.NormalizeFilePath,
                                          failure['dependencies'])
            signal.AddEdge(failure)
            if lines:
                if strict_regex:
                    self.ExtractFailedOutputNodes(lines[0], signal)
                else:
                    self.GetFailedTarget(lines[0], signal)
                for line in lines[1:]:
                    self.ExtractFiles(line, signal)
            failed_output_nodes.extend(failure['output_nodes'])

        signal.failed_output_nodes = sorted(set(failed_output_nodes))
        return signal
Beispiel #2
0
    def Extract(self, failure_log, test_name, step_name, bot_name,
                master_name):
        signal = FailureSignal()
        failure_started = False
        is_build_command_line = False
        failed_output_nodes = []

        if (master_name == self.MAC_MASTER_NAME_FOR_COMPILE
                and bot_name in self.IOS_BUILDER_NAMES_FOR_COMPILE):
            error_lines = []
            for line in reversed(failure_log.splitlines()):
                if (not failure_started
                        and self.ERROR_LINE_END_PATTERN1.match(line)):
                    failure_started = True
                    continue

                if failure_started:
                    if line.startswith(self.IOS_ERROR_LINE_START_PREFIX):
                        failure_started = False
                        for l in error_lines[:-4]:
                            self.ExtractFiles(l, signal)
                        error_lines = []
                    else:
                        error_lines.append(line)
        else:
            strict_regex = waterfall_config.EnableStrictRegexForCompileLinkFailures(
                master_name, bot_name)
            for line in failure_log.splitlines():
                if line.startswith(self.FAILURE_START_LINE_PREFIX):
                    if not failure_started:
                        failure_started = True
                    line = line[len(self.FAILURE_START_LINE_PREFIX):]
                    failed_output_nodes.extend(
                        self._GetFailedOutputNodes(line))
                    is_build_command_line = True
                    continue
                elif is_build_command_line:
                    if strict_regex:
                        self.ExtractFailedOutputNodes(line, signal)
                    else:
                        self.GetFailedTarget(line, signal)
                    is_build_command_line = False
                    continue
                elif self.FAILURE_WITH_ERROR_PATTERN.match(line):
                    # It is possible the target and source file associated with a compile
                    # failure is logged outside a 'FAILED: ... 1 error generated' block,
                    # so extract targets regardless of failure_started.
                    if not strict_regex:
                        self.GetFailedTarget(line, signal)
                elif (failure_started
                      and (self.ERROR_LINE_END_PATTERN1.match(line)
                           or self.ERROR_LINE_END_PATTERN2.search(line)
                           or self.OUTSIDE_FAILURE_LINE_PATTERN.match(line))):
                    failure_started = False
                elif failure_started and line.startswith(
                        self.NINJA_FAILURE_END_LINE_PREFIX
                ):  # pragma: no cover
                    break

                if failure_started or line.startswith(
                        self.NINJA_ERROR_LINE_PREFIX):
                    # either within the compile errors or is a ninja error.
                    self.ExtractFiles(line, signal)

        signal.failed_output_nodes = sorted(set(failed_output_nodes))
        return signal