summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-07-19 18:58:37 +0300
committerKonstantin Käfer <mail@kkaefer.com>2016-08-05 11:42:22 +0200
commit0fb3b6e333901df313d404ab7507cbb4fa6baf09 (patch)
tree8ce6fae9f6dd19d295036adf03c0a3d4eed3c090
parent023ff83d881fb810f4428594ca476bb436b303f6 (diff)
downloadqtlocation-mapboxgl-0fb3b6e333901df313d404ab7507cbb4fa6baf09.tar.gz
[build] Re-enable coverage run
-rw-r--r--.travis.yml2
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile10
-rwxr-xr-xscripts/collect-coverage.sh6
4 files changed, 14 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 8715a7c752..df06cd4e2d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -78,7 +78,7 @@ matrix:
sudo: false
language: cpp
compiler: "glfw-gcc5-debug"
- env: BUILDTYPE=Debug _CXX=g++-5 _CC=gcc-5 ENABLE_COVERAGE=1
+ env: BUILDTYPE=Debug _CXX=g++-5 _CC=gcc-5 WITH_COVERAGE=1
addons: *gcc5
after_script:
- ccache --show-stats
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04b2b6c051..a7e4e1ca59 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,7 @@ mason_use(protozero 1.3.0)
mason_use(pixelmatch 0.9.0)
option(WITH_CXX11ABI "Use cxx11abi mason packages" OFF)
+option(WITH_COVERAGE "Enable coverage reports" OFF)
if(WITH_CXX11ABI)
mason_use(geojson 0.1.4-cxx11abi)
@@ -26,6 +27,11 @@ else()
mason_use(gtest 1.7.0)
endif()
+if(WITH_COVERAGE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
+endif(WITH_COVERAGE)
+
set(CMAKE_CONFIGURATION_TYPES Debug Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wshadow -Wno-variadic-macros -Wno-unknown-pragmas")
diff --git a/Makefile b/Makefile
index bb208175c8..69120145a7 100644
--- a/Makefile
+++ b/Makefile
@@ -258,7 +258,8 @@ $(LINUX_BUILD): $(BUILD_DEPS)
(cd $(LINUX_OUTPUT_PATH) && cmake -G Ninja ../../.. \
-DCMAKE_BUILD_TYPE=$(BUILDTYPE) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
- -DWITH_CXX11ABI=$(shell scripts/check-cxx11abi.sh))
+ -DWITH_CXX11ABI=$(shell scripts/check-cxx11abi.sh) \
+ -DWITH_COVERAGE=${WITH_COVERAGE})
.PHONY: linux
linux: glfw-app render offline
@@ -296,10 +297,6 @@ endif
run-test-%: test
$(GDB) $(LINUX_OUTPUT_PATH)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$*
-.PHONY: coverage
-coverage: test
- scripts/collect-coverage.sh $(LINUX_OUTPUT_PATH)
-
.PHONY: compdb
compdb: $(LINUX_BUILD)
# Ninja generator already outputs the file at the right location
@@ -334,7 +331,8 @@ $(QT_BUILD): $(BUILD_DEPS)
-DMBGL_PLATFORM=qt \
-DWITH_QT_DECODERS=${WITH_QT_DECODERS} \
-DWITH_QT_4=${WITH_QT_4} \
- -DWITH_CXX11ABI=$(shell scripts/check-cxx11abi.sh))
+ -DWITH_CXX11ABI=$(shell scripts/check-cxx11abi.sh) \
+ -DWITH_COVERAGE=${WITH_COVERAGE})
.PHONY: qt-app
qt-app: $(QT_BUILD)
diff --git a/scripts/collect-coverage.sh b/scripts/collect-coverage.sh
index efc93769f2..cd650975c6 100755
--- a/scripts/collect-coverage.sh
+++ b/scripts/collect-coverage.sh
@@ -3,8 +3,8 @@
set -e
set -o pipefail
-if [ -z ${ENABLE_COVERAGE} ] ; then
- echo "ENABLE_COVERAGE environment variable is not set, aborting."
+if [ -z ${WITH_COVERAGE} ] ; then
+ echo "WITH_COVERAGE environment variable is not set, aborting."
exit 1
fi
@@ -32,7 +32,7 @@ lcov \
>/dev/null 2>&1
# Run all unit tests
-make test-*
+make
# Collect coverage data and save it into coverage.info
echo "Collecting coverage data..."