-
Notifications
You must be signed in to change notification settings - Fork 0
#52: add local v2 coverage guide #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
711815a
docs: add local v2 coverage guide
tkilias 6f9f3ce
docs: add text coverage report commands
tkilias 545b79c
docs: ignore generated v2 coverage html
tkilias 5d3b843
docs: enforce branch coverage target
tkilias e106b76
docs: document Lima tool fallback
tkilias b7e2f7c
Merge branch 'main' into docs/v2-coverage-guide
tkilias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,5 @@ dist | |
| *.swp | ||
| MODULE.bazel.lock | ||
| bazel-* | ||
| /udf-runner-cpp/v2/coverage-html/ | ||
| .serena | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # v2 Coverage Guide | ||
|
|
||
| ## Generate a local coverage report | ||
|
|
||
| Install Bazel, LLVM coverage tooling, and `lcov`/`genhtml` on the local | ||
| machine. From the repository root, run the coverage tests from the v2 module: | ||
|
|
||
| ```bash | ||
| cd udf-runner-cpp/v2 | ||
| bazel test --verbose_failures \ | ||
| --collect_code_coverage \ | ||
| --combined_report=lcov \ | ||
| --build_tag_filters=-fuzz-test \ | ||
| --test_tag_filters=-fuzz-test \ | ||
| //... | ||
| ``` | ||
|
|
||
| The combined LCOV report is written to: | ||
|
|
||
| ```text | ||
| bazel-out/_coverage/_coverage_report.dat | ||
| ``` | ||
|
|
||
| Print a text summary of the report with: | ||
|
|
||
| ```bash | ||
| lcov --summary bazel-out/_coverage/_coverage_report.dat | ||
| ``` | ||
|
|
||
| For a file-by-file text listing, use: | ||
|
|
||
| ```bash | ||
| lcov --list bazel-out/_coverage/_coverage_report.dat | ||
| ``` | ||
|
|
||
| Generate an HTML report from the LCOV data with: | ||
|
|
||
| ```bash | ||
| genhtml bazel-out/_coverage/_coverage_report.dat \ | ||
| --branch-coverage \ | ||
| --fail-under-branches 80 \ | ||
| --output-directory coverage-html | ||
| ``` | ||
|
|
||
| Open `coverage-html/index.html` in a browser to inspect line and file | ||
| coverage, including branch coverage. The command fails if total branch | ||
| coverage is below 80%. The `coverage-html` directory is local build output and | ||
| should not be committed. | ||
|
|
||
| ## Generate the CI-compatible report | ||
|
|
||
| To generate the report format consumed by the SonarQube configuration, add the | ||
| same coverage report generator used in CI: | ||
|
|
||
| ```bash | ||
| cd udf-runner-cpp/v2 | ||
| bazel test --verbose_failures \ | ||
| --collect_code_coverage \ | ||
| --combined_report=lcov \ | ||
| --coverage_report_generator=@bazel_sonarqube//:sonarqube_coverage_generator \ | ||
| --build_tag_filters=-fuzz-test \ | ||
| --test_tag_filters=-fuzz-test \ | ||
| //... | ||
| ``` | ||
|
|
||
| The generated report is consumed from | ||
| `bazel-out/_coverage/_coverage_report.dat`, matching | ||
| `sonar.coverageReportPaths` in `sonar-project.properties`. | ||
|
|
||
| Fuzz targets are excluded from these commands because they have separate | ||
| sanitizer and regression workflows documented in the [v2 fuzzing | ||
| guide](v2_fuzzing.md). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.