1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00

introduced new build type "Coverage"

This commit is contained in:
Falk Werner 2019-12-01 11:01:00 +01:00
parent 6bd682d27d
commit b500ebeeaf
4 changed files with 40 additions and 29 deletions

View File

@ -16,13 +16,14 @@ env:
- PARALLELMFLAGS="-j4"
- PORTABLE_WORSPACE=1
matrix:
- BUILDTYPE=Debug MARCH=amd64 CHECK_TARGET=memcheck COVERAGE=ON
- BUILDTYPE=Release MARCH=amd64 CHECK_TARGET=memcheck COVERAGE=OFF
- BUILDTYPE=Debug MARCH=arm32v7 CHECK_TARGET=check COVERAGE=OFF
- BUILDTYPE=MinSizeRel MARCH=arm32v7 CHECK_TARGET=check COVERAGE=OFF
- BUILDTYPE=Debug MARCH=amd64 CHECK_TARGET=memcheck
- BUILDTYPE=Coverage MARCH=amd64 CHECK_TARGET=memcheck
- BUILDTYPE=Release MARCH=amd64 CHECK_TARGET=memcheck
- BUILDTYPE=Debug MARCH=arm32v7 CHECK_TARGET=check
- BUILDTYPE=MinSizeRel MARCH=arm32v7 CHECK_TARGET=check
before_script:
- make BUILDTYPE=$BUILDTYPE MARCH=$MARCH COVERAGE=$COVERAGE
- make BUILDTYPE=$BUILDTYPE MARCH=$MARCH
script:
- make BUILDTYPE=$BUILDTYPE MARCH=$MARCH COVERAGE=$COVERAGE $CHECK_TARGET
- make BUILDTYPE=$BUILDTYPE MARCH=$MARCH $CHECK_TARGET
after_success:
- bash <(curl -s https://codecov.io/bash)

View File

@ -3,7 +3,9 @@ project(webfuse VERSION 0.2.0 DESCRIPTION "Websocket filesystem based on libfuse
option(WITHOUT_TESTS "disable unit tests" OFF)
option(WITHOUT_EXAMPLE "disable example" OFF)
option(WITH_COVERAGE "enable code coverage" OFF)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(coverage)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
@ -23,25 +25,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(C_WARNINGS -Wall -Wextra)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") AND WITHOUT_COVERAGE)
add_definitions(
-pg
--coverage
-fprofile-arcs
-ftest-coverage
)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
link_libraries(gcov)
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg -fprofile-arcs")
endif()
include_directories(
"include"
${FUSE3_INCLUDE_DIRS}

View File

@ -23,7 +23,6 @@ SCRIPTDIR ?= $(PROJECTDIR)/build/mkdocker
OUTDIR ?= $(PROJECTDIR)/.build
FETCHDIR ?= $(PROJECTDIR)/.deps
BUILDTYPE ?= Debug
COVERAGE ?= OFF
SKIP_FETCH ?=
@ -116,8 +115,6 @@ OUTDIRS += $(OUTDIR)/src
EXTRACT_TARGETS += $(OUTDIR)/docker/qemu-arm-static-$(QEMU_VERSION)
EXTRACT_TARGETS += $(patsubst $(FETCHDIR)/%.tar.gz,$(OUTDIR)/src/%,$(FETCH_TARGETS))
CMAKEFLAGS += -DWITH_COVERAGE=$(COVERAGE)
#######################################################################################################################
# Makefile dependencies

30
cmake/coverage.cmake Normal file
View File

@ -0,0 +1,30 @@
set(CMAKE_C_FLAGS_COVERAGE
"${CMAKE_C_FLAGS_DEBUG} -pg --coverage -fprofile-arcs -ftest-coverage"
CACHE STRING "Flags used by the C compiler during coverage builds"
FORCE
)
set(CMAKE_CXX_FLAGS_COVERAGE
"${CMAKE_CXX_FLAGS_DEBUG} -pg --coverage -fprofile-arcs -ftest-coverage"
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE
)
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE
)
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE
)
mark_as_advanced(
CMAKE_C_FLAGS_COVERAGE
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE
)