Skip to content
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

Remove unnecessary cc_test coverage handling #20349

Closed
wants to merge 1 commit into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Nov 28, 2023

Both the lcov_merger and the collect_cc_coverage script are obtained from "well-known" implicit attributes of Starlark rules and do not require any further special handling.

Removing this special handling also fixes a fringe bug: When a cc_test is wrapped in another test target that applies a transition to it, the removed logic set the LCOV_MERGER variable to the untransitioned path of the lcov_merger, which will then not be available in the test sandbox since it is only added as a runfile, but the test action references it via its exec path. This resulted in a "file not found" error that broke coverage.

@fmeum fmeum changed the title Remove special cc_test handling of implicit coverage attributes Remove unnecessary cc_test coverage handling Nov 28, 2023
@fmeum fmeum marked this pull request as ready for review November 28, 2023 21:35
@fmeum
Copy link
Collaborator Author

fmeum commented Nov 28, 2023

@bazel-io flag

@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Nov 28, 2023
@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Nov 28, 2023
@iancha1992 iancha1992 added the team-Rules-CPP Issues for C++ rules label Nov 28, 2023
@iancha1992
Copy link
Member

@bazel-io fork 7.0.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Nov 28, 2023
fmeum added a commit to fmeum/with_cfg.bzl that referenced this pull request Nov 29, 2023
In addition to the the normal setup consisting of implicit attributes
and the use of `coverage_common.instrumented_files_info`, this also
requires working around a bug in `cc_test`:
bazelbuild/bazel#20349
fmeum added a commit to fmeum/with_cfg.bzl that referenced this pull request Nov 29, 2023
In addition to the the normal setup consisting of implicit attributes
and the use of `coverage_common.instrumented_files_info`, this also
requires working around a bug in `cc_test`:
bazelbuild/bazel#20349
fmeum added a commit to fmeum/with_cfg.bzl that referenced this pull request Nov 29, 2023
In addition to the the normal setup consisting of implicit attributes
and the use of `coverage_common.instrumented_files_info`, this also
requires working around a bug in `cc_test`:
bazelbuild/bazel#20349
fmeum added a commit to fmeum/with_cfg.bzl that referenced this pull request Nov 29, 2023
In addition to the the normal setup consisting of implicit attributes
and the use of `coverage_common.instrumented_files_info`, this also
requires working around a bug in `cc_test`:
bazelbuild/bazel#20349
@fmeum
Copy link
Collaborator Author

fmeum commented Dec 8, 2023

@buildbreaker2021 Friendly ping

@buildbreaker2021 buildbreaker2021 added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Dec 8, 2023
@copybara-service copybara-service bot closed this in 591d125 Dec 8, 2023
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Dec 8, 2023
@fmeum fmeum deleted the fix-cc-test-coverage branch December 8, 2023 23:54
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Dec 21, 2023
Both the `lcov_merger` and the `collect_cc_coverage` script are obtained from "well-known" implicit attributes of Starlark rules and do not require any further special handling.

Removing this special handling also fixes a fringe bug: When a `cc_test` is wrapped in another test target that applies a transition to it, the removed logic set the `LCOV_MERGER` variable to the untransitioned path of the `lcov_merger`, which will then not be available in the test sandbox since it is only added as a runfile, but the test action references it via its exec path. This resulted in a "file not found" error that broke coverage.

Closes bazelbuild#20349.

PiperOrigin-RevId: 589252093
Change-Id: I810f1b414dcfedcc8930a74390ef5c9bfd2cd030
github-merge-queue bot pushed a commit that referenced this pull request Jan 9, 2024
Both the `lcov_merger` and the `collect_cc_coverage` script are obtained
from "well-known" implicit attributes of Starlark rules and do not
require any further special handling.

Removing this special handling also fixes a fringe bug: When a `cc_test`
is wrapped in another test target that applies a transition to it, the
removed logic set the `LCOV_MERGER` variable to the untransitioned path
of the `lcov_merger`, which will then not be available in the test
sandbox since it is only added as a runfile, but the test action
references it via its exec path. This resulted in a "file not found"
error that broke coverage.

Closes #20349.

Commit
591d125

PiperOrigin-RevId: 589252093
Change-Id: I810f1b414dcfedcc8930a74390ef5c9bfd2cd030

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Co-authored-by: Ian (Hee) Cha <heec@google.com>
@iancha1992
Copy link
Member

The changes in this PR have been included in Bazel 7.1.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants