Skip to content
Draft
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
25 changes: 25 additions & 0 deletions vars/getAdditionalPackages.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// vars/getAdditionalPackages.groovy

/**
*
* getAdditionalPackages.groovy
*
* Get the additional packages for the functional test stages based on the provider and
* whether or not bullseye reporting is enabled.
*
* @ param ucx whether or not to include UCX packages
* @ param bullseye whether or not the packages are bullseye versioned
* @ return a String of space-separated package names
*/
String call(Boolean ucx=false, Boolean bullseye=false) {
String packages = ''
if (ucx) {
packages += ' mercury-ucx'
} else {
packages += ' mercury-libfabric'
}
if (bullseye) {
packages += ' bullseye'
}
return packages.trim()
}
55 changes: 55 additions & 0 deletions vars/getFunctionalPackages.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// vars/getFunctionalPackages.groovy

/**
* getFunctionalPackages.groovy
*
* Get the packages to install in the functional test satge.
*
* @param distro functional test stage distro
* @param nextVersion next daos package version
* @param addDaosPackages additional daos-* version packages to install
* @param versionExt optional daos RPM version extension
* @param otherPackages space-separated string of additional non-daos packages to install
* @return a scripted stage to run in a pipeline
*/

String call(String nextVersion, String otherPackages) {
String distro = parseStageInfo()['target']
return getFunctionalPackages(distro, nextVersion, null, otherPackages, null)
}

String call(String nextVersion, String otherPackages, String versionExt) {
String distro = parseStageInfo()['target']
return getFunctionalPackages(distro, nextVersion, null, otherPackages, versionExt)
}

String call(String distro, String nextVersion, String daosPackages, String otherPackages,
String versionExt) {
String version = daosPackagesVersion(distro, nextVersion)
String packages = ''

if (daosPackages) {
packages += daosPackages
} else {
packages += 'daos{,-{client,tests,server,serialize,tests-internal}}'
}

// Add the build-specific version to the daos packages
if (version) {
if (distro.startsWith('ubuntu20')) {
packages += "=${version}"
} else {
packages += "-${version}"
}
if (versionExt) {
packages += versionExt
}
}

// Add non-daos packages
if (otherPackages) {
packages += " ${otherPackages}"
}

return packages
}
10 changes: 7 additions & 3 deletions vars/getFunctionalTestStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
* distro functional test stage distro (VM)
* image_version image version to use for provisioning, e.g. el8.8, leap15.6, etc.
* base_branch if specified, checkout sources from this branch before running tests
* other_packages space-separated string of additional RPM packages to install
* inst_rpms space-separated string of RPM packages to install on the test nodes;
* exclusive of next_version and other_packages.
* 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
* job_status Map of status for each stage in the job/build
Expand All @@ -30,7 +33,6 @@ Map call(Map kwargs = [:]) {
String name = kwargs.get('name', 'Unknown Functional Test Stage')
String pragma_suffix = kwargs.get('pragma_suffix')
String label = kwargs.get('label')
String next_version = kwargs.get('next_version', null)
String stage_tags = kwargs.get('stage_tags')
String default_tags = kwargs.get('default_tags')
String nvme = kwargs.get('nvme')
Expand All @@ -39,7 +41,9 @@ Map call(Map kwargs = [:]) {
String distro = kwargs.get('distro')
String image_version = kwargs.get('image_version', null)
String base_branch = kwargs.get('base_branch')
String other_packages = kwargs.get('other_packages', '')
String instRpms = kwargs.get(
'inst_rpms',
getFunctionalPackages(kwargs.get('next_version', null), kwargs.get('other_packages', null)))
Boolean run_if_pr = kwargs.get('run_if_pr', false)
Boolean run_if_landing = kwargs.get('run_if_landing', false)
Map job_status = kwargs.get('job_status', [:])
Expand Down Expand Up @@ -83,7 +87,7 @@ Map call(Map kwargs = [:]) {
functionalTest(
image_version: image_version,
inst_repos: daosRepos(distro),
inst_rpms: functionalPackages(1, next_version, 'tests-internal') + ' ' + other_packages,
inst_rpms: instRpms,
test_tag: tags,
ftest_arg: getFunctionalArgs(
pragma_suffix: pragma_suffix,
Expand Down
95 changes: 44 additions & 51 deletions vars/unitTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Map afterTest(Map config, Map testRunInfo) {
} else {
result['result'] = checkJunitFiles(testResults: testResults)
}
if (config['with_valgrind'] || config['NLT']) {
if (config['check_valgrind_errors']) {
vgrcs = sh label: 'Check for Valgrind errors',
script: "grep -E '<error( |>)' ${valgrind_pattern} || true",
returnStdout: true
Expand Down Expand Up @@ -129,31 +129,40 @@ Map call(Map config = [:]) {
long startDate = System.currentTimeMillis()
String nodelist = config.get('NODELIST', env.NODELIST)
String test_script = config.get('test_script', 'ci/unit/test_main.sh')
Map stage_info = parseStageInfo(config)
String inst_rpms = config.get('inst_rpms', '')

if (stage_info['compiler'] == 'covc') {
if (stage_info['java_pkg']) {
inst_rpms += " ${stage_info['java_pkg']}"
}
}
// Support backwards compatibility with parseStageInfo when config keys are ommitted
Map stage_info = parseStageInfo(config)
Integer node_count = config.get('node_count', stage_info['node_count'])
String target = config.get('target', stage_info['ci_target'])
String distro_version = config.get('distro_version', stage_info['distro_version'])
String compiler = config.get('compiler', stage_info['compiler'])
String build_type = config.get('build_type', stage_info['build_type'])
String with_valgrind = config.get('with_valgrind', stage_info.get('with_valgrind', ''))
Boolean NLT = config.get('NLT', stage_info.get('NLT', false))
String always_script = config.get(
'always_script', stage_info.get('always_script', 'ci/unit/test_post_always.sh'))
String valgrind_pattern = config.get(
'valgrind_pattern', stage_info.get('valgrind_pattern', 'unit-test-*memcheck.xml'))
String test_results = config.get(
'test_results', stage_info.get('testResults', 'test_results/*.xml'))

String image_version = config.get('image_version', '') ?:
(stage_info['ci_target'] =~ /([a-z]+)(.*)/)[0][1] + stage_info['distro_version']
(target =~ /([a-z]+)(.*)/)[0][1] + distro_version

Map runData = provisionNodes(
NODELIST: nodelist,
node_count: stage_info['node_count'],
node_count: node_count,
distro: image_version,
inst_repos: config.get('inst_repos', ''),
inst_rpms: inst_rpms)

/* el9-gcc-tests */
String target_stash = (image_version ?: ${stage_info['target']}).split('\\.')[0]
String target_stash = (image_version ?: target).split('\\.')[0]

target_stash += '-' + stage_info['compiler']
if (stage_info['build_type']) {
target_stash += '-' + stage_info['build_type']
target_stash += '-' + compiler
if (build_type) {
target_stash += '-' + build_type
}

List stashes = []
Expand All @@ -171,51 +180,41 @@ Map call(Map config = [:]) {
}
}

if (stage_info['compiler'] == 'covc') {
String tools_url = env.JENKINS_URL +
'job/daos-stack/job/tools/job/master' +
'/lastSuccessfulBuild/artifact/'
httpRequest url: tools_url + 'bullseyecoverage-linux.tar',
httpMode: 'GET',
outputFile: 'bullseye.tar'
}

String with_valgrind = stage_info.get('with_valgrind', '')
Map p = [:]
p['stashes'] = stashes
p['script'] = "SSH_KEY_ARGS=${env.SSH_KEY_ARGS} " +
"NODELIST=${nodelist} " +
"WITH_VALGRIND=${with_valgrind} " +
test_script
p['junit_files'] = config.get('junit_files', 'test_results/*.xml')
p['context'] = config.get('context', 'test/' + env.STAGE_NAME)
p['description'] = config.get('description', env.STAGE_NAME)
Map params = [:]
params['stashes'] = stashes
params['script'] = "SSH_KEY_ARGS=${env.SSH_KEY_ARGS} " +
"NODELIST=${nodelist} " +
"WITH_VALGRIND=${with_valgrind} " +
test_script
params['junit_files'] = config.get('junit_files', 'test_results/*.xml')
params['context'] = config.get('context', 'test/' + env.STAGE_NAME)
params['description'] = config.get('description', env.STAGE_NAME)
// Do not let runTest abort the pipeline as want artifact/log collection.
p['ignore_failure'] = true
params['ignore_failure'] = true
// runTest no longer knows now to notify for Unit Tests
p['notify_result'] = false
params['notify_result'] = false
int time = config.get('timeout_time', 120) as int
String unit = config.get('timeout_unit', 'MINUTES')

Map runTestData = [:]
timeout(time: time, unit: unit) {
runTestData = runTest p
runTestData = runTest params
runTestData.each { resultKey, data -> runData[resultKey] = data }
}
p['always_script'] = stage_info.get('always_script',
'ci/unit/test_post_always.sh')
p['valgrind_pattern'] = stage_info.get('valgrind_pattern',
'unit-test-*memcheck.xml')
p['testResults'] = stage_info.get('testResults', 'test_results/*.xml')
p['with_valgrind'] = with_valgrind
p['NLT'] = stage_info['NLT']
runTestData = afterTest(p, runData)
params['always_script'] = always_script
params['valgrind_pattern'] = valgrind_pattern
params['testResults'] = test_results
params['check_valgrind_errors'] = (with_valgrind || NLT) && (compiler != 'covc')
runTestData = afterTest(params, runData)
runTestData.each { resultKey, data -> runData[resultKey] = data }

if (stage_info['compiler'] == 'covc') {
if (compiler == 'covc') {
// Stash the bullseye code coverage report if it was generated
stash name: config.get('coverage_stash', "${target_stash}-unit-cov"),
includes: 'test.cov'
includes: '**/test.cov'
allowEmpty: true
}

int runTime = durationSeconds(startDate)
runData['unittest_time'] = runTime

Expand All @@ -229,11 +228,5 @@ Map call(Map config = [:]) {
stash name: results_map,
includes: results_map

// 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
}
27 changes: 18 additions & 9 deletions vars/unitTestPost.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ void call(Map config = [:]) {
Map stage_info = parseStageInfo(config)
String cbcResult = currentBuild.currentResult

// Support backwards compatibility with parseStageInfo when config keys are ommitted
String target = config.get('target', stage_info['ci_target'])
String compiler = config.get('compiler', stage_info['compiler'])
String build_type = config.get('build_type', stage_info['build_type'])
String with_valgrind = config.get('with_valgrind', stage_info.get('with_valgrind', ''))
String valgrind_pattern = config.get(
'valgrind_pattern', stage_info.get('valgrind_pattern', 'unit-test-*memcheck.xml'))
String testResults = config.get(
'testResults', stage_info.get('testResults', 'test_results/*.xml'))
Boolean NLT = config.get('NLT', stage_info.get('NLT', false))
Boolean check_valgrind_errors = (with_valgrind || NLT) && (compiler != 'covc')

// Stash the Valgrind files for later analysis
String valgrind_pattern = stage_info.get('valgrind_pattern',
'unit-test-*memcheck.xml')
if (config['valgrind_stash']) {
try {
stash name: config['valgrind_stash'], includes: valgrind_pattern
Expand All @@ -56,7 +66,6 @@ void call(Map config = [:]) {

List artifact_list = config.get('artifacts', ['run_test.sh/*'])

String testResults = stage_info.get('testResults', 'test_results/*.xml')
if (testResults != 'None' ) {
// groovylint-disable-next-line NoDouble
double health_scale = 1.0
Expand All @@ -66,7 +75,7 @@ void call(Map config = [:]) {
junit testResults: testResults,
healthScaleFactor: health_scale
}
if (stage_info['with_valgrind'] || stage_info['NLT']) {
if (check_valgrind_errors) {
String suite = sanitizedStageName()
int vgfail = 0
String testdata
Expand Down Expand Up @@ -97,16 +106,16 @@ void call(Map config = [:]) {
archiveArtifacts artifacts: artifactPat,
allowEmptyArchive: results['ignore_failure']
}
String target_stash = "${stage_info['target']}-${stage_info['compiler']}"
if (stage_info['build_type']) {
target_stash += '-' + stage_info['build_type']
String target_stash = "${target}-${compiler}"
if (build_type) {
target_stash += "-${build_type}"
}
// Coverage instrumented tests and Valgrind are probably mutually exclusive
if (stage_info['compiler'] == 'covc') {
if (compiler == 'covc') {
return
}

if (stage_info['NLT']) {
if (NLT) {
String cb_result = currentBuild.result
discoverGitReferenceBuild(referenceJob: config.get('referenceJobName',
'daos-stack/daos/master'),
Expand Down