Esempio n. 1
0
    def testGetSuspectedCLConfidenceScoreAndApproachUseLessTest(self):
        build = {
            'failure_type': failure_type.TEST,
            'failures': {
                'a': ['t1']
            },
            'status': suspected_cl_status.CORRECT,
            'approaches': [analysis_approach_type.HEURISTIC],
            'top_score': 5
        }

        first_build = {
            'failure_type':
            failure_type.TEST,
            'failures': {
                'a': ['t1', 't2']
            },
            'status':
            suspected_cl_status.CORRECT,
            'approaches':
            [analysis_approach_type.TRY_JOB, analysis_approach_type.HEURISTIC],
            'top_score':
            5
        }

        confidence, approach = (
            suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach(
                self.cl_confidences, build, first_build))

        self.assertEqual(
            suspected_cl_util._RoundConfidentToInteger(
                self.cl_confidences.test_heuristic_try_job.confidence),
            confidence)
        self.assertEqual(analysis_approach_type.TRY_JOB, approach)
Esempio n. 2
0
    def testGetSuspectedCLConfidenceScoreAndApproachUseFirstBuild(self):
        build = {
            'failure_type': failure_type.COMPILE,
            'failures': None,
            'status': suspected_cl_status.CORRECT,
            'approaches': [analysis_approach_type.TRY_JOB],
            'top_score': 5
        }

        first_build = {
            'failure_type':
            failure_type.COMPILE,
            'failures':
            None,
            'status':
            suspected_cl_status.CORRECT,
            'approaches':
            [analysis_approach_type.TRY_JOB, analysis_approach_type.HEURISTIC],
            'top_score':
            5
        }

        confidence, approach = (
            suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach(
                self.cl_confidences, build, first_build))

        self.assertEqual(
            suspected_cl_util._RoundConfidentToInteger(
                self.cl_confidences.compile_heuristic_try_job.confidence),
            confidence)
        self.assertEqual(analysis_approach_type.TRY_JOB, approach)
Esempio n. 3
0
    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))
Esempio n. 4
0
    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))