Skip to content

bazel/coverage: Merge without Bazel's merger when it is not staged - #5591

Merged
phlax merged 1 commit into
envoyproxy:workspacefrom
phlax:workspace-merger-bazel7
Nov 13, 2026
Merged

phlax merged 1 commit into
envoyproxy:workspacefrom
phlax:workspace-merger-bazel7

Conversation

@phlax

@phlax phlax commented Nov 13, 2026

Copy link
Copy Markdown
Member

Bazel 7 runs the coverage output generator inside the test action (no split postprocessing) with only its executable staged: there is no runfiles tree beside it, and the test's own runfiles carry neither runfiles.bash nor Bazel's Java merger. lcov_merger.sh therefore failed every test with cannot find runfiles.bash, leaving a dangling _coverage/gcov link that fails the test's outputs. Confirmed from a failing test action's inputs on EngFlow: bazel-out/<exec>/bin/external/envoy_toolshed/coverage/ holds only lcov_merger.sh, and nothing of @bazel_tools//tools/test:lcov_merger is staged.

Without Bazel's merger, the wrapper now merges itself. For C++ the only input is the lcov that collect_cc_coverage.sh exports into the coverage directory, and the merge is what Bazel's merger does with it:

  • rename reported sources to their actual paths (--sources_to_replace_file)
  • drop sources matching --filter_sources
  • keep only the sources in the source file manifest (--source_file_manifest)

Records are then stripped and the coverage directory cleaned as before. Where Bazel's merger is available (Bazel 8 and up), nothing changes.

Adds a test running the merger with no runfiles tree, covering renaming, filtering, manifest selection, record stripping and cleanup.

Tested with Envoy's release/v1.38 (Bazel 7.7.1) on envoy-ci-staging (envoyproxy/envoy-ci-staging#2164), pinned to this commit: fuzz coverage executes and passes all 80 tests, where every run before failed at its first test.

Bazel 7 runs the coverage output generator inside the test action (no
split postprocessing) with only its executable staged: there is no
runfiles tree beside it, and the test's own runfiles carry neither
runfiles.bash nor Bazel's Java merger. The wrapper failed every test with
"cannot find runfiles.bash", leaving a dangling `_coverage/gcov` link
that fails the test's outputs.

Without Bazel's merger, merge in the wrapper instead. For C++, the only
input is the lcov that collect_cc_coverage.sh exports into the coverage
directory, and the merge is what Bazel's merger does with it: rename
reported sources to their actual paths (--sources_to_replace_file), drop
sources matching --filter_sources, and keep only the sources in the
source file manifest. Records are then stripped and the directory
cleaned as before. Where Bazel's merger is available (Bazel 8 and up),
nothing changes.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax merged commit 09ed749 into envoyproxy:workspace Nov 13, 2026
29 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to envoyproxy/envoy that referenced this pull request Nov 17, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 18, 2026
0.4.13.post3 has the coverage merger and llvm-cov wrapper backported to
the WORKSPACE line (envoyproxy/toolshed#5588), used to postprocess
coverage inside the test action, and its merge for Bazel 7, which does
not stage Bazel's own merger in the test action (envoyproxy/toolshed#5591).

Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant