Add codecoverage
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
NADAL Jean-Baptiste
2020-01-06 19:03:51 +01:00
parent e0a2ce9223
commit 3f0973a9f5
2 changed files with 15 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ steps:
image: registry.nadal-fr.com/buildroot_dev image: registry.nadal-fr.com/buildroot_dev
commands: commands:
- mkdir -p domo-iot/build - mkdir -p domo-iot/build
- cd domo-iot/build && cmake .. - cd domo-iot/build && cmake .. -DDOMO_BUILD_TEST=ON
- make - make
- name: test - name: test
@@ -29,5 +29,11 @@ steps:
- cd domo-iot/build - cd domo-iot/build
- ./bin/test_device - ./bin/test_device
- name: codecov
image: registry.nadal-fr.com/buildroot_dev
commands:
- cd domo-iot/build
- gcovr -v --object-directory=. -r ..
image_pull_secrets: image_pull_secrets:
- dockerconfigjson - dockerconfigjson

View File

@@ -5,6 +5,8 @@ project(domo-iot)
set (CMAKE_MODULE_PATH "${MODULE_PATH}") set (CMAKE_MODULE_PATH "${MODULE_PATH}")
set(CMAKE_EXPORT_COMPILE_COMMANDS On) set(CMAKE_EXPORT_COMPILE_COMMANDS On)
option(DOMO_BUILD_TEST "Build Domo test and coverage" OFF)
link_directories(${CMAKE_SOURCE_DIR}/build/lib) link_directories(${CMAKE_SOURCE_DIR}/build/lib)
include_directories (${CMAKE_SOURCE_DIR}/lib/include) include_directories (${CMAKE_SOURCE_DIR}/lib/include)
@@ -45,6 +47,10 @@ target_link_libraries (${PROJECT_NAME}
) )
# Tests # Tests
if(DOMO_BUILD_TEST)
add_definitions("-fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov --coverage")
add_executable (test_device add_executable (test_device
devices/devices_manager.c devices/devices_manager.c
devices/device.c devices/device.c
@@ -59,8 +65,9 @@ target_link_libraries (test_device
nats_static nats_static
qlibc-static qlibc-static
json-c json-c
gcov
) )
endif(DOMO_BUILD_TEST)
install (TARGETS ${PROJECT_NAME} DESTINATION local/bin) install (TARGETS ${PROJECT_NAME} DESTINATION local/bin)