Add lcov code coverage to the release pipeline and Jenkins
- new_docker_build.sh: new --run-coverage mode (mutually exclusive with --run-jenkins-builder). Instruments the release-scope build with -O0 -g --coverage -fPIC -DNDEBUG (RELEASE flag override keeps -DNDEBUG and -fPIC so behavior and PIC match the green baseline), runs ctest, then collects the lcov report: capture --external -> extract on the four release dirs -> remove test sources -> summary -> genhtml, all with --ignore-errors mismatch,inconsistent,unused (GCC 15 + lcov 2.4). Report lands in --coverage-output-dir (default ./coverage-out): html/index.html, coverage.info, coverage_summary.txt. - Dockerfile image gains lcov via APT_PACKAGES (genhtml ships in the same package). - Jenkinsfile: RunCoverage parameter (default on) + per-OS Coverage stage running the driver on the agent and archiving coverage/<project>/<os>/**. - release-16-10-2026.sh: same coverage step, gated by DRYRUN_COVERAGE (default ON, mirrors the Jenkins default). - README: Step 6 (code coverage) and options/env reference entries. - .gitignore: coverage-out/
This commit is contained in:
1 parent
676ae05335
commit
684e05109d
7 files changed
+178
-36
No files matched your search
+14
-1
@@ -26,7 +26,8 @@ properties([
|
||||
string(name: 'LtsVersion', defaultValue: '1.0', description: 'LTS version (major.minor) passed to make_rpm_ubuntu26.py --version'),
|
||||
booleanParam(name: 'ClearWorkspace', defaultValue: false, description: 'Clear entire workspace on all nodes used for build'),
|
||||
booleanParam(name: 'PublishArtifactRepo', defaultValue: true, description: 'Upload produced DEBs to the internal artifact repository'),
|
||||
booleanParam(name: 'RebuildImage', defaultValue: false, description: 'Rebuild the prebuilt build image from the in-tree Dockerfile (default: reuse when present)')
|
||||
booleanParam(name: 'RebuildImage', defaultValue: false, description: 'Rebuild the prebuilt build image from the in-tree Dockerfile (default: reuse when present)'),
|
||||
booleanParam(name: 'RunCoverage', defaultValue: true, description: 'Build the release scope with -O0 --coverage, run ctest, collect the lcov report and archive it')
|
||||
])
|
||||
])
|
||||
|
||||
@@ -84,6 +85,18 @@ osVersions.each { osVersion ->
|
||||
}
|
||||
}
|
||||
|
||||
stage("Coverage ${project} (${osVersion})") {
|
||||
if (!params.RunCoverage) {
|
||||
echo "Coverage skipped for ${project} (OS ${osVersion}, RunCoverage=false)"
|
||||
return
|
||||
}
|
||||
// The driver (run on the agent, same pattern as the image-build
|
||||
// stage) builds the scope with -O0 --coverage, runs ctest and
|
||||
// collects the lcov report into the workspace mount.
|
||||
sh "cd ${legatusRoot} && bash ./new_docker_build.sh --docker-image ${imageName} --run-coverage --coverage-output-dir ${WORKSPACE}/coverage/${project}/${osVersion}"
|
||||
archiveArtifacts artifacts: "coverage/${project}/${osVersion}/**", allowEmptyArchive: true
|
||||
}
|
||||
|
||||
stage("Publish ${project} (${osVersion})") {
|
||||
if (params.PublishArtifactRepo) {
|
||||
withCredentials([usernamePassword(credentialsId: 'internal-repo-uploader',
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
# image is not present yet
|
||||
# - builds the release scope, runs ctest and produces the release DEB
|
||||
# packages with the in-tree rpmbuild script
|
||||
# - collects the lcov code-coverage report (--run-coverage; set
|
||||
# DRYRUN_COVERAGE=OFF to skip)
|
||||
#
|
||||
# The DEB packages land in ${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/
|
||||
# (Jenkins-style layout; locally WORKSPACE is the pipeline root).
|
||||
@@ -60,4 +62,16 @@ bash ./new_docker_build.sh \
|
||||
--build-number "${BUILD_NUMBER}" \
|
||||
--build-tag "${BUILD_TAG}"
|
||||
|
||||
# Code coverage (lcov) - mirrors the Jenkins Coverage stage. Set
|
||||
# DRYRUN_COVERAGE=OFF for a fast local DEB-only run.
|
||||
DRYRUN_COVERAGE="${DRYRUN_COVERAGE:-ON}"
|
||||
if [[ "${DRYRUN_COVERAGE}" == "ON" ]]; then
|
||||
bash ./new_docker_build.sh \
|
||||
--docker-image "${DOCKER_IMAGE}" \
|
||||
--run-coverage \
|
||||
--coverage-output-dir "${WORKSPACE}/coverage/${PROJECT}/${OS_VERSION}"
|
||||
else
|
||||
log_info "Coverage skipped (DRYRUN_COVERAGE=OFF)"
|
||||
fi
|
||||
|
||||
log_info "=== Release Pipeline Complete ==="
|
||||
Reference in new issue
Block a user