From 8eb69e06778f8854e64c81a4176ae6daaf5d862c Mon Sep 17 00:00:00 2001 From: AbdealiJK Date: Sat, 3 Dec 2016 23:06:11 +0530 Subject: [PATCH] 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. --- .travis.yml | 4 ++++ Makefile | 4 +++- tests/travis/run_test.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f53a8a33..85bf0c4c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,6 +70,10 @@ before_cache: after_failure: - tests/travis/travis_after_failure.sh +after_success: + - tree build + - bash <(curl -s https://codecov.io/bash) -a '-o src/ src/*.c' + notifications: email: on_success: change diff --git a/Makefile b/Makefile index 3650c6058..1560cc87e 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,9 @@ check: test ifeq ($(TEST_COVER), 1) 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 clean: diff --git a/tests/travis/run_test.sh b/tests/travis/run_test.sh index 2d3713064..2c8a14194 100755 --- a/tests/travis/run_test.sh +++ b/tests/travis/run_test.sh @@ -94,5 +94,5 @@ if [ ${TASK} == "cpp_test" ]; then make -f dmlc-core/scripts/packages.mk gtest echo "TEST_COVER=1" >> config.mk echo "GTEST_PATH="${CACHE_PREFIX} >> config.mk - make check + make cover fi