bazel: add code coverage build option - #3716
Open
napetrov wants to merge 4 commits into
Open
Conversation
added 2 commits
July 24, 2026 09:03
Signed-off-by: Ubuntu <ubuntu@ip-172-31-3-43.ec2.internal>
Signed-off-by: Ubuntu <ubuntu@ip-172-31-3-43.ec2.internal>
napetrov
marked this pull request as ready for review
July 26, 2026 11:58
napetrov
requested review from
Alexandr-Solovev,
avolkov-intel,
david-cortes-intel,
ethanglaser,
homksei and
icfaust
as code owners
July 26, 2026 11:58
napetrov
requested review from
Vika-F,
ahuber21,
maria-Petrova and
syakov-intel
as code owners
July 26, 2026 11:58
The existing CI smoke check only exercised the rejection path (GCC host compiler). Add dev/bazel/tests/code_coverage_test.sh, run on the icx toolchain, which builds DAAL core and the separately built threading module with --code_coverage=true and inspects bazel aquery output to confirm the Make-equivalent -coverage/-DGCOV_BUILD flags are actually applied where documented, and only there.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Bazel-typed --code_coverage=true build option to mirror Make’s CODE_COVERAGE=yes for supported Linux ICX builds, applying coverage instrumentation in an action-local way (oneDAL-owned actions only) and documenting/validating the mapping in CI.
Changes:
- Introduce a new typed Bazel flag (
@config//:code_coverage) with a.bazelrcalias--code_coverage. - Add action-local coverage compile/link flags for oneDAL rules, with
GCOV_BUILDscoped to DAAL core modules and a DPC++ link-mode mapping (-Xscoverage). - Document behavior and add CI smoke tests (negative GCC rejection + positive ICX aquery-based verification).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| INSTALL.md | Documents Bazel equivalent of Make coverage mode and its scoping rules. |
| dev/bazel/tests/code_coverage_test.sh | Adds an ICX positive-path smoke that validates action flags via bazel aquery. |
| dev/bazel/tests/BUILD | Exports the new coverage smoke script. |
| dev/bazel/README.md | Documents the Make→Bazel mapping and the action-level coverage behavior table. |
| dev/bazel/daal.bzl | Adds define_gcov_build plumbing so DAAL modules can opt into GCOV_BUILD under coverage. |
| dev/bazel/config/config.tpl.BUILD | Introduces the typed boolean build setting code_coverage. |
| dev/bazel/cc.bzl | Implements coverage flag injection for compile/link actions and prevents transitive leakage. |
| cpp/daal/BUILD | Explicitly disables GCOV_BUILD for the separately built DAAL threading module. |
| .ci/pipeline/ci.yml | Adds GCC rejection smoke and ICX positive coverage smoke build to CI. |
| .bazelrc | Adds a --flag_alias for code_coverage. |
Comment on lines
+118
to
+128
| linker_inputs.append(cc_common.create_linker_input( | ||
| owner = linker_input.owner, | ||
| libraries = depset(linker_input.libraries), | ||
| user_link_flags = [ | ||
| flag | ||
| for flag in linker_input.user_link_flags | ||
| if flag not in coverage_link_flags | ||
| ], | ||
| additional_inputs = depset(linker_input.additional_inputs), | ||
| linkstamps = depset(linker_input.linkstamps), | ||
| )) |
| displayName: 'install opencl' | ||
| - script: | | ||
| .ci/env/apt.sh dpcpp | ||
| displayName: 'dpcpp installation' |
Contributor
There was a problem hiding this comment.
Would this actually get used if the public CI jobs are not running anything with GPUs?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Add a typed Bazel
--code_coverage=trueoption corresponding to MakeCODE_COVERAGE=yesfor supported Linux Intel compiler builds.This is a focused Make-to-Bazel option-parity improvement toward #3530. The option is disabled by default and does not instrument external dependencies.
What changed
--code_coverage=trueinterfaceGCOV_BUILDto MakeCORE.objs_a/y-equivalent DAAL modulesGCOV_BUILDdefine scope-Xscoveragefor DPC++ link actions while leaving DPC++ compilation unchangedValidation
Validated on Linux before push; pushed exact head is
d7002469af09b3f84cab54af2d57ed5df9f032c3(the final two changes after validation were comment/table-whitespace only).Focused action matrix
ICX/DPC++ Bazel aquery checks verified:
GCOV_BUILDand-coverage-coverage, noGCOV_BUILD-coverage, noGCOV_BUILD-coveragenorGCOV_BUILD-coverage-XscoverageBuild/test proof
CC=icx CXX=icpx bazelisk test \ //cpp/daal/src/algorithms/dtrees/gbt/regression:test_gbt_regression_model_builder_unit_host \ --code_coverage=true --cpu=sse2 --jobs=2 --test_output=errorsResult: 1/1 passed. The run produced 152
.gcdafiles.Result: passed with the real DPC++ module link using
-Xscoverage.GCC selection was also verified to fail analysis with the intended diagnostic. CI YAML parse,
git diff --check, andgit show --checkpassed.Scope notes
Make enables this mode only for
CODE_COVERAGE=yeson Linux. Bazel is stricter: unsupported targets/compiler selections fail clearly instead of silently disabling coverage. Static archive actions remain flag-free; final executable/test links receive the coverage driver option needed to resolve the runtime from instrumented objects.Review
Independent final review: APPROVE. Two documentation-only suggestions were applied before push.
Checklist