From f6544a75e7fc418b9b826e92833557a9c40ab7c9 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 28 Oct 2024 03:03:58 -0700 Subject: [PATCH] Verify that the compact execlog supports `bazel coverage` Related to #24061, which doesn't affect Bazel 8 Closes #24083. PiperOrigin-RevId: 690535547 Change-Id: I25644d798a33ff0d6c90510fbcebf1bbbc332d40 --- src/test/shell/bazel/bazel_execlog_test.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/shell/bazel/bazel_execlog_test.sh b/src/test/shell/bazel/bazel_execlog_test.sh index 660fb1639d2293..b2418a5fa2fd72 100755 --- a/src/test/shell/bazel/bazel_execlog_test.sh +++ b/src/test/shell/bazel/bazel_execlog_test.sh @@ -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(