Beispiel #1
0
 def test_SingleBuildWithCrossVerify(self):
     helper = TestHelper(self, env={
             'GERRIT_CHANGE_URL': 'http://gerrit',
             'GERRIT_PATCHSET_NUMBER': '3',
         })
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ],
             'gerrit_info': {
                     'change': 1234,
                     'patchset': 5
                 }
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': 'http://my_build',
             'message': None
         })
     helper.assertCommandInvoked(['ssh', '-p', '29418', '*****@*****.**', 'gerrit', 'review', '1234,5', '-m', '"Cross-verify with http://gerrit (patch set 3) finished\n\nhttp://my_build: SUCCESS"'])
Beispiel #2
0
 def test_PostSubmitRequest(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self,
                         commits=commits,
                         workspace='/ws',
                         env={
                             'GERRIT_EVENT_COMMENT_TEXT':
                             base64.b64encode('[JENKINS] Post-submit')
                         })
     helper.add_input_file(
         '/ws/gromacs/admin/builds/post-submit-matrix.txt',
         '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'matrix',
                 'desc': 'post-submit',
                 'matrix': self._MATRIX_EXPECTED_RESULT
             }],
             'revisions':
             commits.expected_build_revisions
         })
Beispiel #3
0
 def setUp(self):
     self.helper = TestHelper(self)
     self.helper.add_input_file(
         "Testing/TAG", """\
             YYYYMMDD-HHMM
             Experimental
             """)
Beispiel #4
0
class TestBuildScript(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self)

    def test_EmptyScript(self):
        executor = self.helper.executor
        self.helper.add_input_file('build.py',
                """\
                def do_build(context):
                    pass
                """);
        script = BuildScript(executor, 'build.py')
        self.assertEqual(script.build_opts, [])
        self.assertFalse(script.build_out_of_source)
        self.assertEqual(script.extra_projects, [])

    def test_SetGlobals(self):
        executor = self.helper.executor
        self.helper.add_input_file('build.py',
                """\
                build_options = ['foo', 'bar']
                build_out_of_source = True
                extra_projects = [Project.REGRESSIONTESTS]
                def do_build(context):
                    pass
                """);
        script = BuildScript(executor, 'build.py')
        self.assertEqual(script.build_opts, ['foo', 'bar'])
        self.assertTrue(script.build_out_of_source)
        self.assertEqual(script.extra_projects, [Project.REGRESSIONTESTS])
Beispiel #5
0
 def test_ReleaseBranchRequest(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, branch='release-2016')
     commits.set_commit(Project.REGRESSIONTESTS, branch='release-2016')
     commits.set_commit(Project.RELENG, change_number=1234)
     helper = TestHelper(self, commits=commits, workspace='/ws', env={
             'GERRIT_PROJECT': 'releng',
             'GERRIT_REFSPEC': commits.releng.refspec,
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] release-2016'),
             'GROMACS_REFSPEC': 'refs/heads/master',
             'REGRESSIONTESTS_REFSPEC': 'refs/heads/master'
         })
     helper.add_input_file('/ws/gromacs/admin/builds/pre-submit-matrix.txt',
             '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(result, {
             'builds': [
                     {
                         'type': 'matrix',
                         'desc': 'release-2016',
                         'matrix': self._MATRIX_EXPECTED_RESULT
                     },
                     { 'type': 'clang-analyzer', 'desc': 'release-2016' },
                     { 'type': 'documentation', 'desc': 'release-2016' },
                     { 'type': 'uncrustify', 'desc': 'release-2016' }
                 ],
             'revisions': commits.expected_build_revisions
         })
Beispiel #6
0
 def test_CrossVerifyRequest(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=3456, patch_number=3)
     commits.set_commit(Project.REGRESSIONTESTS, change_number=1234, patch_number=5)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, workspace='/ws', env={
             'BUILD_URL': 'http://build',
             'GERRIT_PROJECT': 'gromacs',
             'GERRIT_REFSPEC': commits.gromacs.refspec,
             'GERRIT_CHANGE_URL': 'http://gerrit',
             'GERRIT_PATCHSET_NUMBER': commits.gromacs.patch_number,
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Cross-verify 1234'),
             'GROMACS_REFSPEC': 'refs/heads/master',
             'REGRESSIONTESTS_REFSPEC': 'refs/heads/master'
         })
     helper.add_input_file('/ws/gromacs/admin/builds/pre-submit-matrix.txt',
             '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(result, {
             'builds': [
                     {
                         'type': 'matrix',
                         'desc': 'cross-verify',
                         'matrix': self._MATRIX_EXPECTED_RESULT
                     }
                 ],
             'revisions': commits.expected_build_revisions,
             'gerrit_info': {
                     'change': commits.regressiontests.change_number,
                     'patchset': commits.regressiontests.patch_number
                 }
         })
     helper.assertCommandInvoked(['ssh', '-p', '29418', '*****@*****.**', 'gerrit', 'review', '1234,5', '-m', '"Cross-verify with http://gerrit (patch set 3) running at http://build"'])
Beispiel #7
0
 def test_CrossVerifyRequestReleng(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=1234)
     commits.set_commit(Project.REGRESSIONTESTS)
     commits.set_commit(Project.RELENG, change_number=3456)
     helper = TestHelper(self, commits=commits, workspace='/ws', env={
             'BUILD_URL': 'http://build',
             'GERRIT_PROJECT': 'releng',
             'GERRIT_REFSPEC': commits.releng.refspec,
             'GERRIT_CHANGE_URL': 'http://gerrit',
             'GERRIT_PATCHSET_NUMBER': commits.releng.patch_number,
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Cross-verify 1234 quiet'),
             'GROMACS_REFSPEC': 'refs/heads/master',
             'REGRESSIONTESTS_REFSPEC': 'refs/heads/master'
         })
     helper.add_input_file('/ws/gromacs/admin/builds/pre-submit-matrix.txt',
             '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(result, {
             'builds': [
                     {
                         'type': 'matrix',
                         'desc': 'cross-verify',
                         'matrix': self._MATRIX_EXPECTED_RESULT
                     },
                     { 'type': 'clang-analyzer', 'desc': 'cross-verify' },
                     { 'type': 'documentation', 'desc': 'cross-verify' },
                     { 'type': 'uncrustify', 'desc': 'cross-verify' }
                 ],
             'revisions': commits.expected_build_revisions
         })
Beispiel #8
0
class TestPrepareBuildMatrix(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self, workspace='/ws')

    def test_PrepareBuildMatrix(self):
        factory = self.helper.factory
        executor = self.helper.executor
        input_lines = [
                'gcc-4.6 gpu cuda-5.0',
                'msvc-2013'
            ]
        self.helper.add_input_file('/ws/gromacs/admin/builds/pre-submit-matrix.txt',
                '\n'.join(input_lines) + '\n')
        result = prepare_build_matrix(factory, 'pre-submit-matrix')
        self.assertEqual(result, {
                "configs": [
                    {
                        "host": "bs_nix1310",
                        "labels": "cuda-5.0 && gcc-4.6",
                        "opts": ["gcc-4.6", "gpu", "cuda-5.0"]
                    },
                    {
                        "host": "bs-win2012r2",
                        "labels": "msvc-2013",
                        "opts": ["msvc-2013"]
                    }
                ],
                "as_axis": '"{0} host=bs_nix1310" "{1} host=bs-win2012r2"'.format(*[x.strip() for x in input_lines])
            })
Beispiel #9
0
class TestReadBuildScriptConfig(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self)

    def test_ClangAnalyzer(self):
        self.helper.add_input_file(
            'script/build.py', """\
                build_options = ['clang-3.8', 'clang-static-analyzer-3.8']
                def do_build(context):
                    pass
                """)
        result = BuildContext._read_build_script_config(
            self.helper.factory, 'script/build.py')
        self.assertEqual(
            result, {
                'opts': ['clang-3.8', 'clang-static-analyzer-3.8'],
                'host': 'bs_nix-static_analyzer',
                'labels': 'clang-3.8 && clang-static-analyzer-3.8'
            })

    def test_CudaGpuBuild(self):
        self.helper.add_input_file(
            'script/build.py', """\
                build_options = [ 'gcc-4.9', 'cuda-9.0', 'gpuhw=nvidia' ]
                def do_build(context):
                    pass
                """)
        result = BuildContext._read_build_script_config(
            self.helper.factory, 'script/build.py')
        self.assertEqual(
            result, {
                'opts': ['gcc-4.9', 'cuda-9.0', 'gpuhw=nvidia'],
                'host': 'bs_nix1310',
                'labels': 'cuda-9.0 && gcc-4.9 && nvidia'
            })
Beispiel #10
0
 def test_GetBuildRevisionsNoRegressionTests(self):
     helper = TestHelper(self, env={
             'WORKSPACE': 'ws',
             'CHECKOUT_PROJECT': 'gromacs',
             'CHECKOUT_REFSPEC': 'refs/changes/34/1234/5',
             'GROMACS_REFSPEC': 'refs/changes/34/1234/5',
             'RELENG_REFSPEC': 'refs/heads/master'
         })
     workspace = helper.factory.workspace
     workspace._get_build_revisions('build-revisions.json')
     helper.assertOutputJsonFile('build-revisions.json', [
             {
                 'project': 'gromacs',
                 'hash_env': 'GROMACS_HASH',
                 'refspec_env': 'GROMACS_REFSPEC',
                 'refspec': 'refs/changes/34/1234/5',
                 'hash': '1234567890abcdef0123456789abcdef01234567',
                 'title': 'Mock title'
             },
             {
                 'project': 'releng',
                 'hash_env': 'RELENG_HASH',
                 'refspec_env': 'RELENG_REFSPEC',
                 'refspec': 'refs/heads/master',
                 'hash': '1234567890abcdef0123456789abcdef01234567',
                 'title': 'Mock title'
             }
         ])
Beispiel #11
0
 def test_CrossVerifyRequestQuiet(self):
     helper = TestHelper(self, workspace='ws', env={
             'BUILD_URL': 'http://build',
             'GERRIT_PROJECT': 'gromacs',
             'GERRIT_CHANGE_URL': 'http://gerrit',
             'GERRIT_PATCHSET_NUMBER': '3',
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Cross-verify 1234 quiet')
         })
     input_lines = [
             'gcc-4.6 gpu cuda-5.0',
             'msvc-2013'
         ]
     helper.add_input_file('ws/gromacs/admin/builds/pre-submit-matrix.txt',
             '\n'.join(input_lines) + '\n')
     factory = helper.factory
     executor = helper.executor
     get_actions_from_triggering_comment(factory, 'actions.json')
     helper.assertOutputJsonFile('ws/build/actions.json', {
             'builds': [
                     {
                         'type': 'matrix',
                         'desc': 'cross-verify',
                         'options': '"{0} host=bs_nix1310" "{1} host=bs-win2012r2"'.format(*[x.strip() for x in input_lines])
                     }
                 ],
             'env': {
                     'REGRESSIONTESTS_REFSPEC': 'refs/changes/34/1234/5',
                     'REGRESSIONTESTS_HASH': '1234567890abcdef0123456789abcdef01234567'
                 }
         })
Beispiel #12
0
 def test_PackageRequestForReleng(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, workspace='/ws', env={
             'GERRIT_PROJECT': 'releng',
             'GERRIT_REFSPEC': commits.releng.refspec,
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Package')
         })
     helper.add_input_file('/ws/gromacs/admin/builds/get-version-info.py',
             'def do_build(context):\n    context.set_version_info("2017", "1234567890abcdef")\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(result, {
             'builds': [
                     {
                         'type': 'source-package'
                     },
                     {
                         'type': 'regtest-package',
                         'version': '2017',
                         'md5sum': '1234567890abcdef'
                     }
                 ],
             'revisions': commits.expected_build_revisions
         })
Beispiel #13
0
class TestBuildScript(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self)

    def test_EmptyScript(self):
        executor = self.helper.executor
        self.helper.add_input_file(
            'build.py', """\
                def do_build(context):
                    pass
                """)
        script = BuildScript(executor, 'build.py')
        self.assertEqual(script.settings.build_opts, [])
        self.assertFalse(script.settings.build_out_of_source)
        self.assertEqual(script.settings.extra_projects, [])

    def test_SetGlobals(self):
        executor = self.helper.executor
        self.helper.add_input_file(
            'build.py', """\
                build_options = ['foo', 'bar']
                build_out_of_source = True
                extra_projects = [Project.REGRESSIONTESTS]
                use_stdlib_through_env_vars = False
                def do_build(context):
                    pass
                """)
        script = BuildScript(executor, 'build.py')
        self.assertEqual(script.settings.build_opts, ['foo', 'bar'])
        self.assertTrue(script.settings.build_out_of_source)
        self.assertEqual(script.settings.extra_projects,
                         [Project.REGRESSIONTESTS])
        self.assertFalse(script.settings.use_stdlib_through_env_vars)
Beispiel #14
0
 def test_ReleaseBranchRequest(self):
     helper = TestHelper(self, workspace='ws', env={
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] release-2016')
         })
     input_lines = [
             'gcc-4.6 gpu cuda-5.0',
             'msvc-2013'
         ]
     helper.add_input_file('ws/gromacs/admin/builds/pre-submit-matrix.txt',
             '\n'.join(input_lines) + '\n')
     factory = helper.factory
     executor = helper.executor
     get_actions_from_triggering_comment(factory, 'actions.json')
     self.maxDiff = None
     helper.assertOutputJsonFile('ws/build/actions.json', {
             'builds': [
                     {
                         'type': 'matrix',
                         'desc': 'release-2016',
                         'options': '"{0} host=bs_nix1310" "{1} host=bs-win2012r2"'.format(*[x.strip() for x in input_lines])
                     },
                     { 'type': 'clang-analyzer', 'desc': 'release-2016' },
                     { 'type': 'cppcheck', 'desc': 'release-2016' },
                     { 'type': 'documentation', 'desc': 'release-2016' },
                     { 'type': 'uncrustify', 'desc': 'release-2016' }
                 ],
             'env': {
                     'GROMACS_REFSPEC': 'refs/heads/release-2016',
                     'GROMACS_HASH': '1234567890abcdef0123456789abcdef01234567',
                     'REGRESSIONTESTS_REFSPEC': 'refs/heads/release-2016',
                     'REGRESSIONTESTS_HASH': '1234567890abcdef0123456789abcdef01234567'
                 }
         })
Beispiel #15
0
class TestReadBuildScriptConfig(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self)

    def test_ClangAnalyzer(self):
        self.helper.add_input_file('script/build.py',
                """\
                build_options = ['clang-3.8', 'clang-static-analyzer-3.8']
                def do_build(context):
                    pass
                """)
        result = BuildContext._read_build_script_config(self.helper.factory,
                'script/build.py')
        self.assertEqual(result, {
                'opts': ['clang-3.8', 'clang-static-analyzer-3.8'],
                'host': 'bs_nix-static_analyzer',
                'labels': 'clang-3.8 && clang-static-analyzer-3.8'
            })

    def test_CudaGpuBuild(self):
        self.helper.add_input_file('script/build.py',
                """\
                build_options = [ 'gcc-4.9', 'cuda-9.0', 'gpuhw=nvidia' ]
                def do_build(context):
                    pass
                """)
        result = BuildContext._read_build_script_config(self.helper.factory,
                'script/build.py')
        self.assertEqual(result, {
                'opts': [ 'gcc-4.9', 'cuda-9.0', 'gpuhw=nvidia' ],
                'host': 'bs_nix1310',
                'labels': 'cuda-9.0 && gcc-4.9 && nvidia'
            })
Beispiel #16
0
 def test_PackageRequestForReleng(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self,
                         commits=commits,
                         workspace='/ws',
                         env={
                             'GERRIT_PROJECT':
                             'releng',
                             'GERRIT_REFSPEC':
                             commits.releng.refspec,
                             'GERRIT_EVENT_COMMENT_TEXT':
                             base64.b64encode('[JENKINS] Package')
                         })
     helper.add_input_file(
         '/ws/gromacs/admin/builds/get-version-info.py',
         'def do_build(context):\n    context.set_version_info("2017", "1234567890abcdef")\n'
     )
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'source-package'
             }, {
                 'type': 'regtest-package',
                 'version': '2017',
                 'md5sum': '1234567890abcdef'
             }],
             'revisions':
             commits.expected_build_revisions
         })
Beispiel #17
0
class TestRunBuild(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self)

    def test_NoOptions(self):
        self.helper.add_input_file(
            'script/build.py', """\
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory, 'script/build.py',
                                JobType.GERRIT, None)

    def test_ScriptOptions(self):
        self.helper.add_input_file(
            'script/build.py', """\
                build_options = ['gcc-4.8']
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory, 'script/build.py',
                                JobType.GERRIT, None)

    def test_MixedOptions(self):
        self.helper.add_input_file(
            'script/build.py', """\
                build_options = ['gcc-4.8']
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory, 'script/build.py',
                                JobType.GERRIT, ['build-jobs=3'])

    def test_ExtraOptions(self):
        self.helper.add_input_file(
            'script/build.py', """\
                TestEnum = Enum.create('TestEnum', 'foo', 'bar')
                extra_options = {
                    'extra': Option.simple,
                    'enum': Option.enum(TestEnum)
                }
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory, 'script/build.py',
                                JobType.GERRIT, ['extra', 'enum=foo'])

    def test_Parameters(self):
        self.helper.add_input_file(
            'script/build.py', """\
                def do_build(context):
                    context.params.get('PARAM', Parameter.bool)
                """)
        BuildContext._run_build(self.helper.factory, 'script/build.py',
                                JobType.GERRIT, None)
Beispiel #18
0
class TestRunBuild(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self, workspace='/ws')

    def test_NoOptions(self):
        self.helper.add_input_file('script/build.py',
                """\
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory,
                'script/build.py', JobType.GERRIT, None)

    def test_ScriptOptions(self):
        self.helper.add_input_file('script/build.py',
                """\
                build_options = ['gcc-4.8']
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory,
                'script/build.py', JobType.GERRIT, None)

    def test_MixedOptions(self):
        self.helper.add_input_file('script/build.py',
                """\
                build_options = ['gcc-4.8']
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory,
                'script/build.py', JobType.GERRIT, ['build-jobs=3'])

    def test_ExtraOptions(self):
        self.helper.add_input_file('script/build.py',
                """\
                TestEnum = Enum.create('TestEnum', 'foo', 'bar')
                extra_options = {
                    'extra': Option.simple,
                    'enum': Option.enum(TestEnum)
                }
                def do_build(context):
                    pass
                """)
        BuildContext._run_build(self.helper.factory,
                'script/build.py', JobType.GERRIT, ['extra', 'enum=foo'])

    def test_Parameters(self):
        self.helper.add_input_file('script/build.py',
                """\
                def do_build(context):
                    context.params.get('PARAM', Parameter.bool)
                """)
        BuildContext._run_build(self.helper.factory,
                'script/build.py', JobType.GERRIT, None)
Beispiel #19
0
 def test_NoBuild(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': []
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': None,
             'message': None
         })
Beispiel #20
0
 def test_NoBuild(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': []
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': None,
             'message': None
         })
Beispiel #21
0
 def test_TarballRef(self):
     helper = TestHelper(self)
     helper.add_input_file('tarballs/gromacs/package-info.log', """\
             PACKAGE_FILE_NAME = gromacs-xyz-dev.tar.gz
             HEAD_HASH = 1234abcd
             """)
     refspec = RefSpec('tarballs/gromacs', executor=helper.executor)
     self.assertFalse(refspec.is_no_op)
     self.assertTrue(refspec.is_tarball)
     self.assertFalse(refspec.is_static)
     self.assertEqual(refspec.tarball_path, 'tarballs/gromacs/gromacs-xyz-dev.tar.gz')
     self.assertEqual(str(refspec), 'tarballs/gromacs')
Beispiel #22
0
 def test_TarballRef(self):
     helper = TestHelper(self)
     helper.add_input_file('tarballs/gromacs/package-info.log', """\
             PACKAGE_FILE_NAME = gromacs-xyz-dev.tar.gz
             HEAD_HASH = 1234abcd
             """)
     refspec = RefSpec('tarballs/gromacs', executor=helper.executor)
     self.assertFalse(refspec.is_no_op)
     self.assertTrue(refspec.is_tarball)
     self.assertFalse(refspec.is_static)
     self.assertEqual(refspec.tarball_path, 'tarballs/gromacs/gromacs-xyz-dev.tar.gz')
     self.assertEqual(str(refspec), 'tarballs/gromacs')
Beispiel #23
0
 def test_SingleBuild(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'url': 'http://my_build',
                 'desc': None,
                 'result': 'SUCCESS'
             }]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {'url': 'http://my_build', 'message': None})
Beispiel #24
0
 def test_TarballsWithManualTrigger(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, env={
             'GROMACS_REFSPEC': 'tarballs/gromacs',
             'RELENG_REFSPEC': 'refs/heads/master'
         })
     helper.add_input_file('tarballs/gromacs/package-info.log', """\
             HEAD_HASH = 1234abcd
             """)
     projects = helper.factory.projects
     self.verifyProjectInfo(projects, commits, tarball=Project.GROMACS)
Beispiel #25
0
class TestReadCmakeVariableFile(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self, workspace='/ws')

    def test_ReadFile(self):
        self.helper.add_input_file('Test.cmake',
                """\
                set(FOO "1")
                set(BAR "2")
                """)
        context = self.helper.factory.create_context(JobType.GERRIT, None, None)
        result = context.read_cmake_variable_file('Test.cmake')
        self.assertEqual(result, { 'FOO': '1', 'BAR': '2' })
Beispiel #26
0
 def test_TarballsWithManualTrigger(self):
     helper = TestHelper(self, env={
             'CHECKOUT_PROJECT': 'releng',
             'CHECKOUT_REFSPEC': 'refs/heads/master',
             'GROMACS_REFSPEC': 'tarballs/gromacs',
             'RELENG_REFSPEC': 'refs/heads/master'
         })
     helper.add_input_file('tarballs/gromacs/package-info.log', """\
             HEAD_HASH = 1234abcd
             """)
     gerrit = helper.factory.gerrit
     self.assertEqual(gerrit.checked_out_project, Project.RELENG)
     self.assertTrue(gerrit.get_refspec(Project.GROMACS).is_tarball)
     self.assertEqual(gerrit.get_refspec(Project.RELENG).fetch, 'refs/heads/master')
Beispiel #27
0
 def test_CrossVerifyRequestReleng(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=1234)
     commits.set_commit(Project.REGRESSIONTESTS)
     commits.set_commit(Project.RELENG, change_number=3456)
     helper = TestHelper(
         self,
         commits=commits,
         workspace='/ws',
         env={
             'BUILD_URL':
             'http://build',
             'GERRIT_PROJECT':
             'releng',
             'GERRIT_REFSPEC':
             commits.releng.refspec,
             'GERRIT_CHANGE_URL':
             'http://gerrit',
             'GERRIT_PATCHSET_NUMBER':
             commits.releng.patch_number,
             'GERRIT_EVENT_COMMENT_TEXT':
             base64.b64encode('[JENKINS] Cross-verify 1234 quiet'),
             'GROMACS_REFSPEC':
             'refs/heads/master',
             'REGRESSIONTESTS_REFSPEC':
             'refs/heads/master'
         })
     helper.add_input_file('/ws/gromacs/admin/builds/pre-submit-matrix.txt',
                           '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'matrix',
                 'desc': 'cross-verify',
                 'matrix': self._MATRIX_EXPECTED_RESULT
             }, {
                 'type': 'clang-analyzer',
                 'desc': 'cross-verify'
             }, {
                 'type': 'documentation',
                 'desc': 'cross-verify'
             }, {
                 'type': 'uncrustify',
                 'desc': 'cross-verify'
             }],
             'revisions':
             commits.expected_build_revisions
         })
Beispiel #28
0
class TestReadCmakeVariableFile(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self)

    def test_ReadFile(self):
        self.helper.add_input_file(
            'Test.cmake', """\
                set(FOO "1")
                set(BAR "2")
                """)
        context = self.helper.factory.create_context(JobType.GERRIT, None,
                                                     None)
        result = context.read_cmake_variable_file('Test.cmake')
        self.assertEqual(result, {'FOO': '1', 'BAR': '2'})
Beispiel #29
0
 def test_FailedSingleBuildWithoutUrl(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'title': 'My title',
                 'url': None,
                 'desc': None,
                 'result': 'FAILURE',
                 'reason': 'Failure reason'
             }]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {'url': None, 'message': 'Failure reason'})
Beispiel #30
0
 def test_CrossVerifyRequestOneBuildOnly(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=3456)
     commits.set_commit(Project.REGRESSIONTESTS, change_number=1234)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(
         self,
         commits=commits,
         env={
             'BUILD_URL':
             'http://build',
             'GERRIT_PROJECT':
             'gromacs',
             'GERRIT_REFSPEC':
             commits.gromacs.refspec,
             'GERRIT_CHANGE_URL':
             'http://gerrit',
             'GERRIT_PATCHSET_NUMBER':
             commits.gromacs.patch_number,
             'GERRIT_EVENT_COMMENT_TEXT':
             base64.b64encode('[JENKINS] Cross-verify 1234 quiet coverage'),
             'GROMACS_REFSPEC':
             'refs/heads/master',
             'REGRESSIONTESTS_REFSPEC':
             'refs/heads/master'
         })
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'coverage'
             }],
             'revisions': commits.expected_build_revisions
         })
Beispiel #31
0
 def test_SingleBuildWithDescription(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': 'cross-verify',
                         'result': 'SUCCESS'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': 'http://my_build (cross-verify)',
             'message': None
         })
Beispiel #32
0
 def test_SingleBuildWithDescription(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': 'cross-verify',
                         'result': 'SUCCESS'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': 'http://my_build (cross-verify)',
             'message': None
         })
Beispiel #33
0
 def test_GetBuildRevisionsNoRegressionTests(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=1234)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits)
     projects = helper.factory.projects
     result = projects.get_build_revisions()
     self.assertEqual(result, commits.expected_build_revisions)
Beispiel #34
0
 def test_MultilineTriggeringComment(self):
     helper = TestHelper(self, env={
             'GERRIT_PROJECT': 'gromacs',
             'GERRIT_REFSPEC': 'refs/heads/master',
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS]\nCoverage\nMore')
         })
     gerrit = helper.factory.gerrit
     self.assertEqual(gerrit.get_triggering_comment(), 'Coverage\nMore')
Beispiel #35
0
 def test_SingleBuildWithoutUrl(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'title': 'My title',
                         'url': None,
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': None,
             'message': None
         })
Beispiel #36
0
 def test_FailedSingleBuild(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': None,
                         'result': 'FAILURE',
                         'reason': 'Failure reason'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': 'http://my_build',
             'message': 'Failure reason'
         })
Beispiel #37
0
class TestReadBuildScriptConfig(unittest.TestCase):
    def setUp(self):
        self.helper = TestHelper(self, workspace='/ws')

    def test_ClangAnalyzer(self):
        self.helper.add_input_file('script/build.py',
                """\
                build_options = ['clang-3.8', 'clang-static-analyzer-3.8']
                def do_build(context):
                    pass
                """)
        BuildContext._read_build_script_config(self.helper.factory,
                'script/build.py', 'config.json')
        self.helper.assertOutputJsonFile('/ws/build/config.json', {
                'opts': ['clang-3.8', 'clang-static-analyzer-3.8'],
                'host': 'bs_nix-static_analyzer',
                'labels': 'clang-3.8 && clang-static-analyzer-3.8'
            })
Beispiel #38
0
 def test_FailedSingleBuild(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': None,
                         'result': 'FAILURE',
                         'reason': 'Failure reason'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': 'http://my_build',
             'message': 'Failure reason'
         })
Beispiel #39
0
 def test_SingleBuildWithoutUrl(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'title': 'My title',
                         'url': None,
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': None,
             'message': None
         })
Beispiel #40
0
    def test_CoverageRequest(self):
        helper = TestHelper(self, workspace='ws', env={
                'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Coverage')
            })
        factory = helper.factory
        executor = helper.executor
        get_actions_from_triggering_comment(factory, 'actions.json')
        helper.assertOutputJsonFile('ws/build/actions.json', {
                'builds': [
                        {
                            'type': 'coverage'
                        }
                    ]
            })

        self.assertEqual(executor.method_calls, [
                mock.call.ensure_dir_exists('ws/build', ensure_empty=True),
                mock.call.write_file('ws/build/actions.json', mock.ANY)
            ])
Beispiel #41
0
 def test_ManualTriggerInPipeline(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=1234)
     commits.set_commit(Project.RELENG, change_number=3456)
     helper = TestHelper(self, commits=commits, env={
             'GROMACS_REFSPEC': commits.gromacs.refspec,
             'RELENG_REFSPEC': commits.releng.refspec
         })
     projects = helper.factory.projects
     self.verifyProjectInfo(projects, commits)
Beispiel #42
0
 def test_ReleaseBranchRequest(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, branch='release-2016')
     commits.set_commit(Project.REGRESSIONTESTS, branch='release-2016')
     commits.set_commit(Project.RELENG, change_number=1234)
     helper = TestHelper(self,
                         commits=commits,
                         workspace='/ws',
                         env={
                             'GERRIT_PROJECT':
                             'releng',
                             'GERRIT_REFSPEC':
                             commits.releng.refspec,
                             'GERRIT_EVENT_COMMENT_TEXT':
                             base64.b64encode('[JENKINS] release-2016'),
                             'GROMACS_REFSPEC':
                             'refs/heads/master',
                             'REGRESSIONTESTS_REFSPEC':
                             'refs/heads/master'
                         })
     helper.add_input_file('/ws/gromacs/admin/builds/pre-submit-matrix.txt',
                           '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'matrix',
                 'desc': 'release-2016',
                 'matrix': self._MATRIX_EXPECTED_RESULT
             }, {
                 'type': 'clang-analyzer',
                 'desc': 'release-2016'
             }, {
                 'type': 'documentation',
                 'desc': 'release-2016'
             }, {
                 'type': 'uncrustify',
                 'desc': 'release-2016'
             }],
             'revisions':
             commits.expected_build_revisions
         })
Beispiel #43
0
 def test_GetBuildRevisionsWithAutoRefspecs(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.REGRESSIONTESTS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, env={
             'GROMACS_REFSPEC': 'auto',
             'REGRESSIONTESTS_REFSPEC': 'auto'
         })
     projects = helper.factory.projects
     result = projects.get_build_revisions()
     self.assertEqual(result, commits.expected_build_revisions)
Beispiel #44
0
 def test_ManualTrigger(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=1234)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, env={
             'CHECKOUT_PROJECT': 'gromacs',
             'CHECKOUT_REFSPEC': commits.gromacs.refspec,
             'GROMACS_REFSPEC': commits.gromacs.refspec,
             'RELENG_REFSPEC': 'refs/heads/master'
         })
     projects = helper.factory.projects
     self.verifyProjectInfo(projects, commits)
Beispiel #45
0
 def test_PostSubmitRequest(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, workspace='/ws', env={
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Post-submit')
         })
     helper.add_input_file('/ws/gromacs/admin/builds/post-submit-matrix.txt',
             '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(result, {
             'builds': [
                     {
                         'type': 'matrix',
                         'desc': 'post-submit',
                         'matrix': self._MATRIX_EXPECTED_RESULT
                     }
                 ],
             'revisions': commits.expected_build_revisions
         })
Beispiel #46
0
class TestStatusReporterNoPropagate(unittest.TestCase):
    def setUp(self):
        env = {
                'STATUS_FILE': 'logs/status.json',
                'NO_PROPAGATE_FAILURE': '1'
            }
        self.helper = TestHelper(self, workspace='ws', env=env)

    def test_Failure(self):
        with self.helper.factory.status_reporter as status_reporter:
            status_reporter.mark_failed('Failure reason')
        self.assertFalse(self.helper.executor.exit.called)
        self.helper.assertConsoleOutput("""\
                Build FAILED:
                  Failure reason
                """)
        self.helper.assertOutputJsonFile('ws/logs/status.json', {
                'result': 'FAILURE',
                'reason': 'Failure reason'
            })

    def test_Aborted(self):
        with self.helper.factory.status_reporter as status_reporter:
            raise AbortError(143)
        self.assertFalse(self.helper.executor.exit.called)
        self.helper.assertOutputJsonFile('ws/logs/status.json', {
                'result': 'ABORTED',
                'reason': None
            })
Beispiel #47
0
 def test_SingleBuildWithCrossVerify(self):
     helper = TestHelper(self,
                         env={
                             'GERRIT_CHANGE_URL': 'http://gerrit',
                             'GERRIT_PATCHSET_NUMBER': '3',
                         })
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'url': 'http://my_build',
                 'desc': None,
                 'result': 'SUCCESS'
             }],
             'gerrit_info': {
                 'change': 1234,
                 'patchset': 5
             }
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {'url': 'http://my_build', 'message': None})
     helper.assertCommandInvoked([
         'ssh', '-p', '29418', '*****@*****.**', 'gerrit',
         'review', '1234,5', '-m',
         '"Cross-verify with http://gerrit (patch set 3) finished\n\nhttp://my_build: SUCCESS"'
     ])
Beispiel #48
0
class TestStatusReporterNoPropagate(unittest.TestCase):
    def setUp(self):
        env = {
                'STATUS_FILE': 'logs/status.json',
                'NO_PROPAGATE_FAILURE': '1'
            }
        self.helper = TestHelper(self, workspace='ws', env=env)

    def test_Failure(self):
        with self.helper.factory.status_reporter as status_reporter:
            status_reporter.mark_failed('Failure reason')
        self.assertFalse(self.helper.executor.exit.called)
        self.helper.assertConsoleOutput("""\
                Build FAILED:
                  Failure reason
                """)
        self.helper.assertOutputJsonFile('ws/logs/status.json', {
                'result': 'FAILURE',
                'reason': 'Failure reason'
            })

    def test_Aborted(self):
        with self.helper.factory.status_reporter as status_reporter:
            raise AbortError(143)
        self.assertFalse(self.helper.executor.exit.called)
        self.helper.assertOutputJsonFile('ws/logs/status.json', {
                'result': 'ABORTED',
                'reason': None
            })
Beispiel #49
0
 def test_CrossVerifyRequestOneBuildOnly(self):
     helper = TestHelper(self, workspace='ws', env={
             'BUILD_URL': 'http://build',
             'GERRIT_PROJECT': 'gromacs',
             'GERRIT_CHANGE_URL': 'http://gerrit',
             'GERRIT_PATCHSET_NUMBER': '3',
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Cross-verify 1234 quiet clang-analyzer')
         })
     factory = helper.factory
     executor = helper.executor
     get_actions_from_triggering_comment(factory, 'actions.json')
     helper.assertOutputJsonFile('ws/build/actions.json', {
             'builds': [
                     {
                         'type': 'clang-analyzer'
                     }
                 ],
             'env': {
                     'REGRESSIONTESTS_REFSPEC': 'refs/changes/34/1234/5',
                     'REGRESSIONTESTS_HASH': '1234567890abcdef0123456789abcdef01234567'
                 }
         })
Beispiel #50
0
 def test_Checkout(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG, change_number=1234)
     helper = TestHelper(self, commits=commits, env={
             'CHECKOUT_PROJECT': 'releng',
             'CHECKOUT_REFSPEC': commits.releng.refspec,
             'GROMACS_REFSPEC': 'refs/heads/master',
             'RELENG_REFSPEC': 'refs/heads/master'
         })
     projects = helper.factory.projects
     self.verifyProjectInfo(projects, commits)
     projects.checkout_project(Project.GROMACS)
Beispiel #51
0
 def test_PostSubmitRequest(self):
     helper = TestHelper(self, workspace='ws', env={
             'GERRIT_EVENT_COMMENT_TEXT': base64.b64encode('[JENKINS] Post-submit')
         })
     input_lines = [
             'gcc-4.6 gpu cuda-5.0',
             'msvc-2013'
         ]
     helper.add_input_file('ws/gromacs/admin/builds/post-submit-matrix.txt',
             '\n'.join(input_lines) + '\n')
     factory = helper.factory
     executor = helper.executor
     get_actions_from_triggering_comment(factory, 'actions.json')
     helper.assertOutputJsonFile('ws/build/actions.json', {
             'builds': [
                     {
                         'type': 'matrix',
                         'desc': 'post-submit',
                         'options': '"{0} host=bs_nix1310" "{1} host=bs-win2012r2"'.format(*[x.strip() for x in input_lines])
                     }
                 ]
         })
Beispiel #52
0
 def test_TwoBuilds(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'url': 'http://my_build',
                 'desc': 'cross-verify',
                 'result': 'SUCCESS'
             }, {
                 'url': 'http://my_build2',
                 'desc': None,
                 'result': 'SUCCESS'
             }]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(
         result, {
             'url':
             None,
             'message':
             'http://my_build (cross-verify): SUCCESS\nhttp://my_build2: SUCCESS'
         })
Beispiel #53
0
 def test_ManualTriggerWithHash(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, env={
             'CHECKOUT_PROJECT': 'gromacs',
             'CHECKOUT_REFSPEC': 'refs/heads/master',
             'GROMACS_REFSPEC': 'refs/heads/master',
             'GROMACS_HASH': commits.gromacs.sha1,
             'RELENG_REFSPEC': 'refs/heads/master',
             'RELENG_HASH': commits.releng.sha1
         })
     projects = helper.factory.projects
     self.verifyProjectInfo(projects, commits, expect_hashes=True)
Beispiel #54
0
 def test_GetBuildRevisionsWithBranchDetection(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=1234, branch='release-2019')
     commits.set_commit(Project.REGRESSIONTESTS, branch='release-2019')
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self, commits=commits, env={
             'GERRIT_PROJECT': 'gromacs',
             'GERRIT_REFSPEC': commits.gromacs.refspec,
             'GROMACS_REFSPEC': 'auto',
             'REGRESSIONTESTS_REFSPEC': 'auto'
         })
     projects = helper.factory.projects
     result = projects.get_build_revisions()
     self.assertEqual(result, commits.expected_build_revisions)
Beispiel #55
0
 def test_CrossVerifyRequest(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS, change_number=3456, patch_number=3)
     commits.set_commit(Project.REGRESSIONTESTS,
                        change_number=1234,
                        patch_number=5)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(
         self,
         commits=commits,
         workspace='/ws',
         env={
             'BUILD_URL':
             'http://build',
             'GERRIT_PROJECT':
             'gromacs',
             'GERRIT_REFSPEC':
             commits.gromacs.refspec,
             'GERRIT_CHANGE_URL':
             'http://gerrit',
             'GERRIT_PATCHSET_NUMBER':
             commits.gromacs.patch_number,
             'GERRIT_EVENT_COMMENT_TEXT':
             base64.b64encode('[JENKINS] Cross-verify 1234'),
             'GROMACS_REFSPEC':
             'refs/heads/master',
             'REGRESSIONTESTS_REFSPEC':
             'refs/heads/master'
         })
     helper.add_input_file('/ws/gromacs/admin/builds/pre-submit-matrix.txt',
                           '\n'.join(self._MATRIX_INPUT_LINES) + '\n')
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'matrix',
                 'desc': 'cross-verify',
                 'matrix': self._MATRIX_EXPECTED_RESULT
             }],
             'revisions':
             commits.expected_build_revisions,
             'gerrit_info': {
                 'change': commits.regressiontests.change_number,
                 'patchset': commits.regressiontests.patch_number
             }
         })
     helper.assertCommandInvoked([
         'ssh', '-p', '29418', '*****@*****.**', 'gerrit',
         'review', '1234,5', '-m',
         '"Cross-verify with http://gerrit (patch set 3) running at http://build"'
     ])
Beispiel #56
0
 def test_CoverageRequest(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self,
                         commits=commits,
                         env={
                             'GERRIT_EVENT_COMMENT_TEXT':
                             base64.b64encode('[JENKINS] Coverage')
                         })
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'coverage'
             }],
             'revisions': commits.expected_build_revisions
         })
Beispiel #57
0
 def test_PackageRequestForSource(self):
     commits = RepositoryTestState()
     commits.set_commit(Project.GROMACS)
     commits.set_commit(Project.RELENG)
     helper = TestHelper(self,
                         commits=commits,
                         env={
                             'GERRIT_PROJECT':
                             'gromacs',
                             'GERRIT_REFSPEC':
                             commits.gromacs.refspec,
                             'GERRIT_EVENT_COMMENT_TEXT':
                             base64.b64encode('[JENKINS] Package')
                         })
     factory = helper.factory
     result = get_actions_from_triggering_comment(factory)
     self.assertEqual(
         result, {
             'builds': [{
                 'type': 'source-package'
             }],
             'revisions': commits.expected_build_revisions
         })
Beispiel #58
0
 def setUp(self):
     self.helper = TestHelper(self, workspace='/ws')