コード例 #1
0
 def testInfraStep(self):
     step = Step()
     step.name = 'infra'
     log = step.logs.add()
     log.name = 'report'
     self.assertEqual(StepTypeEnum.INFRA,
                      ChromiumProjectAPI().ClassifyStepType(None, step))
コード例 #2
0
 def testCompileStep(self):
     step = Step()
     step.name = 'compile'
     log = step.logs.add()
     log.name = 'stdout'
     self.assertEqual(StepTypeEnum.COMPILE,
                      ChromiumProjectAPI().ClassifyStepType(None, step))
コード例 #3
0
 def testTestStep(self):
     step = Step()
     step.name = 'browser_tests'
     log = step.logs.add()
     log.name = 'step_metadata'
     self.assertEqual(StepTypeEnum.TEST,
                      ChromiumProjectAPI().ClassifyStepType(None, step))
コード例 #4
0
ファイル: chromium_api_test.py プロジェクト: xinghun61/infra
 def testGetTestRerunBuildInputProperties(self, mock_bb):
     mock_bb.return_value = self._CreateBuildbucketBuild(
         800000009999, 9999, 'chromium.linux', 'Linux Tests')
     props = ChromiumProjectAPI().GetTestRerunBuildInputProperties(
         {
             'complexitor_tests': {
                 'tests': [
                     {
                         'name': 'TestTrueNatureOf42',
                         'properties': {
                             'ignored': 'at the moment'
                         }
                     },
                     {
                         'name': 'ValidateFTLCommunication',
                         'properties': {
                             'ignored': 'also'
                         }
                     },
                 ],
                 'properties': {
                     'this is': 'ignored',
                 },
             },
         }, 800000009999)
     self.assertEqual(props['target_builder'], {
         'master': 'chromium.linux',
         'builder': 'Linux Tests'
     })
     self.assertEqual(props['mastername'], 'chromium.linux')
     self.assertEqual(
         props['tests'], {
             'complexitor_tests':
             ['TestTrueNatureOf42', 'ValidateFTLCommunication']
         })
コード例 #5
0
ファイル: chromium_api_test.py プロジェクト: xinghun61/infra
 def testGetCompileRerunBuildInputProperties(self, mock_bb):
     mock_bb.return_value = self._CreateBuildbucketBuild(
         800000001234, 1234, 'chromium.linux', 'Linux Builder')
     props = ChromiumProjectAPI().GetCompileRerunBuildInputProperties(
         {'compile': ['bad_target1', 'bad_tests']}, 800000001234)
     self.assertEqual(props['target_builder'], {
         'master': 'chromium.linux',
         'builder': 'Linux Builder'
     })
     self.assertEqual(props['mastername'], 'chromium.linux')
     self.assertEqual(sorted(props['compile_targets']),
                      ['bad_target1', 'bad_tests'])
コード例 #6
0
ファイル: chromium_api_test.py プロジェクト: xinghun61/infra
 def testCompileHeuristicAnalysis(self, mock_analyze):
     # Ensure that the output of this api is in the following format:
     # map from ('step', frozenset['target1']) -> {'revision', 'commit_position',
     # 'hints': {'hint' -> score}
     mock_analyze.return_value = ({
         'failures': [
             {
                 'step_name':
                 'compile',
                 'supported':
                 True,
                 'first_failure':
                 230,
                 'last_pass':
                 229,
                 'suspected_cls': [
                     {
                         'build_number': 230,
                         'repo_name': 'chromium',
                         'revision': 'a_git_hash',
                         'commit_position': 56789,
                         'score': 11,
                         'hints': {
                             'add a/b/x.cc': 5,
                             'delete a/b/y.cc': 5,
                             'modify e/f/z.cc': 1,
                         }
                     },
                 ],
             },
         ]
     }, None)
     self.assertEqual(
         {
             ('compile', frozenset([])): [{
                 'commit_position': 56789,
                 'hints': {
                     'add a/b/x.cc': 5,
                     'delete a/b/y.cc': 5,
                     'modify e/f/z.cc': 1
                 },
                 'revision': 'a_git_hash'
             }]
         },
         ChromiumProjectAPI().HeuristicAnalysisForCompile(
             # These are passed as-is to the compile_failure_analysis module,
             # tested elsewhere.
             None,
             None,
             None,
             None))
コード例 #7
0
ファイル: chromium_api_test.py プロジェクト: xinghun61/infra
    def testGetCompileFailures(self, mock_get_log):
        build_id = 8765432109123
        build_number = 123
        build = self._CreateBuildbucketBuild(build_id, build_number)

        step_name = 'compile'
        log = Log()
        log.name = 'json.output[ninja_info]'
        log.view_url = 'https://dummy/path'
        step = Step()
        step.name = step_name
        step.logs.extend([log])
        build.steps.extend([step])
        mock_get_log.return_value = {
            'failures': [{
                'output': '...some very long \n multi-line \n string',
                'output_nodes': [
                    'broken_target1',
                    'broken_target2',
                ],
                'rule': 'ACTION',
            }],
        }
        expected_response = {
            'compile': {
                'failures': {
                    frozenset(['broken_target1', 'broken_target2']): {
                        'properties': {
                            'rule': 'ACTION'
                        },
                        'first_failed_build': {
                            'commit_id': 'git_sha',
                            'id': 8765432109123,
                            'number': 123,
                        },
                        'last_passed_build': None
                    }
                },
                'first_failed_build': {
                    'commit_id': 'git_sha',
                    'id': 8765432109123,
                    'number': 123,
                },
                'last_passed_build': None
            }
        }

        self.assertEqual(
            expected_response,
            ChromiumProjectAPI().GetCompileFailures(build, [step]))
コード例 #8
0
ファイル: chromium_api_test.py プロジェクト: xinghun61/infra
 def testGetRerunDimensions(self, mock_bb):
     mock_bb.return_value = self._CreateBuildbucketBuild(
         800000009999,
         9999,
         'chromium.linux',
         'Linux Tests',
         dimensions=[{
             'key': 'os',
             'value': 'Mac',
         }, {
             'key': 'cpu',
             'value': 'x86',
         }, {
             'key': 'ssd',
             'value': '1',
         }],
     )
     dimensions = ChromiumProjectAPI().GetRerunDimensions(800000009999)
     self.assertEqual(dimensions, [{'key': 'os', 'value': 'Mac'}])
コード例 #9
0
ファイル: chromium_api_test.py プロジェクト: xinghun61/infra
    def testGetCompileFailuresEmptyNinjaInfo(self, mock_get_log):
        build_id = 8765432109123
        build_number = 123
        build = self._CreateBuildbucketBuild(build_id, build_number)

        step_name = 'compile'
        log = Log()
        log.name = 'json.output[ninja_info]'
        log.view_url = 'https://dummy/path'
        step = Step()
        step.name = step_name
        step.logs.extend([log])
        build.steps.extend([step])
        # Cover the case when the retrieval of the log returns a string with
        # json-encoded info.
        mock_get_log.return_value = "{}"
        expected_response = {}
        self.assertEqual(
            expected_response,
            ChromiumProjectAPI().GetCompileFailures(build, [step]))
コード例 #10
0
ファイル: projects.py プロジェクト: asdfghjjklllllaaa/infra
        'gitiles-host': 'chromium.googlesource.com',
        'dependencies': 'DEPS',
    },
    'chromeos': {
        'name': 'chromeos/manifest-internal',
        # No gerrit-host for chromeos project because now Findit only deals with
        # annealing snapshots commits and they don't have code review.
        'gitiles-host': 'chrome-internal.googlesource.com',
        'dependencies': 'placeholder/path/to/the/manifest.xml',
    }
}

# Project related configs.
PROJECT_CFG = {
    'chromium': {
        'project_api': ChromiumProjectAPI(),
        'should_group_failures': False,
    },
    'chromeos': {
        'project_api': ChromeOSProjectAPI(),
        'should_group_failures': True,
    }
}


def GetProjectAPI(project):
    """Gets the project API for the project."""
    return PROJECT_CFG.get(project, {}).get('project_api')


def GetBuilderType(project, bucket, builder_name):
コード例 #11
0
ファイル: chromium_api_test.py プロジェクト: xinghun61/infra
 def testTestHeuristicAnalysis(self, mock_analyze):
     self.maxDiff = None
     mock_analyze.return_value = ({
         'failures': [
             {
                 'step_name':
                 'test_a',
                 'supported':
                 True,
                 'first_failure':
                 230,
                 'last_pass':
                 229,
                 'suspected_cls': [
                     {
                         'build_number': 230,
                         'repo_name': 'chromium',
                         'revision': 'a_git_hash',
                         'commit_position': 56789,
                         'score': 11,
                         'hints': {
                             'add a/b/x.cc': 5,
                             'delete a/b/y.cc': 5,
                             'modify e/f/z.cc': 1,
                         }
                     },
                 ],
                 'tests': [{
                     'first_failure':
                     230,
                     'last_pass':
                     229,
                     'test_name':
                     'test_a1',
                     'suspected_cls': [
                         {
                             'build_number': 230,
                             'repo_name': 'chromium',
                             'revision': 'a_git_hash',
                             'commit_position': 56789,
                             'score': 11,
                             'hints': {
                                 'add a/b/x.cc': 5,
                                 'delete a/b/y.cc': 5,
                                 'modify e/f/z.cc': 1,
                             }
                         },
                     ]
                 }],
             },
             {
                 'step_name':
                 'test_b',
                 'supported':
                 True,
                 'first_failure':
                 230,
                 'last_pass':
                 229,
                 'suspected_cls': [{
                     'build_number': 230,
                     'repo_name': 'chromium',
                     'revision': 'b_git_hash',
                     'commit_position': 56788,
                     'score': 5,
                     'hints': {
                         'add odd/path/f.cc': 5,
                     },
                 }],
                 'tests': [
                     {
                         'first_failure':
                         230,
                         'last_pass':
                         229,
                         'test_name':
                         'test_b1',
                         'suspected_cls': [
                             {
                                 'build_number': 230,
                                 'repo_name': 'chromium',
                                 'revision': 'b_git_hash',
                                 'commit_position': 56788,
                                 'score': 5,
                                 'hints': {
                                     'add odd/path/f.cc': 5,
                                 }
                             },
                         ]
                     },
                     {
                         'first_failure':
                         230,
                         'last_pass':
                         229,
                         'test_name':
                         'test_b2',
                         'suspected_cls': [
                             {
                                 'build_number': 230,
                                 'repo_name': 'chromium',
                                 'revision': 'b_git_hash',
                                 'commit_position': 56788,
                                 'score': 5,
                                 'hints': {
                                     'add odd/path/f.cc': 5,
                                 }
                             },
                         ]
                     },
                 ],
             },
         ]
     }, None)
     self.assertEqual(
         {
             ('test_a', frozenset(['test_a1'])): [{
                 'commit_position': 56789,
                 'hints': {
                     'add a/b/x.cc': 5,
                     'delete a/b/y.cc': 5,
                     'modify e/f/z.cc': 1
                 },
                 'revision': 'a_git_hash'
             }],
             ('test_b', frozenset(['test_b1', 'test_b2'])):
             [{
                 'commit_position': 56788,
                 'hints': {
                     'add odd/path/f.cc': 5,
                 },
                 'revision': 'b_git_hash'
             }]
         },
         ChromiumProjectAPI().HeuristicAnalysisForTest(
             # These are passed as-is to the compile_failure_analysis module,
             # tested elsewhere.
             None,
             None,
             None,
             None))
コード例 #12
0
 def testGetRerunBuildInputProperties(self, mock_input_properties):
     self.analysis_api._GetRerunBuildInputProperties(
         ChromiumProjectAPI(), {'compile': ['a.o']}, 8000000000122)
     self.assertTrue(mock_input_properties.called)
コード例 #13
0
 def test_GetFailuresWithMatchingFailureGroups(self,
                                               mock_failures_in_group):
     self.analysis_api._GetFailuresWithMatchingFailureGroups(
         ChromiumProjectAPI(), self.context, self.build, {})
     self.assertTrue(mock_failures_in_group.called)
コード例 #14
0
 def test_GetFailuresInBuild(self, mock_compile_failure):
     self.analysis_api._GetFailuresInBuild(ChromiumProjectAPI(), self.build,
                                           ['compile'])
     self.assertTrue(mock_compile_failure.called)