Skip to content

Commit

Permalink
Skip over runfiles middleman artifacts without a RunfilesSupplier (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored Oct 25, 2024
1 parent 7d7304d commit b86ef42
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,16 @@ private int logInputSet(
for (ActionInput input : set.getLeaves()) {
if (input instanceof Artifact artifact && artifact.isMiddlemanArtifact()) {
RunfilesTree runfilesTree = runfilesTrees.get(artifact);
if (runfilesTree == null) {
// This happens for spawns that don't keep their RunfilesSuppliers in sync with
// the middleman artifacts in their inputs.
// The known examples are test spawns that include the lcov merger as a middleman
// artifact, but don't merge in its supplier, as well as split coverage
// postprocessing spawns, which include the test runfiles middleman but not its
// supplier. Since the supplier is what causes the runfiles tree to be materialized,
// we can safely ignore these stray middleman artifacts.
continue;
}
builder.addInputIds(
logRunfilesTree(
runfilesTree, inputMetadataProvider, fileSystem, isTestRunnerSpawn));
Expand Down
21 changes: 21 additions & 0 deletions src/test/shell/bazel/bazel_execlog_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,27 @@ EOF
[[ -e ../output.compact ]] || fail "no compact log produced"
}

function test_coverage() {
cat > BUILD <<'EOF'
sh_test(
name = "test",
srcs = ["test.sh"],
)
EOF
cat > test.sh <<'EOF'
echo "hello world"
EOF
chmod +x test.sh

bazel coverage //:test --execution_log_compact_file=output.compact >> $TEST_log 2>&1 || fail "coverage failed"
[[ -e output.compact ]] || fail "no compact log produced"

rm output.compact
bazel coverage //:test --experimental_split_coverage_postprocessing --experimental_fetch_all_coverage_outputs \
--execution_log_compact_file=output.compact >> $TEST_log 2>&1 || fail "coverage failed"
[[ -e output.compact ]] || fail "no compact log produced"
}

function test_no_remote_cache() {
cat > BUILD <<'EOF'
genrule(
Expand Down

0 comments on commit b86ef42

Please sign in to comment.