Skip to content

fix(coverage): filter non-project sources from coverage report - #489

Merged
SteNicholas merged 3 commits into
apache:mainfrom
lucasfang:dev32
Nov 3, 2026
Merged

SteNicholas merged 3 commits into
apache:mainfrom
lucasfang:dev32

Conversation

@lucasfang

@lucasfang lucasfang commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Linked issue: close #488

The coverage report generated by test/generate_coverage.sh currently includes system headers (/usr/include/c++/...), third-party headers installed into the build tree (arrow_ep-install/, boost_ep-install/, etc.), third_party/ sources, and test sources (*_test.cpp, test helpers, mocks). This floods the directory view with tens of thousands of irrelevant files and dilutes the overall coverage numbers.

Add an lcov --remove step to focus the report on project implementation code, and enable AVRO, ORC, MOSAIC, LANCE, and VORTEX in the coverage build so optional formats are measured too.

Restrict build-tree exclusion to the actual build directory ($PWD/*). The previous */build*/* pattern also matched checkout ancestors such as /builds/, which could remove project implementation sources from the report. Pass --ignore-errors unused so overlapping or unmatched exclusion patterns do not abort filtering.

Anchor all remaining project exclusions to the repository root as well. Checkouts beneath test, testing, third_party, or mock-build must retain implementation sources. Exclude the known src/paimon/testing/ directory and explicit REST mock server files instead of matching mock anywhere in a path. Quote the initial directory change to support checkout paths containing spaces.

Tests

Validation for the latest follow-up commit 8208bd8c:

  • bash -n test/generate_coverage.sh, pre-commit run --files test/generate_coverage.sh, and git diff --check — passed.
  • Executed the exact filtering block against synthetic tracefiles for checkouts beneath normal, builds, test, testing, mock-build, third_party, and path with spaces. All seven scenarios retained implementation source/header records, including a production source within a mock-build directory, and removed build dependencies, system headers, third-party sources, tests, helpers, and known mocks. Implementation-only traces also passed with unmatched exclusions. genhtml --no-source generated HTML in all 14 cases.
  • Reproduced the previous rules removing all implementation records beneath test, testing, mock-build, and third_party ancestors.
  • Repeated all seven path scenarios with mixed and implementation-only tracefiles using LCOV 2.0-1 after installing its Perl dependencies in an isolated temporary directory. All 14 filtering and HTML-generation cases passed. Temporary source files were provided for LCOV 2.0's source-existence checks. Earlier checks also passed with the installed lcov (reports version 1.0.0).

Validation for follow-up commit dbb2278b:

  • bash -n test/generate_coverage.sh — passed.
  • pre-commit run --files test/generate_coverage.sh — passed; hooks not applicable to shell files were skipped.
  • git diff --cached --check — passed before committing.
  • Executed the script's exact lcov --remove block against synthetic tracefiles using the installed lcov (reports version 1.0.0). In a checkout under /builds/, implementation source/header records were retained while system, build dependency, third-party, test, helper, and mock records were removed. A tracefile containing only implementation records also completed successfully with unmatched exclusion patterns.

The original patch's previously reported internal-fork validation was a full build and 44/44 CTest targets passing, with filtered coverage of 93.1% lines and 92.3% functions. Those figures predate this follow-up; the complete coverage build and CTest suite were not rerun for this script-only change. Other lcov versions were not tested.

API and Format

No changes to public API, storage format, or protocol.

Documentation

Script comments explain the exclusions, build-directory scope, and handling of unused patterns. No new user-facing feature.

Generative AI tooling

Generated-by: Qoder
Generated-by: OpenAI Codex (GPT-6)

@SteNicholas SteNicholas left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasfang, I left two comments for the coverage filtering step, reproduced with synthetic coverage traces using LCOV 2.0.

Comment thread test/generate_coverage.sh Resolved
Comment thread test/generate_coverage.sh Resolved

@SteNicholas SteNicholas left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasfang, the two earlier findings are addressed. I left only one related path-filtering comment which has been reproduced with synthetic coverage traces using LCOV 2.0.

Comment thread test/generate_coverage.sh Resolved

@SteNicholas SteNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@lxy-9602 lxy-9602 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@SteNicholas
SteNicholas merged commit 71ea359 into apache:main Nov 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Coverage report includes system headers, third-party dependencies, and test sources

3 participants