Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster",
"//src/main/java/com/google/devtools/build/lib/analysis:config/build_options",
"//src/main/java/com/google/devtools/build/lib/analysis:config/core_option_converters",
"//src/main/java/com/google/devtools/build/lib/analysis:config/execution_transition_factory",
"//src/main/java/com/google/devtools/build/lib/analysis:config/fragment",
"//src/main/java/com/google/devtools/build/lib/analysis:config/fragment_options",
"//src/main/java/com/google/devtools/build/lib/analysis:config/host_transition",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory;
import com.google.devtools.build.lib.analysis.config.HostTransition;
import com.google.devtools.build.lib.bazel.rules.python.BazelPyRuleClasses.PyBinaryBaseRule;
import com.google.devtools.build.lib.packages.RuleClass;
Expand Down Expand Up @@ -58,6 +59,13 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
.cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/launcher:launcher")))
.add(attr(":lcov_merger", LABEL).value(BaseRuleClasses.getCoverageOutputGeneratorLabel()))
// Add the script as an attribute in order for py_test to output code coverage results for
// code covered by CC binaries invocations.
.add(
attr("$collect_cc_coverage", LABEL)
.cfg(ExecutionTransitionFactory.create())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:collect_cc_coverage")))
.build();
}

Expand Down
9 changes: 9 additions & 0 deletions src/test/shell/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,15 @@ sh_test(
for java_version in JAVA_VERSIONS_COVERAGE
]

sh_test(
name = "bazel_coverage_py_test",
srcs = ["bazel_coverage_py_test.sh"],
data = [":test-deps"],
tags = [
"no_windows",
],
)

sh_test(
name = "bazel_coverage_sh_test",
srcs = ["bazel_coverage_sh_test.sh"],
Expand Down
Loading