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