]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: exclude gperf files from captured coverage
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 30 Apr 2024 11:13:50 +0000 (13:13 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 30 Apr 2024 13:42:45 +0000 (15:42 +0200)
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.

test/test-functions

index c5a7216c06c8c3cfc755f86eed8e6570cc563e48..59242b3569f017f6d9c24b62063b0fd9a2e5dd3a 100644 (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