[build] Avoid variable name coupling between main.mk and collect-coverage.sh

This commit is contained in:
John Firebaugh
2016-05-23 16:46:09 -07:00
parent f38f58f758
commit c6256de2e8
2 changed files with 11 additions and 9 deletions

View File

@@ -8,6 +8,8 @@ if [ -z ${ENABLE_COVERAGE} ] ; then
exit 1
fi
directory=$1
function usage() {
echo "Error: LCOV and genhtml are required for generating coverage reports."
if [ `uname -s` = 'Linux' ]; then
@@ -25,8 +27,8 @@ command -v genhtml >/dev/null 2>&1 || usage
lcov \
--quiet \
--zerocounters \
--directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \
--output-file "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \
--directory "${directory}" \
--output-file "${directory}/coverage.info" \
>/dev/null 2>&1
# Run all unit tests
@@ -41,9 +43,9 @@ lcov \
--directory "src/mbgl" \
--directory "platform" \
--directory "include/mbgl" \
--directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \
--base-directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \
--output-file "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \
--directory "${directory}" \
--base-directory "${directory}" \
--output-file "${directory}/coverage.info" \
>/dev/null 2>&1
# Generate HTML report based on coverage.info
@@ -59,8 +61,8 @@ genhtml \
--sort \
--demangle-cpp \
--prefix $(pwd -P) \
--output-directory "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage" \
"build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \
--output-directory "${directory}/coverage" \
"${directory}/coverage.info" \
>/dev/null 2>&1
echo "Coverage report is now available in build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage/index.html"
echo "Coverage report is now available in ${directory}/coverage/index.html"

View File

@@ -163,4 +163,4 @@ test-%: Makefile/test
$(GDB) $(PLATFORM_OUTPUT)/$(BUILDTYPE)/test --gtest_catch_exceptions=0 --gtest_filter=$*
check: Makefile/test
./scripts/collect-coverage.sh
./scripts/collect-coverage.sh $(PLATFORM_OUTPUT)/$(BUILDTYPE)