diff --git a/Makefile b/Makefile index b4051f9dc..00fa1dfc2 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,7 @@ release: coverage: $(MAKE) clean - COVERAGEFLAGS="-fprofile-arcs -ftest-coverage" $(MAKE) all check + COVERAGEFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS+="-lgcov" $(MAKE) all check (cd coverage; ./coverage_test.sh) # Delete intermediate files find . -type f -regex ".*\.\(\(gcda\)\|\(gcno\)\)" | xargs --no-run-if-empty rm diff --git a/coverage/coverage_test.sh b/coverage/coverage_test.sh index 86ea06bcb..7a8b5e0fe 100755 --- a/coverage/coverage_test.sh +++ b/coverage/coverage_test.sh @@ -55,12 +55,19 @@ then exit 0 fi +LCOV_VERSION=$(lcov -v | grep 1.1 || true) +if [ $LCOV_VERSION ] +then + echo "Not supported lcov version. Expect lcov 1.1." + exit 0 +fi + (cd $ROOT; lcov --no-external \ --capture \ --directory $PWD \ --gcov-tool $GCOV \ - --output-file $COVERAGE_DIR/coverage.info &>/dev/null) + --output-file $COVERAGE_DIR/coverage.info) -genhtml $COVERAGE_DIR/coverage.info -o $COVERAGE_DIR &>/dev/null +genhtml $COVERAGE_DIR/coverage.info -o $COVERAGE_DIR echo "HTML Coverage report is generated in $COVERAGE_DIR"