Update drone.yml to launch gcovr and valgrind
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
NADAL Jean-Baptiste
2020-01-07 12:34:10 +01:00
parent 3f0973a9f5
commit f13295c1bd
3 changed files with 35 additions and 32 deletions

View File

@@ -23,7 +23,7 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
file(
GLOB_RECURSE
source_files
main.c
broker/nats_broker.c
devices/devices_manager.c
devices/device.c
@@ -33,7 +33,8 @@ file(
rest/rest_handler.c
)
add_executable (${PROJECT_NAME} ${source_files})
if(NOT DOMO_BUILD_TEST)
add_executable (${PROJECT_NAME} main.c ${source_files})
target_link_libraries (${PROJECT_NAME}
LINK_PUBLIC
@@ -46,29 +47,6 @@ target_link_libraries (${PROJECT_NAME}
event_pthreads
)
# 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
devices/devices_manager.c
devices/device.c
devices/outlet_dio.c
devices/shutter.c
devices/sprinkler.c
tests/test_device.c
)
target_link_libraries (test_device
LINK_PUBLIC
nats_static
qlibc-static
json-c
gcov
)
endif(DOMO_BUILD_TEST)
install (TARGETS ${PROJECT_NAME} DESTINATION local/bin)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
@@ -76,6 +54,23 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMENT "Install domo's config files."
)
add_custom_target (launch_test
COMMAND valgrind --leak-check=full --trace-children=yes --malloc-fill=AE --free-fill=BD --track-origins=yes ${CMAKE_BINARY_DIR}/bin/test_device
endif()
# 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 tests/test_device.c ${source_files})
target_link_libraries (test_device
LINK_PUBLIC
nats_static
restd-static
qlibc-static
json-c
event
event_pthreads
gcov
)
endif(DOMO_BUILD_TEST)