mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 15:06:21 +00:00
ci: fix coverage to match Code Coverage job output
Use --extract '*/src/src/*' instead of --remove to properly filter production code from tests. Coverage now shows 27.5% lines matching the dedicated Code Coverage job.
This commit is contained in:
13
ci-build.sh
13
ci-build.sh
@@ -259,16 +259,11 @@ build_and_test() {
|
|||||||
if [ "$run_coverage" = "yes" ]; then
|
if [ "$run_coverage" = "yes" ]; then
|
||||||
echo "--> Collecting coverage data..."
|
echo "--> Collecting coverage data..."
|
||||||
if command -v lcov >/dev/null 2>&1; then
|
if command -v lcov >/dev/null 2>&1; then
|
||||||
lcov --capture --directory . --output-file coverage.info \
|
lcov --capture --directory . --output-file coverage-full.info \
|
||||||
--rc lcov_branch_coverage=1 --ignore-errors inconsistent 2>&1 || true
|
--rc lcov_branch_coverage=1 --ignore-errors inconsistent 2>&1 || true
|
||||||
# Remove test files, stubs, system headers - only keep src/ production code
|
# Extract only production code from src/ directory, exclude tests
|
||||||
lcov --remove coverage.info \
|
# Pattern matches both Docker (/src/src/*) and CI (/usr/src/profanity/src/*)
|
||||||
'/usr/*' \
|
lcov --extract coverage-full.info '*/profanity/src/*' '*/src/src/*' \
|
||||||
'*/tests/*' \
|
|
||||||
'*test*.c' \
|
|
||||||
'*stub*.c' \
|
|
||||||
'*/functionaltests/*' \
|
|
||||||
'*/unittests/*' \
|
|
||||||
--output-file coverage.info \
|
--output-file coverage.info \
|
||||||
--rc lcov_branch_coverage=1 --ignore-errors inconsistent 2>&1 || true
|
--rc lcov_branch_coverage=1 --ignore-errors inconsistent 2>&1 || true
|
||||||
if [ -f coverage.info ] && [ -s coverage.info ]; then
|
if [ -f coverage.info ] && [ -s coverage.info ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user