Skip to content

Commit 396177d

Browse files
committed
Make CC_CODE_COVERAGE_SCRIPT failures fail tests
If you're editing, or overriding, this script and you introduce and introduce an error, previously this wouldn't fail the test invocation.
1 parent 2fab071 commit 396177d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/test/shell/bazel/bazel_coverage_sh_test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ source "${CURRENT_DIR}/../integration_test_setup.sh" \
2323
source "${CURRENT_DIR}/coverage_helpers.sh" \
2424
|| { echo "coverage_helpers.sh not found!" >&2; exit 1; }
2525

26-
2726
function set_up_sh_test_coverage() {
2827
add_rules_shell "MODULE.bazel"
2928
add_rules_java "MODULE.bazel"

tools/test/collect_coverage.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,11 @@ fi
179179
# TODO(bazel-team): cd should be avoided.
180180
cd $ROOT
181181
# Call the C++ code coverage collection script.
182-
if [[ "$CC_CODE_COVERAGE_SCRIPT" ]]; then
183-
eval "${CC_CODE_COVERAGE_SCRIPT}"
182+
if [[ -n "$GENERATE_LLVM_LCOV" && "$CC_CODE_COVERAGE_SCRIPT" ]]; then
183+
if ! eval "${CC_CODE_COVERAGE_SCRIPT}" && test -z "${IGNORE_COVERAGE_COLLECTION_FAILURES:-}"; then
184+
echo "error: coverage collection script failed" >&2
185+
exit 1
186+
fi
184187
fi
185188

186189
if [[ -z "$LCOV_MERGER" ]]; then

0 commit comments

Comments
 (0)