test: exclude gperf files from captured coverage

Recent lcov started complaining loudly about unknown lines in gperf
files:

...
Found gcov version: 13.2.1
Using intermediate gcov format
Recording 'internal' directories:
...
Finished processing 1634 GCNO files
Apply filtering..
Message summary:
  1 error message:
    range: 1
  28 warning messages:
    gcov: 27
    usage: 1
geninfo: ERROR: (range) unknown line '33' in /build/src/home/homed-gperf.gperf: there are only 22 lines in the file.
  Use 'geninfo --filter range' to remove out-of-range lines.
        (use "geninfo --ignore-errors range ..." to bypass this error)

Since we drop the coverage of built files from the final report anyway,
let's do it also when capturing both initial and real coverage to avoid
this error.
This commit is contained in:
Frantisek Sumsal 2024-04-30 13:13:50 +02:00
parent c89244842b
commit 9fe18055fe

View file

@ -1691,7 +1691,7 @@ check_coverage_reports() {
# Create a coverage report that will later be uploaded. Remove info about system
# libraries/headers and generated files, as we don't really care about them.
lcov --directory "${root}/${BUILD_DIR:?}" --capture --output-file "${dest}.new"
lcov --directory "${root}/${BUILD_DIR:?}" --capture --exclude "*.gperf" --output-file "${dest}.new"
if [[ -f "$dest" ]]; then
# If the destination report file already exists, don't overwrite it, but
# merge it with the already present one - this usually happens when
@ -3315,7 +3315,7 @@ test_setup() {
if get_bool "$IS_BUILT_WITH_COVERAGE"; then
# Do an initial coverage capture, to make sure the final report includes
# files that the tests didn't touch at all
lcov --initial --capture --directory "${initdir}/${BUILD_DIR:?}" --output-file "${TESTDIR:?}/coverage-base"
lcov --initial --capture --directory "${initdir}/${BUILD_DIR:?}" --exclude "*.gperf" --output-file "${TESTDIR:?}/coverage-base"
fi
if get_bool "$hook_defined"; then