aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/test
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2016-11-24 12:51:35 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-11-24 13:34:11 +0000
commit8829abaeec8fa0be7ea6d87cbfde656e9c780cf3 (patch)
treef0063ad8b10ec7a4db91948609aba5a50bc2cf94 /tools/test
parent74ffaf7a7a1611fb693d5c37469dcd6ea1bf3715 (diff)
Coverage support.
- open source CoverageCommand.java - add a collect-coverage.sh script - update test-setup.sh to be compatible with the coverage collector - update StandaloneTestStrategy to provide the necessary env variables - update StandaloneTestStrategy to set the right command line for coverage - add support for C++ coverage An HTML report can then be generated with genhtml like this: genhtml -o report/ -p "$(readlink -f bazel-<project>)" path/to/coverage.dat Progress on #1118. -- MOS_MIGRATED_REVID=140125715
Diffstat (limited to 'tools/test')
-rw-r--r--tools/test/BUILD4
-rw-r--r--tools/test/dummy_coverage_report_generator2
-rwxr-xr-xtools/test/test-setup.sh14
3 files changed, 9 insertions, 11 deletions
diff --git a/tools/test/BUILD b/tools/test/BUILD
index 846016ba8b..97438edda6 100644
--- a/tools/test/BUILD
+++ b/tools/test/BUILD
@@ -9,12 +9,12 @@ filegroup(
filegroup(
name = "coverage_support",
- srcs = [],
+ srcs = ["//tools/coverage:coverage_support"],
)
filegroup(
name = "coverage_report_generator",
- srcs = ["dummy_coverage_report_generator"],
+ srcs = ["//tools/coverage:coverage_report_generator"],
)
filegroup(
diff --git a/tools/test/dummy_coverage_report_generator b/tools/test/dummy_coverage_report_generator
deleted file mode 100644
index 27c43ad8c2..0000000000
--- a/tools/test/dummy_coverage_report_generator
+++ /dev/null
@@ -1,2 +0,0 @@
-# Dummy file. Bazel requires there to be a single file in the coverage report
-# generator attribute, even though it's currently not used in Bazel.
diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh
index c045f39144..14d7fd9a76 100755
--- a/tools/test/test-setup.sh
+++ b/tools/test/test-setup.sh
@@ -46,13 +46,12 @@ if [[ -n "${TEST_TOTAL_SHARDS+x}" ]] && ((TEST_TOTAL_SHARDS != 0)); then
fi
export GTEST_TMP_DIR="${TEST_TMPDIR}"
-DIR="$TEST_SRCDIR"
-RUNFILES_MANIFEST_FILE=$DIR/MANIFEST
+RUNFILES_MANIFEST_FILE="${TEST_SRCDIR}/MANIFEST"
if [ -z "$RUNFILES_MANIFEST_ONLY" ]; then
function rlocation() {
if [[ "$1" = /* ]]; then
- echo $1
+ echo "$1"
else
echo "$(dirname $RUNFILES_MANIFEST_FILE)/$1"
fi
@@ -60,7 +59,7 @@ if [ -z "$RUNFILES_MANIFEST_ONLY" ]; then
else
function rlocation() {
if [[ "$1" = /* ]]; then
- echo $1
+ echo "$1"
else
echo $(grep "^$1 " $RUNFILES_MANIFEST_FILE | awk '{ print $2 }')
fi
@@ -70,11 +69,11 @@ fi
export -f rlocation
export RUNFILES_MANIFEST_FILE
-if [ ! -z "$TEST_WORKSPACE" ]
-then
+DIR="$TEST_SRCDIR"
+if [ ! -z "$TEST_WORKSPACE" ]; then
DIR="$DIR"/"$TEST_WORKSPACE"
fi
-
+[[ -n "$RUNTEST_PRESERVE_CWD" ]] && DIR="$PWD"
# normal commands are run in the exec-root where they have access to
@@ -100,6 +99,7 @@ if [[ "$TEST_NAME" = /* ]]; then
else
EXE="$(rlocation $TEST_WORKSPACE/$TEST_NAME)"
fi
+[[ -n "$RUNTEST_PRESERVE_CWD" ]] && EXE="${TEST_NAME}"
exitCode=0
"${EXE}" "$@" || exitCode=$?