From 8c95c4b448bb0fcaa1b68979c026f0a99a4cb4ca Mon Sep 17 00:00:00 2001 From: Phil Henderson Date: Tue, 18 Nov 2025 12:13:56 -0500 Subject: [PATCH 1/4] DAOS-17679 build: Support gcov in functional tests Optionally provide *.gcno files to functional test stages and stash any code coverage reports generated by the stage. Signed-off-by: Phil Henderson --- vars/functionalTest.groovy | 18 +++++++++--------- vars/getFunctionalTestStage.groovy | 12 +++++++++++- vars/runTestFunctionalV2.groovy | 16 ++++++++++++++-- vars/unitTest.groovy | 2 +- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/vars/functionalTest.groovy b/vars/functionalTest.groovy index aa7b949d3..297d67be0 100755 --- a/vars/functionalTest.groovy +++ b/vars/functionalTest.groovy @@ -95,17 +95,17 @@ 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") - } + // 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") + // } Map run_test_config = [:] - run_test_config['stashes'] = stashes + run_test_config['stashes'] = config.get('stashes', []) run_test_config['test_rpms'] = config.get('test_rpms', env.TEST_RPMS) run_test_config['pragma_suffix'] = stage_info['pragma_suffix'] run_test_config['test_tag'] = config.get('test_tag', stage_info['test_tag']) diff --git a/vars/getFunctionalTestStage.groovy b/vars/getFunctionalTestStage.groovy index 47055feef..873f03c6f 100644 --- a/vars/getFunctionalTestStage.groovy +++ b/vars/getFunctionalTestStage.groovy @@ -22,6 +22,8 @@ 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 + * code_coverage whether or not to RPMs where built with code coverage + * 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,8 +43,13 @@ 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', [:]) + // // Include the build-vars stash from the build stage + // Map stage_info = parseStageInfo(stage_name: name, ) + // stashes.add("${stage_info['target']}-${stage_info['compiler']}-build-vars") + return { stage("${name}") { // Get the tags for the stage. Use either the build parameter, commit pragma, or @@ -89,7 +96,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..634b576e0 100644 --- a/vars/runTestFunctionalV2.groovy +++ b/vars/runTestFunctionalV2.groovy @@ -39,6 +39,8 @@ Map call(Map config = [:]) { * * config['description'] Description to report for SCM status. * Default env.STAGE_NAME. + * + * config['code_coverage'] whether or not to RPMs where built with code coverage */ Map stage_info = parseStageInfo(config) @@ -67,8 +69,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 +102,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', From beb8048c323dfde21c40fe28e493844755e21c90 Mon Sep 17 00:00:00 2001 From: Phil Henderson Date: Tue, 18 Nov 2025 12:53:58 -0500 Subject: [PATCH 2/4] Updates Signed-off-by: Phil Henderson --- vars/functionalTest.groovy | 17 +++++++++-------- vars/runTestFunctionalV2.groovy | 2 -- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/vars/functionalTest.groovy b/vars/functionalTest.groovy index 297d67be0..4257a5a99 100755 --- a/vars/functionalTest.groovy +++ b/vars/functionalTest.groovy @@ -95,14 +95,15 @@ 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") - // } + if (config['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'] = config.get('stashes', []) diff --git a/vars/runTestFunctionalV2.groovy b/vars/runTestFunctionalV2.groovy index 634b576e0..41eeac491 100644 --- a/vars/runTestFunctionalV2.groovy +++ b/vars/runTestFunctionalV2.groovy @@ -39,8 +39,6 @@ Map call(Map config = [:]) { * * config['description'] Description to report for SCM status. * Default env.STAGE_NAME. - * - * config['code_coverage'] whether or not to RPMs where built with code coverage */ Map stage_info = parseStageInfo(config) From f2d583846a135a79a566e2d41e479f59c576020c Mon Sep 17 00:00:00 2001 From: Phil Henderson Date: Tue, 18 Nov 2025 12:55:37 -0500 Subject: [PATCH 3/4] Cleanup Signed-off-by: Phil Henderson --- vars/getFunctionalTestStage.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/vars/getFunctionalTestStage.groovy b/vars/getFunctionalTestStage.groovy index 873f03c6f..8896f25d3 100644 --- a/vars/getFunctionalTestStage.groovy +++ b/vars/getFunctionalTestStage.groovy @@ -22,7 +22,6 @@ 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 - * code_coverage whether or not to RPMs where built with code coverage * 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 From e727c54ce4cfb1e1d6ba8201c09a1a0b1f83567a Mon Sep 17 00:00:00 2001 From: Phil Henderson Date: Tue, 18 Nov 2025 13:02:09 -0500 Subject: [PATCH 4/4] Fixes Signed-off-by: Phil Henderson --- vars/functionalTest.groovy | 5 +++-- vars/getFunctionalTestStage.groovy | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/vars/functionalTest.groovy b/vars/functionalTest.groovy index 4257a5a99..5b8df9031 100755 --- a/vars/functionalTest.groovy +++ b/vars/functionalTest.groovy @@ -95,7 +95,8 @@ Map call(Map config = [:]) { inst_repos: config.get('inst_repos', ''), inst_rpms: stage_inst_rpms) - if (config['test_rpms'] == 'false') { + String test_rpms = config.get('test_rpms', env.TEST_RPMS) + if (test_rpms == 'false') { if (config['stashes'] == null) { config['stashes'] = [] } @@ -107,7 +108,7 @@ Map call(Map config = [:]) { Map run_test_config = [:] run_test_config['stashes'] = config.get('stashes', []) - run_test_config['test_rpms'] = config.get('test_rpms', env.TEST_RPMS) + 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 8896f25d3..9299481c6 100644 --- a/vars/getFunctionalTestStage.groovy +++ b/vars/getFunctionalTestStage.groovy @@ -45,10 +45,6 @@ Map call(Map kwargs = [:]) { List stashes = kwargs.get('stashes', []) Map job_status = kwargs.get('job_status', [:]) - // // Include the build-vars stash from the build stage - // Map stage_info = parseStageInfo(stage_name: name, ) - // stashes.add("${stage_info['target']}-${stage_info['compiler']}-build-vars") - return { stage("${name}") { // Get the tags for the stage. Use either the build parameter, commit pragma, or