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' } })
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' } })
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 })
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 })
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 })
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 })
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 })
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"'])
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 })
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 })
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) ])
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"' ])
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' } })
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]) } ] })
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 })
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 })
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 })
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 })
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 })
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 })
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 })