-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add basic support for coverage on Windows #26603
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
Conversation
26993b5 to
22daa70
Compare
b781951 to
7df2655
Compare
|
@meisterT for the test logic and |
|
Love this; thanks for the work; my colleague has tested this PR and it fixes some issues we were having - thank you! |
76cca14 to
28195b4
Compare
|
I pushed a new commit that should fix a crash with |
|
@bazel-io fork 8.4.0 |
c-mita
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is basically fine. Although I wouldn't be surprised if this broke something internally...
|
|
||
| static void print(OutputStream outputStream, Coverage coverage, boolean outputLegacyBranches) | ||
| throws IOException { | ||
| // Emit consistent line endings across all platforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just so a report generated on Windows is identical to one generated on another OS with the same input data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much yes. The execution platform of the CoverageOutputGenerator, which otherwise doesn't matter, should not influence the output. It also simplifies the tests.
The core idea of this change is to make `collect_coverage` an `sh_binary` instead of a single `.sh` file as the former can be executed on Windows via the native launcher it creates. However, this requires a bunch of work in the test framework: * Ensure that the `collect_coverage` script has its runfiles included in `TestActionBuilder`. Along the way and to ensure consistency, clean up unnecessary cases for the runfiles of the LCOV merger tool. * Add support for launching the coverage wrapper to `tw`, which didn't have any logic for this case. * Hide the runfiles env variables meant for the test from the coverage wrapper. The wrapper has its own runfiles tree and would otherwise be mislead to reuse the test's runfiles tree, which doesn't work. Instead, wrap the environment before invoking the wrapper and then unwrap them in the wrapper. * Modify the coverage output generator to emit `\n` line endings on all platforms for consistency (and to get existing tests to pass). With these changes, `bazel_coverage_starlark_test` now passes on Windows after adding batch test variants of shell tests. Support for Java and C++ will be added in future PRs. Work towards bazelbuild#6374 Work towards bazelbuild#18839 Closes bazelbuild#26603. PiperOrigin-RevId: 799018475 Change-Id: Icdb1e6e4698b2a749fbb17f7e1a9aaa34e895d70
The core idea of this change is to make `collect_coverage` an `sh_binary` instead of a single `.sh` file as the former can be executed on Windows via the native launcher it creates. However, this requires a bunch of work in the test framework: * Ensure that the `collect_coverage` script has its runfiles included in `TestActionBuilder`. Along the way and to ensure consistency, clean up unnecessary cases for the runfiles of the LCOV merger tool. * Add support for launching the coverage wrapper to `tw`, which didn't have any logic for this case. * Hide the runfiles env variables meant for the test from the coverage wrapper. The wrapper has its own runfiles tree and would otherwise be mislead to reuse the test's runfiles tree, which doesn't work. Instead, wrap the environment before invoking the wrapper and then unwrap them in the wrapper. * Modify the coverage output generator to emit `\n` line endings on all platforms for consistency (and to get existing tests to pass). With these changes, `bazel_coverage_starlark_test` now passes on Windows after adding batch test variants of shell tests. Support for Java and C++ will be added in future PRs. Work towards bazelbuild#6374 Work towards bazelbuild#18839 Closes bazelbuild#26603. PiperOrigin-RevId: 799018475 Change-Id: Icdb1e6e4698b2a749fbb17f7e1a9aaa34e895d70
The core idea of this change is to make `collect_coverage` an `sh_binary` instead of a single `.sh` file as the former can be executed on Windows via the native launcher it creates. However, this requires a bunch of work in the test framework: * Ensure that the `collect_coverage` script has its runfiles included in `TestActionBuilder`. Along the way and to ensure consistency, clean up unnecessary cases for the runfiles of the LCOV merger tool. * Add support for launching the coverage wrapper to `tw`, which didn't have any logic for this case. * Hide the runfiles env variables meant for the test from the coverage wrapper. The wrapper has its own runfiles tree and would otherwise be mislead to reuse the test's runfiles tree, which doesn't work. Instead, wrap the environment before invoking the wrapper and then unwrap them in the wrapper. * Modify the coverage output generator to emit `\n` line endings on all platforms for consistency (and to get existing tests to pass). With these changes, `bazel_coverage_starlark_test` now passes on Windows after adding batch test variants of shell tests. Support for Java and C++ will be added in future PRs. Work towards #6374 Work towards #18839 Closes #26603. PiperOrigin-RevId: 799018475 Change-Id: Icdb1e6e4698b2a749fbb17f7e1a9aaa34e895d70 Commit: 74285e2 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
The core idea of this change is to make
collect_coverageansh_binaryinstead of a single.shfile as the former can be executed on Windows via the native launcher it creates. However, this requires a bunch of work in the test framework:collect_coveragescript has its runfiles included inTestActionBuilder. Along the way and to ensure consistency, clean up unnecessary cases for the runfiles of the LCOV merger tool.tw, which didn't have any logic for this case.\nline endings on all platforms for consistency (and to get existing tests to pass).With these changes,
bazel_coverage_starlark_testnow passes on Windows after adding batch test variants of shell tests. Support for Java and C++ will be added in future PRs.Work towards #6374
Work towards #18839