def testAnalyzeOneCLShouldNotBlameChange(self):
     change_log = ChangeLogFromDict(
         {'author': {
             'email': NO_BLAME_ACTION_ACCOUNTS[0]
         }})
     result, max_score = build_failure_analysis.AnalyzeOneCL(
         123, {}, change_log, {})
     self.assertIsNone(result)
     self.assertIsNone(max_score)
 def testAnalyzeOneCL(self, mock_check_files, mock_info_dict):
     build_number = 123
     justification = build_failure_analysis._Justification()
     justification._score = 1
     justification._hints = {'hint': 1}
     mock_check_files.return_value = justification
     mock_info_dict.return_value = {
         'build_number': build_number,
         'repo_name': 'chromium',
         'revision': 'rev',
         'commit_position': 123,
         'url': 'url',
         'score': 1,
         'hints': {
             'hint': 1
         }
     }
     _, max_score = build_failure_analysis.AnalyzeOneCL(
         build_number, {}, {}, {})
     self.assertEqual(1, max_score)
def _AnalyzeTestFailureOnOneBuild(build_number,
                                  step_name,
                                  test_name,
                                  failure_signal,
                                  change_log,
                                  deps_info,
                                  step_analysis_result,
                                  cl_failure_map,
                                  has_lower_level_info=False):

  new_suspected_cl_dict, max_score = build_failure_analysis.AnalyzeOneCL(
      build_number, failure_signal, change_log, deps_info)

  if not new_suspected_cl_dict:
    return

  step_analysis_result['suspected_cls'].append(new_suspected_cl_dict)

  if not has_lower_level_info:
    build_failure_analysis.SaveFailureToMap(
        cl_failure_map, new_suspected_cl_dict, step_name, test_name, max_score)
Exemple #4
0
def _Analyze(start_build_number,
             failed_build_number,
             builds,
             step_name,
             failure_signal,
             change_logs,
             deps_info,
             step_analysis_result,
             cl_failure_map,
             use_ninja_output=False):

  for build_number, build in builds.iteritems():
    if (build_number > failed_build_number or
        build_number < start_build_number):
      continue

    for revision in build.blame_list:
      # TODO(crbug/842980): Deprecate blame_list in builds.
      if not change_logs.get(revision):
        continue

      new_suspected_cl_dict, max_score = build_failure_analysis.AnalyzeOneCL(
          build_number, failure_signal, change_logs[revision], deps_info,
          use_ninja_output)

      if not new_suspected_cl_dict:
        continue

      if use_ninja_output:
        step_analysis_result['new_compile_suspected_cls'].append(
            new_suspected_cl_dict)
      else:
        step_analysis_result['suspected_cls'].append(new_suspected_cl_dict)

        build_failure_analysis.SaveFailureToMap(
            cl_failure_map, new_suspected_cl_dict, step_name, None, max_score)
 def testAnalyzeOneCLNotSuspected(self, _):
     build_number = 123
     result, max_score = build_failure_analysis.AnalyzeOneCL(
         build_number, {}, {}, {})
     self.assertIsNone(result)
     self.assertIsNone(max_score)