Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.4.1] Skip over runfiles middleman artifacts without a RunfilesSupplier #24086

Merged
merged 3 commits into from
Oct 25, 2024
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 @@ -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
Loading