Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions vars/functionalTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
7 changes: 6 additions & 1 deletion vars/getFunctionalTestStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down
14 changes: 12 additions & 2 deletions vars/runTestFunctionalV2.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jenkins groovy code should only be accessing directories in its own workspace and not be accessing the /tmp directory.

The /tmp directory of a CI build agent is shared with all agents that run on that host that are not docker containers or VMs.

For where runTestFunctionalV2 runs, all CI build agents are currently sharing the same /tmp directory, but that is likely to change in the future.

Copy link
Contributor Author

@phender phender Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This optional feature is needed to provide *.gcno files created in build stages that will eventually be placed into a temporary directory on each provisioned host. When this is used we'll need to run a govr command to generate a code coverage report using these unstashed files + *.gcda files generated on each host from running the tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tmp can not be used for that. Currently we have two Jenkins build agents with separate /tmp directories and DevOPS is working on bringing up more.

Absolutely no guarantee that anything a stage writes to /tmp will be readable by a different stage trying to read from /tmp.

And no guarantee that a Jenkins agent will be only used by a single Jenkins host.

/tmp is also relatively very small on purpose, and can not be used for large files.

If you need to pass files changed between stages a single job, currently the only method available is to stash it and then unstash it later to a workspace.

If you need to compare it with a previous job, it needs to be saved as an artifact and then copy artifact can retrieve it.

config['stashes'].each { name ->
unstash name
}
}
config.remove('stashes')
}

Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion vars/unitTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down