travis: Add code coverage on success

Update the code coverage of the project on codecov for easy viewing.

Also the gcov on travis uses a different version which cannot
find the directory of the given files, and it needs to be specified
in the -o flag. Hence now we loop over the list of files and
run them independently.
This commit is contained in:
AbdealiJK 2016-12-03 23:06:11 +05:30 committed by Tianqi Chen
parent 61a9b3a49e
commit 8eb69e0677
3 changed files with 8 additions and 2 deletions

View File

@ -70,6 +70,10 @@ before_cache:
after_failure: after_failure:
- tests/travis/travis_after_failure.sh - tests/travis/travis_after_failure.sh
after_success:
- tree build
- bash <(curl -s https://codecov.io/bash) -a '-o src/ src/*.c'
notifications: notifications:
email: email:
on_success: change on_success: change

View File

@ -160,7 +160,9 @@ check: test
ifeq ($(TEST_COVER), 1) ifeq ($(TEST_COVER), 1)
cover: check cover: check
gcov -pbcu $(COVER_OBJ) @- $(foreach COV_OBJ, $(COVER_OBJ), \
gcov -pbcul -o $(shell dirname $(COV_OBJ)) $(COV_OBJ) > gcov.log || cat gcov.log; \
)
endif endif
clean: clean:

View File

@ -94,5 +94,5 @@ if [ ${TASK} == "cpp_test" ]; then
make -f dmlc-core/scripts/packages.mk gtest make -f dmlc-core/scripts/packages.mk gtest
echo "TEST_COVER=1" >> config.mk echo "TEST_COVER=1" >> config.mk
echo "GTEST_PATH="${CACHE_PREFIX} >> config.mk echo "GTEST_PATH="${CACHE_PREFIX} >> config.mk
make check make cover
fi fi