def test_example_report_statusMany(example_hydra_results): bldcfgs, reps = example_hydra_results # Check for all entries that should be present for C in CS: for G in GS: for S in SS: for B in BS: r = StatusReport( status=('succeeded' if C == 'gnucc' and G == 'ghc844' and S == 'submodules' and B == 'master' else 'fixed' if C == 'gnucc' and G == 'ghc865' and S == 'HEADs' and B == 'master' else 'succeeded' if C == 'gnucc' and G == 'ghc844' and S == 'HEADs' and B == 'master' else 2 if C == 'clang' else 'initial_success'), project='Project #1', strategy=S, branchtype="pullreq" if B.startswith('PR') else "regular", branch=B.split('-')[-1] if B.startswith('PR') else B, buildname='-'.join(['.'.join([B, S]), C, G]), bldvars=[ BldVariable(project='Project #1', varname='ghcver', varvalue=G), BldVariable(project='Project #1', varname='c_compiler', varvalue=C), ], blddesc=(PR_Grouped(B[3:]) if B.startswith('PR-') else BranchReq('Project #1', B)), ) assert r in reps
def test_example_report_status3(example_hydra_results): bldcfgs, reps = example_hydra_results # Check for all entries that should be present for C in CS: for G in GS: S = 'HEADs' B = 'PR-blah' # PR1-PR11-PR111-PR1111-blah r = StatusReport( status=(2 if C == 'clang' else 'initial_success'), project='Project #1', strategy=S, branchtype="pullreq" if B.startswith('PR') else "regular", branch=B.split('-')[-1] if B.startswith('PR') else B, buildname='-'.join(['.'.join([B, S]), C, G]), bldvars=[ BldVariable(project='Project #1', varname='ghcver', varvalue=G), BldVariable(project='Project #1', varname='c_compiler', varvalue=C), ], blddesc=PR_Grouped(B[3:]) if B.startswith('PR-') else (MainBranch('R1', B) if B == 'master' else BranchReq( 'Project #1', B)), ) assert r in reps
def test_example_report_status3(example_hydra_results): bldcfgs, reps = example_hydra_results assert StatusReport(status=1, project='Repo1', strategy='standard', branchtype="pullreq", branch="foo", buildname='PR-foo.standard-ghc881', bldvars=[ BldVariable(project='Repo1', varname='ghcver', varvalue='ghc881') ], blddesc=PR_Grouped('foo')) in reps
def test_example_internal_pr101r3_prReq8r1_standard(generated_bldconfigs): for each in [ BldConfig(projectname="Repo1", branchtype="pullreq", branchname="dog", strategy="standard", description=PR_Grouped("dog"), blds=[ BldRepoRev("Repo1", "dog", "Req8"), BldRepoRev("Repo2", "master", "project_primary"), BldRepoRev("Repo3", "dog", "101"), ], bldvars=[BldVariable("Repo1", "ghcver", G)]) for G in GS ]: assert each in generated_bldconfigs.cfg_build_configs
def test_example_internal_bugfix9_pullreq_HEADs(generated_bldconfigs): for each in [ BldConfig(projectname="R10", branchtype="pullreq", branchname="bugfix9", strategy="HEADs", description=PR_Grouped("bugfix9"), blds=[ BldRepoRev("R10", "master", "project_primary"), BldRepoRev("R3", "master", "project_primary"), BldRepoRev("R4", "bugfix9", "8192"), ], bldvars=[BldVariable("R10", "ghcver", G)]) for G in GS ]: assert each in generated_bldconfigs.cfg_build_configs
def test_example_internal_bugfix9_pullreq_HEADs(generated_bldconfigs): for each in [ BldConfig("Project #1", "pullreq", "bugfix9", "HEADs", PR_Grouped("bugfix9"), [ BldRepoRev("R1", "master", "project_primary"), BldRepoRev("R2", "bugfix9", "23"), BldRepoRev("R3", "master", "project_primary"), BldRepoRev("R5", "bugfix9", "project_primary"), BldRepoRev("R6", "master", "project_primary"), BldRepoRev("R4", "bugfix9", "8192"), ], [ BldVariable("Project #1", "ghcver", G), BldVariable("Project #1", "c_compiler", C), ]) for G in GS for C in CS ]: assert each in generated_bldconfigs.cfg_build_configs
def test_example_report_status12(example_hydra_results): bldcfgs, reps = example_hydra_results for each in reps: print(each) print('') assert StatusReport(status='bad_config', project='Repo1', strategy='standard', branchtype="pullreq", branch="develop", buildname='PR-develop.standard-ghc865', bldvars=[ BldVariable(project='Repo1', varname='ghcver', varvalue='ghc865') ], blddesc=PR_Grouped('develop')) in reps
def test_example_internal_devtest_pullreq_submods(generated_bldconfigs): for each in [ BldConfig(projectname="R10", branchtype="pullreq", branchname="devtest", strategy="submodules", description=PR_Grouped("devtest"), blds=[ BldRepoRev("R10", "devtest", "321"), BldRepoRev("R3", "r3_master_head^7", "project_primary"), BldRepoRev("R4", "r4_master_head^11", "project_primary"), ], bldvars=[BldVariable("R10", "ghcver", G)]) for G in GS ]: assert each in generated_bldconfigs.cfg_build_configs
def test_example_internal_blah_pullreq_HEADs(generated_bldconfigs): # See note for the submodules strategy test. for each in [ BldConfig("Project #1", "pullreq", "blah", "HEADs", PR_Grouped("blah"), [ BldRepoRev("R1", "blah", "1", "ignored"), BldRepoRev("R2", "blah", "1111", 9999), BldRepoRev("R3", "blah", "11"), BldRepoRev("R5", "blah", "project_primary"), BldRepoRev("R6", "blah", "111"), BldRepoRev("R7", "master", "project_primary"), ], [ BldVariable("Project #1", "ghcver", G), BldVariable("Project #1", "c_compiler", C), ]) for G in GS for C in CS ]: assert each in generated_bldconfigs.cfg_build_configs
def test_example_report_status1(example_hydra_results): bldcfgs, reps = example_hydra_results # Check for a single entry assert StatusReport( status=2, project='Project #1', strategy="HEADs", branchtype="pullreq", branch="blah", buildname='PR-blah.HEADs-clang-ghc844', bldvars=[ BldVariable(project='Project #1', varname='ghcver', varvalue='ghc844'), BldVariable(project='Project #1', varname='c_compiler', varvalue='clang'), ], blddesc=PR_Grouped('blah'), ) in reps
def test_example_internal_blah_pullreq_submods(generated_bldconfigs): # Note that R1 has a pullreq for the blah branch, and this pullreq # has submodule specifications that are respected for the # "submodules" strategy, therefore the blah PR's for R2 and R3 are # ignored. They will be used for the "heads" strategy though. for each in [ BldConfig( "Project #1", "pullreq", "blah", "submodules", PR_Grouped("blah"), [ BldRepoRev("R1", "blah", "1", "X"), BldRepoRev("R2", "r2_master_head^22", "project_primary"), BldRepoRev("R3", "r3_master_head", "project_primary"), BldRepoRev("R5", "blah", "project_primary"), BldRepoRev("R6", "blah", "111"), BldRepoRev("R7", "r7_master_head^4", "project_primary", "Y"), ], [ BldVariable("Project #1", "ghcver", G), BldVariable("Project #1", "c_compiler", C), ]) for G in GS for C in CS ]: assert each in generated_bldconfigs.cfg_build_configs
"haserrormsg": False, }, ] prior = [ StatusReport( status='initial_success', project='Repo1', strategy='standard', branchtype="pullreq", branch="foo", buildname='PR-foo.standard-ghc881', bldvars=[ BldVariable(project='Repo1', varname='ghcver', varvalue='ghc881') ], blddesc=PR_Grouped('foo'), ), StatusReport( status='initial_success', project='Repo1', strategy='standard', branchtype="pullreq", branch="foo", buildname='PR-foo.standard-ghc865', bldvars=[ BldVariable(project='Repo1', varname='ghcver', varvalue='ghc865') ], blddesc=PR_Grouped('foo'), ), StatusReport( status='failed',
def test_single_internal_frog(generated_bldconfigs): expected = BldConfig("TheRepo", "pullreq", "frog", "standard", PR_Grouped("frog"), [ BldRepoRev("TheRepo", "frog", "91"), ], []) assert expected in generated_bldconfigs.cfg_build_configs