aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/coverage
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2017-05-23 17:48:14 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-05-23 20:12:04 +0200
commit8a5752dcaa30fe7cd754c88d5b0230e75aed0c70 (patch)
tree97bd82af8773ccf2efd0d59e1ca324c237ef8af5 /tools/coverage
parentf6c4d6d66118410b1139a84fe34ba8134661bfa2 (diff)
Add functionality from the old shell-based coverage runner script to the new one.
This isn't a principled solution, but since it depends on /usr/bin/lcov, it should never be relied on at all. It's mostly a courtesy to people who came to use C++ coverage in Bazel before we removed it. Fixes #2685. Progress on #1118. RELNOTES: None. PiperOrigin-RevId: 156866370
Diffstat (limited to 'tools/coverage')
-rwxr-xr-xtools/coverage/collect-coverage.sh58
1 files changed, 2 insertions, 56 deletions
diff --git a/tools/coverage/collect-coverage.sh b/tools/coverage/collect-coverage.sh
index 85875c08a2..f54b622362 100755
--- a/tools/coverage/collect-coverage.sh
+++ b/tools/coverage/collect-coverage.sh
@@ -1,5 +1,4 @@
#!/bin/bash
-
# Copyright 2016 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,59 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-ROOT="$PWD"
-if [[ $COVERAGE_OUTPUT_FILE != /* ]]; then
- COVERAGE_OUTPUT_FILE="${ROOT}/${COVERAGE_OUTPUT_FILE}"
-fi
-if [[ "$COVERAGE_MANIFEST" != /* ]]; then
- export COVERAGE_MANIFEST="${ROOT}/${COVERAGE_MANIFEST}"
-fi
-
-export COVERAGE_DIR="$(mktemp -d ${TMPDIR:-/tmp}/tmp.XXXXXXXXXX)"
-trap "{ rm -rf ${COVERAGE_DIR} }" EXIT
-
-# C++ env variables
-export GCOV_PREFIX_STRIP=3
-export GCOV_PREFIX="${COVERAGE_DIR}"
-
-touch "${COVERAGE_OUTPUT_FILE}"
-
-DIR="$TEST_SRCDIR"
-if [ ! -z "$TEST_WORKSPACE" ]; then
- DIR="$DIR"/"$TEST_WORKSPACE"
-fi
-cd "$DIR" || { echo "Could not chdir $DIR"; exit 1; }
-"$@"
-TEST_STATUS=$?
-
-if [[ ${TEST_STATUS} -ne 0 ]]; then
- echo "--"
- echo "Coverage runner: Not collecting coverage for failed test."
- echo "The following commands failed with status ${TEST_STATUS}:"
- echo "$@"
- exit ${TEST_STATUS}
-fi
-
-echo "--"
-echo "Post-processing coverage results:"
-
-cat "${COVERAGE_MANIFEST}" | grep ".gcno$" | while read path; do
- mkdir -p "${COVERAGE_DIR}/$(dirname ${path})"
- cp "${ROOT}/${path}" "${COVERAGE_DIR}/${path}"
-done
-
-# Unfortunately, lcov messes up the source file names if it can't find the files
-# at their relative paths. Workaround by creating empty source files according
-# to the manifest (i.e., only for files that are supposed to be instrumented).
-cat "${COVERAGE_MANIFEST}" | egrep ".(cc|h)$" | while read path; do
- mkdir -p "${COVERAGE_DIR}/$(dirname ${path})"
- touch "${COVERAGE_DIR}/${path}"
-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}"
-
-# The paths are all wrong, because they point to /tmp. Fix up the paths to
-# point to the exec root instead (${ROOT}).
-sed -i -e "s*${COVERAGE_DIR}*${ROOT}*g" "${COVERAGE_OUTPUT_FILE}"
+# This file should be removed.
+exit 1