diff options
author | Ulf Adams <ulfjack@google.com> | 2016-11-24 12:51:35 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-11-24 13:34:11 +0000 |
commit | 8829abaeec8fa0be7ea6d87cbfde656e9c780cf3 (patch) | |
tree | f0063ad8b10ec7a4db91948609aba5a50bc2cf94 /tools/test/test-setup.sh | |
parent | 74ffaf7a7a1611fb693d5c37469dcd6ea1bf3715 (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/test-setup.sh')
-rwxr-xr-x | tools/test/test-setup.sh | 14 |
1 files changed, 7 insertions, 7 deletions
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=$? |