From 4c6dc7a9ae8f5f124f1f631a80b5482c70ea295d Mon Sep 17 00:00:00 2001 From: Kai Liu Date: Thu, 22 Aug 2013 16:59:02 -0700 Subject: [PATCH] Fix the gcov/lcov related issues Summary: Jenkin reports errors that: * Linking error on some machines. The error message shows it cannot find some gcov related symbols. * lcov error due to the version issues. Test Plan: run make in different platforms Reviewers: CC: Task ID: # Blame Rev: --- Makefile | 2 +- coverage/coverage_test.sh | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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"