Skip to content

Commit

Permalink
[8.1.0] Remove empty coverage environment (#24977)
Browse files Browse the repository at this point in the history
Fixes #23247

Closes #24670.

PiperOrigin-RevId: 707176116
Change-Id: I71ef3c630f8130467cc6a0c730c1278ae6b0817f

Commit
03eae37

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
  • Loading branch information
bazel-io and keith authored Jan 20, 2025
1 parent 07ff8ef commit 8713eab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ def _get_coverage_environment(ctx, cc_config, cc_toolchain):
}
for k in list(env.keys()):
if env[k] == None:
env[k] = ""
env.pop(k)
if cc_config.fdo_instrument():
env["FDO_DIR"] = cc_config.fdo_instrument()
return env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public void testGcovNotDefined() throws Exception {
getConfiguredTarget("//a:lib").get(InstrumentedFilesInfo.STARLARK_CONSTRUCTOR);

assertThat(instrumentedFilesInfo.getCoverageEnvironment())
.containsEntry("COVERAGE_GCOV_PATH", "");
.doesNotContainKey("COVERAGE_GCOV_PATH");
}

// regression test for b/319501294
Expand Down Expand Up @@ -503,7 +503,8 @@ public void testLlvmCoverageToolsNotDefined() throws Exception {
.get(InstrumentedFilesInfo.STARLARK_CONSTRUCTOR)
.getCoverageEnvironment();

assertThat(coverageEnv).containsAtLeast("LLVM_COV", "", "LLVM_PROFDATA", "");
assertThat(coverageEnv).doesNotContainKey("LLVM_COV");
assertThat(coverageEnv).doesNotContainKey("LLVM_PROFDATA");
}

@Test
Expand Down

0 comments on commit 8713eab

Please sign in to comment.