def _GetAllSuspectedCLsAndCheckStatus(master_name, builder_name, build_number, analysis): build_key = build_util.CreateBuildId(master_name, builder_name, build_number) suspected_cls = copy.deepcopy(analysis.suspected_cls) if not suspected_cls: return [] confidences = SuspectedCLConfidence.Get() for cl in suspected_cls: cl['status'] = _ANALYSIS_CL_STATUS_MAP.get(analysis.result_status, None) cl['confidence'] = None suspected_cl = WfSuspectedCL.Get(cl['repo_name'], cl['revision']) if not suspected_cl: continue build = suspected_cl.builds.get(build_key) if build: cl['status'] = build['status'] cl['confidence'] = '%d%%' % ( suspected_cl_util.GetSuspectedCLConfidenceScore( confidences, build)) return suspected_cls
def testGetConfidenceScoreUnexpectedTest(self): build = { 'failure_type': failure_type.TEST, 'failures': None, 'status': suspected_cl_status.CORRECT, 'approaches': [analysis_approach_type.HEURISTIC], 'top_score': 2 } self.assertIsNone( suspected_cl_util.GetSuspectedCLConfidenceScore( self.cl_confidences, build))
def testGetConfidenceScoreCompileTryJob(self): build = { 'failure_type': failure_type.COMPILE, 'failures': None, 'status': suspected_cl_status.CORRECT, 'approaches': [analysis_approach_type.TRY_JOB], 'top_score': 5 } self.assertEqual( suspected_cl_util._RoundConfidentToInteger( self.cl_confidences.test_try_job.confidence), suspected_cl_util.GetSuspectedCLConfidenceScore( self.cl_confidences, build))
def testGetConfidenceScoreCompileHeuristic(self): build = { 'failure_type': failure_type.COMPILE, 'failures': None, 'status': suspected_cl_status.CORRECT, 'approaches': [analysis_approach_type.HEURISTIC], 'top_score': 4 } self.assertEqual( suspected_cl_util._RoundConfidentToInteger( self.cl_confidences.compile_heuristic[1].confidence), suspected_cl_util.GetSuspectedCLConfidenceScore( self.cl_confidences, build))
def testGetConfidenceScoreTestNone(self): build = {'failure_type': failure_type.TEST, 'approaches': []} self.assertIsNone( suspected_cl_util.GetSuspectedCLConfidenceScore( self.cl_confidences, build))
def testGetConfidenceScoreNone(self): self.assertIsNone( suspected_cl_util.GetSuspectedCLConfidenceScore(None, None))