Create blank coverage reports before running tests This ensures that the output file bazel expects exists even if the coverage test task times out. If it does not exist then the final coverage-aggregation action will not run because it is missing an input file. Closes #13278. PiperOrigin-RevId: 366964262
diff --git a/tools/test/collect_coverage.sh b/tools/test/collect_coverage.sh index 43efda7..4a1b82c 100755 --- a/tools/test/collect_coverage.sh +++ b/tools/test/collect_coverage.sh
@@ -146,15 +146,15 @@ # TODO(bazel-team): cd should be avoided. cd "$TEST_SRCDIR/$TEST_WORKSPACE" - # Execute the test. - "$@" - TEST_STATUS=$? - # Always create the coverage report. if [[ "$SPLIT_COVERAGE_POST_PROCESSING" == "0" ]]; then touch $COVERAGE_OUTPUT_FILE fi + # Execute the test. + "$@" + TEST_STATUS=$? + if [[ $TEST_STATUS -ne 0 ]]; then echo -- echo Coverage runner: Not collecting coverage for failed test.