From 4c1eb16dc747abf87468b8164ad372160a65e964 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 17 Dec 2024 11:15:19 -0800 Subject: [PATCH] [7.5.0] Remove empty coverage environment Fixes https://github.com/bazelbuild/bazel/issues/23247 Closes https://github.com/bazelbuild/bazel/issues/24768 PiperOrigin-RevId: 707176116 Change-Id: I71ef3c630f8130467cc6a0c730c1278ae6b0817f (cherry picked from commit 03eae37f24dbaaacf8a0fa4299bd452b643014b8) --- src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl | 2 +- .../build/lib/rules/cpp/CcToolchainProviderTest.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl index b79690d9be2395..e96fa0c0a84713 100644 --- a/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl @@ -1104,7 +1104,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 diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java index abcea6435ddc22..501de55af4001d 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java @@ -338,7 +338,7 @@ public void testGcovNotDefined() throws Exception { break; } } - assertThat(gcovPath).isEmpty(); + assertThat(gcovPath).isNull(); } @Test @@ -471,10 +471,8 @@ public void testLlvmCoverageToolsNotDefined() throws Exception { } } - assertThat(llvmCov).isNotNull(); - assertThat(llvmCov).isEmpty(); - assertThat(llvmProfdata).isNotNull(); - assertThat(llvmProfdata).isEmpty(); + assertThat(llvmCov).isNull(); + assertThat(llvmProfdata).isNull(); } @Test