bazelbuild / bazelbuild/bazel

bazel coverage fails on windows because test_wrapper cannot find "collect_coverage.sh"

Open
#15,835 8 comments 0 reactions 0 assignees View on GitHub
area-Windows coverage P3 team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

`bazel coverage //cpp/test:mytest`

```
ERROR(tools/test/windows/tw.cc:1294) ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\user\_bazel_user\jh7tqry3\execroot\project\bazel-out\x64_windows-fastbuild\bin\cpp\test\mytest.exe.runfiles\project\external\bazel_tools\tools\test\collect_coverage.sh" cpp/test/mytest.exe
```

My .bazelrc **does not** contain
```
startup --windows_enable_symlinks
build --enable_runfiles
```

Note how test_wrapper resolved path to `collect_coverage.sh` as to a data file under RUNFILES_DIR. The bug is that on Windows this file does not exist, because runfiles are not enabled.

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

1. have bazel project with `cc_test`
2. run `bazel coverage :test` on windows (does not matter if you use MSVC or MSYS compiler).
3. see the error above.

### Which operating system are you running Bazel on?

Windows 10

### What is the output of `bazel info release`?

development version

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

`bazel build //src:bazel-dev.exe`

Then used `bazel-bin/src/bazel-dev.exe`.

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

```text
https://github.com/futt-bucker/bazel.git
300111212f984587415ad8a1f00bf9d60b31e430
89301f45a7d2bcc3b82b918f96b9ff0037599e4c
```

### Have you found anything relevant by searching the web?

No

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in tools/test/windows/tw.cc at the test_wrapper path handling and compare it with the referenced tools/test/collect_coverage.sh location. Reproduce bazel coverage //cpp/test:mytest on Windows without runfiles enabled; done means coverage runs successfully without requiring collect_coverage.sh as an unavailable runfiles data file.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, shell
Domain
build-system, operating-systems, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.