From: Frantisek Sumsal Date: Tue, 30 Apr 2024 11:13:50 +0000 (+0200) Subject: test: exclude gperf files from captured coverage X-Git-Tag: v256-rc2~151 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fe18055fe66dfcbe2b12afc386063109b84d7a0;p=thirdparty%2Fsystemd.git 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. --- diff --git a/test/test-functions b/test/test-functions index c5a7216c06c..59242b3569f 100644 --- a/test/test-functions +++ b/test/test-functions @@ -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