Skip to content

Commit 03eae37

Browse files
keithcopybara-github
authored andcommitted
Remove empty coverage environment
Fixes #23247 Closes #24670. PiperOrigin-RevId: 707176116 Change-Id: I71ef3c630f8130467cc6a0c730c1278ae6b0817f
1 parent b46d353 commit 03eae37

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ def _get_coverage_environment(ctx, cc_config, cc_toolchain):
11011101
}
11021102
for k in list(env.keys()):
11031103
if env[k] == None:
1104-
env[k] = ""
1104+
env.pop(k)
11051105
if cc_config.fdo_instrument():
11061106
env["FDO_DIR"] = cc_config.fdo_instrument()
11071107
return env

src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public void testGcovNotDefined() throws Exception {
349349
getConfiguredTarget("//a:lib").get(InstrumentedFilesInfo.STARLARK_CONSTRUCTOR);
350350

351351
assertThat(instrumentedFilesInfo.getCoverageEnvironment())
352-
.containsEntry("COVERAGE_GCOV_PATH", "");
352+
.doesNotContainKey("COVERAGE_GCOV_PATH");
353353
}
354354

355355
// regression test for b/319501294
@@ -496,7 +496,8 @@ public void testLlvmCoverageToolsNotDefined() throws Exception {
496496
.get(InstrumentedFilesInfo.STARLARK_CONSTRUCTOR)
497497
.getCoverageEnvironment();
498498

499-
assertThat(coverageEnv).containsAtLeast("LLVM_COV", "", "LLVM_PROFDATA", "");
499+
assertThat(coverageEnv).doesNotContainKey("LLVM_COV");
500+
assertThat(coverageEnv).doesNotContainKey("LLVM_PROFDATA");
500501
}
501502

502503
@Test

0 commit comments

Comments
 (0)