Update drone.yml to launch gcovr and valgrind
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -27,13 +27,13 @@ steps:
|
|||||||
image: registry.nadal-fr.com/buildroot_dev
|
image: registry.nadal-fr.com/buildroot_dev
|
||||||
commands:
|
commands:
|
||||||
- cd domo-iot/build
|
- cd domo-iot/build
|
||||||
- ./bin/test_device
|
- make launch_test
|
||||||
|
|
||||||
- name: codecov
|
- name: gcovr
|
||||||
image: registry.nadal-fr.com/buildroot_dev
|
image: registry.nadal-fr.com/buildroot_dev
|
||||||
commands:
|
commands:
|
||||||
- cd domo-iot/build
|
- cd domo-iot/build
|
||||||
- gcovr -v --object-directory=. -r ..
|
- make gcovr
|
||||||
|
|
||||||
image_pull_secrets:
|
image_pull_secrets:
|
||||||
- dockerconfigjson
|
- dockerconfigjson
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ add_custom_target (static_analysis
|
|||||||
COMMAND ${CMAKE_SOURCE_DIR}/tools/static_analysis.sh ${CMAKE_SOURCE_DIR}/build
|
COMMAND ${CMAKE_SOURCE_DIR}/tools/static_analysis.sh ${CMAKE_SOURCE_DIR}/build
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target (valgrind
|
add_custom_target (launch_test
|
||||||
COMMAND valgrind --leak-check=full --trace-children=yes --malloc-fill=AE --free-fill=BD --track-origins=yes ${CMAKE_SOURCE_DIR}/build/bin/domo-iot
|
COMMAND valgrind --leak-check=full --trace-children=yes --malloc-fill=AE --free-fill=BD --track-origins=yes ${CMAKE_SOURCE_DIR}/build/bin/test_device
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target (gcovr
|
||||||
|
COMMAND gcovr -v --object-directory=${CMAKE_BINARY_DIR} -r ${CMAKE_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target (gcovr_html
|
||||||
|
COMMAND gcovr -v --object-directory=${CMAKE_BINARY_DIR} -r ${CMAKE_SOURCE_DIR} -o ${CMAKE_BINARY_DIR}/domo-iot.html --html --html-details
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
|
|||||||
file(
|
file(
|
||||||
GLOB_RECURSE
|
GLOB_RECURSE
|
||||||
source_files
|
source_files
|
||||||
main.c
|
|
||||||
broker/nats_broker.c
|
broker/nats_broker.c
|
||||||
devices/devices_manager.c
|
devices/devices_manager.c
|
||||||
devices/device.c
|
devices/device.c
|
||||||
@@ -33,7 +33,8 @@ file(
|
|||||||
rest/rest_handler.c
|
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}
|
target_link_libraries (${PROJECT_NAME}
|
||||||
LINK_PUBLIC
|
LINK_PUBLIC
|
||||||
@@ -46,29 +47,6 @@ target_link_libraries (${PROJECT_NAME}
|
|||||||
event_pthreads
|
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)
|
install (TARGETS ${PROJECT_NAME} DESTINATION local/bin)
|
||||||
|
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
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."
|
COMMENT "Install domo's config files."
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target (launch_test
|
endif()
|
||||||
COMMAND valgrind --leak-check=full --trace-children=yes --malloc-fill=AE --free-fill=BD --track-origins=yes ${CMAKE_BINARY_DIR}/bin/test_device
|
|
||||||
|
# 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user