Wire --run-coverage end to end and remove the DTC pure-virtual forwarders
- new_docker_build.sh: --run-coverage now instruments the RelWithDebInfo build with -O0 -g --coverage (CMAKE_*_FLAGS_RELWITHDEBINFO), runs ctest and collects an lcov report (capture/extract/genhtml/summary) under <pipeline-root>/coverage/<project>/<os>; the lcov steps share an ignore-errors list for the -O0 data quirks (inconsistent, count, ...). - Lts/DDS/DTC/generic_dtc.h: remove the one-line forwarders that called the pure virtuals of GenericDtcSC (latent infinite recursion, and an undefined symbol at link time at -O0, e.g. coverage builds); the concrete classes in generic_dtc_impl.h implement every method final, and the 'using' declarations keep the base methods accessible. - README.md: document the coverage flow (Step 6), update the option rows and add a troubleshooting entry for the -O0 pure-virtual link failure.
This commit is contained in:
1 parent
aa519a56d2
commit
72c87230fd
3 files changed
+131
-38
No files matched your search
@@ -48,8 +48,11 @@ Packages (DEB, via in-tree rpmbuild/make_rpm_ubuntu26_release2.py):
|
||||
--build-tag TAG Build tag for the package (default: manual-build)
|
||||
|
||||
Coverage (lcov):
|
||||
--run-coverage Coverage build + lcov report (README.md Step 6)
|
||||
--coverage-output-dir DIR Directory for coverage output (default: ./coverage-out)
|
||||
--run-coverage Build with -O0 --coverage, run ctest and collect
|
||||
the lcov report (README.md Step 6)
|
||||
--coverage-output-dir DIR Report dir (default: <pipeline-root>/coverage/
|
||||
<project>/<os>/; honored when it is an absolute
|
||||
path under the pipeline root)
|
||||
|
||||
Environment overrides: BUILD_GROUP1/3/5/6, RUN_CTEST, TESTS_ONLY,
|
||||
USE_PREBUILT_IMAGE, DOCKER_IMAGE, CMAKE_BUILD_FLAGS, DOCKER_MOUNT_ROOT,
|
||||
@@ -261,6 +264,26 @@ BUILD_DIR="../build"
|
||||
log_info "Using build directory: ${BUILD_DIR}"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
# Make it absolute: later steps (ctest/coverage) cd elsewhere and must
|
||||
# still find the build tree.
|
||||
BUILD_DIR="$(cd "${BUILD_DIR}" && pwd)"
|
||||
|
||||
# Coverage instrumentation (lcov): override the release flags with
|
||||
# -O0 --coverage when RUN_COVERAGE=ON.
|
||||
COV_CMAKE_ARGS=()
|
||||
if [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
||||
log_info "Coverage mode: instrumenting with -O0 --coverage"
|
||||
# The build type is RelWithDebInfo, so the config-specific flag variables
|
||||
# are CMAKE_{C,CXX}_FLAGS_RELWITHDEBINFO (NOT *_RELEASE - those apply to
|
||||
# the Release build type only).
|
||||
COV_CMAKE_ARGS=(
|
||||
"-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O0 -g --coverage -DNDEBUG -fPIC"
|
||||
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O0 -g --coverage -DNDEBUG -fPIC"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=--coverage"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=--coverage"
|
||||
)
|
||||
fi
|
||||
|
||||
cmake -B "${BUILD_DIR}" \
|
||||
-G Ninja \
|
||||
-DBUILD_TESTING=ON \
|
||||
@@ -281,6 +304,7 @@ cmake -B "${BUILD_DIR}" \
|
||||
-DBUILD_TAG="${BUILD_TAG}" \
|
||||
-DRUN_COVERAGE="${RUN_COVERAGE}" \
|
||||
-DCOVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR}" \
|
||||
"${COV_CMAKE_ARGS[@]}" \
|
||||
'"${CMAKE_BUILD_FLAGS}"' \
|
||||
.
|
||||
|
||||
@@ -327,6 +351,55 @@ if [[ "${RUN_CTEST}" == "ON" ]] && [[ "${TESTS_ONLY}" != "ON" ]]; then
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# Code coverage (lcov): collect the tracefile, filter it down to the
|
||||
# migrated tree, generate the browsable report and the scope summary.
|
||||
if [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
||||
log_info "Collecting code coverage (lcov)..."
|
||||
OS_VERSION=$(eval $(grep "^VERSION_ID=" /etc/os-release) && echo "$VERSION_ID")
|
||||
COV_DIR="${DOCKER_MOUNT_ROOT}/coverage/${PROJECT}/${OS_VERSION}"
|
||||
# Honor --coverage-output-dir when it is an absolute path under the
|
||||
# pipeline root (the only place the host can see it inside the container).
|
||||
case "${COVERAGE_OUTPUT_DIR}" in
|
||||
/*)
|
||||
if [[ "${COVERAGE_OUTPUT_DIR}" == "${MIGRATE_PIPELINE_ROOT}"/* ]]; then
|
||||
COV_DIR="${DOCKER_MOUNT_ROOT}${COVERAGE_OUTPUT_DIR#"${MIGRATE_PIPELINE_ROOT}"}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
rm -rf "${COV_DIR}"
|
||||
mkdir -p "${COV_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
# gcov data quirks under -O0 (exception-tag mismatches, inlined-lambda
|
||||
# consistency checks, ...): suppressed so the steps below don't abort.
|
||||
LCOV_IGNORE_ERRORS="mismatch,unused,source,category,version,gcov,corrupt,unsupported,inconsistent,count"
|
||||
# 1) capture all instrumented objects under the build tree
|
||||
lcov --capture --directory . \
|
||||
--output-file "${COV_DIR}/coverage_raw.info" \
|
||||
--rc branch_coverage=1 \
|
||||
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|
||||
|| die "lcov capture failed"
|
||||
# 2) keep only the migrated-tree sources (drops Qt, RTI, system paths)
|
||||
lcov --extract "${COV_DIR}/coverage_raw.info" "${DOCKER_MOUNT_ROOT}/qt-migration-legatus/*" \
|
||||
--output-file "${COV_DIR}/coverage.info" \
|
||||
--rc branch_coverage=1 \
|
||||
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|
||||
|| die "lcov extract failed"
|
||||
rm -f "${COV_DIR}/coverage_raw.info"
|
||||
# 3) browsable report (line + branch coverage per file)
|
||||
genhtml "${COV_DIR}/coverage.info" \
|
||||
--output-directory "${COV_DIR}/html" \
|
||||
--branch-coverage \
|
||||
--title "Legatus Qt6 Release 2 - code coverage" \
|
||||
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|
||||
|| die "genhtml failed"
|
||||
# 4) whole-scope totals
|
||||
lcov --summary "${COV_DIR}/coverage.info" --rc branch_coverage=1 \
|
||||
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|
||||
> "${COV_DIR}/coverage_summary.txt"
|
||||
log_info "Coverage report: ${COV_DIR} (html/index.html, coverage.info, coverage_summary.txt)"
|
||||
cat "${COV_DIR}/coverage_summary.txt"
|
||||
fi
|
||||
|
||||
# DEB Package Production (in-tree rpmbuild)
|
||||
if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then
|
||||
log_info "=== DEB Package Production (in-tree rpmbuild) ==="
|
||||
|
||||
Reference in new issue
Block a user