Skip to content

Commit 5cc528e

Browse files
committed
Handle LCOV function end-line mismatches
1 parent abdc27f commit 5cc528e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/measure-test-coverage

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,15 @@ detect_compiler_type() {
182182
fi
183183
}
184184

185-
# Return "--ignore-errors inconsistent" if the installed lcov supports it (>= 2.0),
186-
# or empty string otherwise. The "inconsistent" error type was added in lcov 2.0.
185+
# Return coverage inconsistency flags for lcov >= 2.0, or empty string otherwise.
186+
# Catch2 template-test macros can produce conflicting function end lines, which
187+
# lcov 2.0 reports as "mismatch". The "inconsistent" error type was added in lcov 2.0.
187188
lcov_ignore_inconsistent() {
188189
local version
189190
version=$(lcov --version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1)
190191
local major="${version%%.*}"
191192
if [[ "$major" -ge 2 ]] 2>/dev/null; then
192-
echo "--ignore-errors inconsistent"
193+
echo "--ignore-errors inconsistent,mismatch"
193194
fi
194195
}
195196

@@ -293,7 +294,7 @@ generate_gcc_coverage() {
293294
# compiled functions. This can lead to minor inconsistencies in the coverage
294295
# files. These are not fatal, and ignoring them still produces good reports.
295296
# For this reason, most `lcov` commands have the `--ignore-errors
296-
# inconsistent` flag (lcov >= 2.0).
297+
# inconsistent,mismatch` flag (lcov >= 2.0).
297298

298299
lcov --capture --directory . $(lcov_ignore_inconsistent) --output-file "$BUILD_DIR/coverage.info"
299300
}

0 commit comments

Comments
 (0)