From 5aa6f6f699eef2f18e2dfc95846e8d1ab0454adf Mon Sep 17 00:00:00 2001 From: Max Lv Date: Tue, 27 Oct 2026 17:05:21 +0800 Subject: [PATCH] coverage: tolerate gcov 15 lambda inconsistencies in lcov 2 Co-Authored-By: Claude --- .github/workflows/tests.yml | 2 +- CMakeLists.txt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 45624986..a1e0eacc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -182,7 +182,7 @@ jobs: { echo '### Coverage (src/, unit + stress tests)' echo '```' - lcov --list build/coverage.info --ignore-errors unused,empty + lcov --list build/coverage.info --ignore-errors unused,empty,inconsistent echo '```' } >> "$GITHUB_STEP_SUMMARY" diff --git a/CMakeLists.txt b/CMakeLists.txt index bfaeb2f6..c509e5f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,6 +127,8 @@ endif() # Coverage report (requires ENABLE_COVERAGE=ON, lcov and genhtml) # Usage: make coverage (after running ctest / integration tests) +# gcov 15 can record a lambda's lines as hit but the lambda itself as not; +# lcov 2 treats that as fatal ("inconsistent"), so it is only a warning here. if (ENABLE_COVERAGE) find_program(LCOV_EXECUTABLE lcov) find_program(GENHTML_EXECUTABLE genhtml) @@ -135,9 +137,10 @@ if (ENABLE_COVERAGE) COMMAND ${LCOV_EXECUTABLE} --capture --directory ${PROJECT_BINARY_DIR} --output-file ${PROJECT_BINARY_DIR}/coverage.info --include ${PROJECT_SOURCE_DIR}/src/* - --ignore-errors mismatch,unused,empty,gcov + --ignore-errors mismatch,unused,empty,gcov,inconsistent COMMAND ${LCOV_EXECUTABLE} --list ${PROJECT_BINARY_DIR}/coverage.info COMMAND ${GENHTML_EXECUTABLE} ${PROJECT_BINARY_DIR}/coverage.info + --ignore-errors inconsistent --output-directory ${PROJECT_BINARY_DIR}/coverage-html COMMAND ${CMAKE_COMMAND} -E echo "Coverage report: ${PROJECT_BINARY_DIR}/coverage-html/index.html" WORKING_DIRECTORY ${PROJECT_BINARY_DIR}