Always emit coverage, even if the exe returns non-zero

Coverage can be useful for debugging unfamiliar code. If the bug causes a non-zero exit, then we still want the coverage to be generated.

Change-Id: I2d218cd4bb1395c71553e1baab78fb6ca9d41cca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35422
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2020-12-12 16:19:54 +00:00 committed by Commit Bot service account
parent ce33d42b41
commit 2abecbba16
1 changed files with 3 additions and 2 deletions

View File

@ -15,8 +15,6 @@
# See https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
set -e # Fail on any error.
if [ ! -x "$(which llvm-profdata)" ] ; then
echo "error: llvm-profdata needs to be on \$PATH to use $0"
exit 1
@ -50,6 +48,9 @@ SUMMARY_FILE="${ROOT_DIR}/coverage.summary"
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program
LLVM_PROFILE_FILE="${PROFRAW_FILE}" $@
# Fail on any error after running the target executable
set -e
# Index the coverage data
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#creating-coverage-reports
llvm-profdata merge -sparse "${PROFRAW_FILE}" -o "${PROFDATA_FILE}"