bazelbuild / bazelbuild/bazel

Empty `coverage.dat` files after first `bazel coverage` since ca7d260

Open
#28,826 2 comments 1 reaction 0 assignees View on GitHub
coverage team-Core type: bug untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

With `last_green` Bazels containing bazelbuild/bazel@ca7d260dbeb7915a5003c044add2b85effe55e8b, `bazel coverage` commands after the first produce empty `coverage.dat` files.

Bazel versions up to and including 10.0.0-pre.20260211.1 do not exhibit this problem. Neither does a Bazel built at bazelbuild/bazel@c755b58f3a2920f30a1d0c8d998a402eef39b6de (the parent of the commit in question).

### Which category does this issue belong to?

Core

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

Using my reproduction repo: [mbland/repro-bazel-empty-coverage](https://github.com/mbland/repro-bazel-empty-coverage)

```sh
git clone git@github.com:mbland/repro-bazel-empty-coverage.git
cd repro-bazel-empty-coverage
USE_BAZEL_VERSION=last_green ./run_tests.sh

# To see the resulting `coverage.dat` files:
$ ls -l bazel-testlogs/s*/foo_test/coverage.dat
-r-xr-xr-x 1 mbland staff 0 Feb 27 17:24 bazel-testlogs/scalatest/foo_test/coverage.dat
-r-xr-xr-x 1 mbland staff 632 Feb 27 17:23 bazel-testlogs/specs2_with_junit/foo_test/coverage.dat
```

After building Bazel at bazelbuild/bazel@ca7d260dbeb7915a5003c044add2b85effe55e8b:

```sh
# Adds the locally built `bazel` to `PATH`
PATH="${HOME}/src/bazelbuild/bazel/bazel-bin/src:${PATH}" ./run_tests.sh
```

Can confirm that `./run_test.sh` passes with a Bazel built at bazelbuild/bazel@c755b58f3a2920f30a1d0c8d998a402eef39b6de (the parent of the failing commit).

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

macOS Tahoe 26.3 (25D125)

### 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.

```sh
git checkout ca7d260dbeb7915a5003c044add2b85effe55e8b
bazel build //src:bazel
```

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

```text
git@github.com:mbland/bazel.git
ca7d260dbeb7915a5003c044add2b85effe55e8b
```

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

bazelbuild/bazel@ca7d260dbeb7915a5003c044add2b85effe55e8b

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

_No response_

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by cloning mbland/repro-bazel-empty-coverage and running its run_tests.sh with the affected last_green Bazel. Compare the generated bazel-testlogs/*/foo_test/coverage.dat files with runs using the parent commit c755b58f and the failing commit ca7d260. Done means repeated bazel coverage runs produce non-empty coverage.dat files again.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.