Commit 74285e2
Add basic support for coverage on Windows
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: Icdb1e6e4698b2a749fbb17f7e1a9aaa34e895d701 parent 2056b86 commit 74285e2
File tree
12 files changed
+254
-130
lines changed- src
- main/java/com/google/devtools/build/lib
- analysis
- starlark
- test
- exec
- test/shell/bazel
- tools/launcher
- tools/test
- CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator
- windows
12 files changed
+254
-130
lines changedLines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
311 | 310 | | |
312 | 311 | | |
313 | 312 | | |
| |||
Lines changed: 15 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
221 | 220 | | |
222 | 221 | | |
223 | 222 | | |
224 | | - | |
| 223 | + | |
225 | 224 | | |
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
229 | 228 | | |
230 | | - | |
231 | | - | |
| 229 | + | |
232 | 230 | | |
233 | 231 | | |
234 | 232 | | |
235 | | - | |
236 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
307 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
308 | 296 | | |
309 | 297 | | |
310 | 298 | | |
| |||
417 | 405 | | |
418 | 406 | | |
419 | 407 | | |
420 | | - | |
421 | 408 | | |
422 | 409 | | |
423 | 410 | | |
| |||
Lines changed: 8 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
| 170 | + | |
172 | 171 | | |
173 | 172 | | |
174 | 173 | | |
| |||
197 | 196 | | |
198 | 197 | | |
199 | 198 | | |
200 | | - | |
| 199 | + | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
| 216 | + | |
218 | 217 | | |
219 | 218 | | |
220 | 219 | | |
| |||
272 | 271 | | |
273 | 272 | | |
274 | 273 | | |
275 | | - | |
276 | 274 | | |
277 | 275 | | |
278 | 276 | | |
| |||
331 | 329 | | |
332 | 330 | | |
333 | 331 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | 332 | | |
340 | 333 | | |
341 | 334 | | |
| |||
348 | 341 | | |
349 | 342 | | |
350 | 343 | | |
351 | | - | |
| 344 | + | |
352 | 345 | | |
353 | 346 | | |
354 | 347 | | |
| |||
1080 | 1073 | | |
1081 | 1074 | | |
1082 | 1075 | | |
1083 | | - | |
| 1076 | + | |
1084 | 1077 | | |
1085 | 1078 | | |
1086 | 1079 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
507 | 512 | | |
508 | 513 | | |
509 | 514 | | |
| |||
513 | 518 | | |
514 | 519 | | |
515 | 520 | | |
516 | | - | |
517 | 521 | | |
518 | | - | |
519 | 522 | | |
520 | 523 | | |
521 | | - | |
522 | | - | |
| 524 | + | |
523 | 525 | | |
524 | 526 | | |
525 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
| 606 | + | |
606 | 607 | | |
607 | 608 | | |
608 | 609 | | |
| |||
619 | 620 | | |
620 | 621 | | |
621 | 622 | | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | 623 | | |
626 | 624 | | |
627 | 625 | | |
| |||
0 commit comments