aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/test
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2018-04-16 05:20:02 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-16 05:21:26 -0700
commit83ed5461db0dab0a99ffdd8c76be8847ba1162bc (patch)
tree6facb7ae276db59df7a0563903412723e58f9e60 /tools/test
parent81ed3add408adb20bddbc3ba1818c65806738dc5 (diff)
Ignore missing .gcno files in coverage collection
Bazel uses an instrumentation filter to collect coverage from a subset of source files. Without this flag, lcov fails if the instrumentation filter does not cover everything in the source tree (i.e., --instrumentation_filter=.*). Some progress on #1118. PiperOrigin-RevId: 193023189
Diffstat (limited to 'tools/test')
-rwxr-xr-xtools/test/collect_coverage.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/test/collect_coverage.sh b/tools/test/collect_coverage.sh
index d4251395b3..aba56c0ee1 100755
--- a/tools/test/collect_coverage.sh
+++ b/tools/test/collect_coverage.sh
@@ -127,10 +127,17 @@ if [[ "$COVERAGE_LEGACY_MODE" ]]; then
done
# Run lcov over the .gcno and .gcda files to generate the lcov tracefile.
- /usr/bin/lcov -c --no-external -d "${COVERAGE_DIR}" -o "${COVERAGE_OUTPUT_FILE}"
+ # -c - Collect coverage data
+ # --no-external - Do not collect coverage data for system files
+ # --ignore-errors graph - Ignore missing .gcno files; Bazel only instruments some files
+ # -d "${COVERAGE_DIR}" - Directory to search for .gcda files
+ # -o "${COVERAGE_OUTPUT_FILE}" - Output file
+ /usr/bin/lcov -c --no-external --ignore-errors graph \
+ -d "${COVERAGE_DIR}" -o "${COVERAGE_OUTPUT_FILE}"
# The paths are all wrong, because they point to /tmp. Fix up the paths to
# point to the exec root instead (${ROOT}).
+ # This does not work with sandboxing, because ${ROOT} points to the sandbox dir.
sed -i -e "s*${COVERAGE_DIR}*${ROOT}*g" "${COVERAGE_OUTPUT_FILE}"
exit $TEST_STATUS