本文整理匯總了Python中releng.test.utils.TestHelper.add_input_file方法的典型用法代碼示例。如果您正苦於以下問題:Python TestHelper.add_input_file方法的具體用法?Python TestHelper.add_input_file怎麽用?Python TestHelper.add_input_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類releng.test.utils.TestHelper
的用法示例。
在下文中一共展示了TestHelper.add_input_file方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_ReleaseBranchRequest
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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'
}
})
示例2: test_PackageRequestForReleng
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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
})
示例3: TestPrepareBuildMatrix
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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])
})
示例4: test_CrossVerifyRequest
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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', '[email protected]', 'gerrit', 'review', '1234,5', '-m', '"Cross-verify with http://gerrit (patch set 3) running at http://build"'])
示例5: test_CrossVerifyRequestReleng
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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
})
示例6: test_ReleaseBranchRequest
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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
})
示例7: TestBuildScript
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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])
示例8: test_CrossVerifyRequestQuiet
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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'
}
})
示例9: TestReadBuildScriptConfig
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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'
})
示例10: TestRunBuild
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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)
示例11: test_TarballRef
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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')
示例12: TestReadCmakeVariableFile
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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' })
示例13: test_TarballsWithManualTrigger
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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)
示例14: TestPrepareBuildMatrix
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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',
'clang-3.4 no-openmp asan',
'msvc-2013',
'msvc-2015 icc-16.0'
]
self.helper.add_input_file('ws/gromacs/admin/builds/pre-submit-matrix.txt',
'\n'.join(input_lines) + '\n')
prepare_build_matrix(factory, 'pre-submit-matrix', 'matrix.txt')
self.assertEqual(executor.method_calls, [
mock.call.ensure_dir_exists('ws/build', ensure_empty=True),
mock.call.read_file('ws/gromacs/admin/builds/pre-submit-matrix.txt'),
mock.call.write_file('ws/build/matrix.txt',
'OPTIONS "{0} host=bs_nix1310" "{1} host=bs_nix-amd" "{2} host=bs-win2012r2" "{3} host=bs-win2012r2"\n'.format(*[x.strip() for x in input_lines]))
])
def test_PrepareBuildMatrixJson(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')
prepare_build_matrix(factory, 'pre-submit-matrix', 'matrix.json')
self.helper.assertOutputJsonFile('ws/build/matrix.json', [
{
"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"]
}
])
self.assertEqual(executor.method_calls, [
mock.call.ensure_dir_exists('ws/build', ensure_empty=True),
mock.call.read_file('ws/gromacs/admin/builds/pre-submit-matrix.txt'),
mock.call.write_file('ws/build/matrix.json', mock.ANY)
])
示例15: test_TarballsWithManualTrigger
# 需要導入模塊: from releng.test.utils import TestHelper [as 別名]
# 或者: from releng.test.utils.TestHelper import add_input_file [as 別名]
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')