diff --git a/vars/functionalTest.groovy b/vars/functionalTest.groovy index aa7b949d3..5b8df9031 100755 --- a/vars/functionalTest.groovy +++ b/vars/functionalTest.groovy @@ -95,18 +95,20 @@ Map call(Map config = [:]) { inst_repos: config.get('inst_repos', ''), inst_rpms: stage_inst_rpms) - List stashes = [] - if (config['stashes']) { - stashes = config['stashes'] - } else { - String target_compiler = "${stage_info['target']}-${stage_info['compiler']}" - stashes.add("${target_compiler}-install") - stashes.add("${target_compiler}-build-vars") + String test_rpms = config.get('test_rpms', env.TEST_RPMS) + if (test_rpms == 'false') { + if (config['stashes'] == null) { + config['stashes'] = [] + } + if (config['stashes'].isEmpty()) { + config['stashes'].add("${stage_info['target']}-${stage_info['compiler']}-install") + config['stashes'].add("${stage_info['target']}-${stage_info['compiler']}-build-vars") + } } Map run_test_config = [:] - run_test_config['stashes'] = stashes - run_test_config['test_rpms'] = config.get('test_rpms', env.TEST_RPMS) + run_test_config['stashes'] = config.get('stashes', []) + run_test_config['test_rpms'] = test_rpms run_test_config['pragma_suffix'] = stage_info['pragma_suffix'] run_test_config['test_tag'] = config.get('test_tag', stage_info['test_tag']) run_test_config['node_count'] = stage_info['node_count'] diff --git a/vars/getFunctionalTestStage.groovy b/vars/getFunctionalTestStage.groovy index 47055feef..9299481c6 100644 --- a/vars/getFunctionalTestStage.groovy +++ b/vars/getFunctionalTestStage.groovy @@ -22,6 +22,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils * base_branch if specified, checkout sources from this branch before running tests * run_if_pr whether or not the stage should run for PR builds * run_if_landing whether or not the stage should run for landing builds + * stashes list of stashes to apply before running the stage * job_status Map of status for each stage in the job/build * @return a scripted stage to run in a pipeline */ @@ -41,6 +42,7 @@ Map call(Map kwargs = [:]) { String other_packages = kwargs.get('other_packages', '') Boolean run_if_pr = kwargs.get('run_if_pr', false) Boolean run_if_landing = kwargs.get('run_if_landing', false) + List stashes = kwargs.get('stashes', []) Map job_status = kwargs.get('job_status', [:]) return { @@ -89,7 +91,10 @@ Map call(Map kwargs = [:]) { nvme: nvme, default_nvme: default_nvme, provider: provider)['ftest_arg'], - test_function: 'runTestFunctionalV2')) + test_function: 'runTestFunctionalV2', + stashes: stashes + ) + ) } finally { println("[${name}] Running functionalTestPostV2()") functionalTestPostV2() diff --git a/vars/runTestFunctionalV2.groovy b/vars/runTestFunctionalV2.groovy index 3acfb43bf..41eeac491 100644 --- a/vars/runTestFunctionalV2.groovy +++ b/vars/runTestFunctionalV2.groovy @@ -67,8 +67,11 @@ Map call(Map config = [:]) { } if (test_rpms && config['stashes']){ - // we don't need (and might not even have) stashes if testing - // from RPMs + dir('/tmp/stashes') { + config['stashes'].each { name -> + unstash name + } + } config.remove('stashes') } @@ -97,5 +100,12 @@ Map call(Map config = [:]) { String name = 'func' + stage_info['pragma_suffix'] + '-cov' stash name: config.get('coverage_stash', name), includes: covfile + + // Stash any optional test coverage reports for the stage + String code_coverage = 'code_coverage_' + sanitizedStageName() + stash name: code_coverage, + includes: '**/code_coverage.json', + allowEmpty: true + return runData } diff --git a/vars/unitTest.groovy b/vars/unitTest.groovy index a0b42b595..76a3c6544 100755 --- a/vars/unitTest.groovy +++ b/vars/unitTest.groovy @@ -223,7 +223,7 @@ Map call(Map config = [:]) { stash name: results_map, includes: results_map - // Stash any optional test coverage rreports for the stage + // Stash any optional test coverage reports for the stage String code_coverage = 'code_coverage_' + sanitizedStageName() stash name: code_coverage, includes: '**/code_coverage.json',