mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
Optionally generate test coverage reports
This commit is contained in:
parent
cd64ad56b9
commit
074238e9f4
3 changed files with 200 additions and 1 deletions
|
|
@ -24,6 +24,10 @@ function(configure_test)
|
|||
|
||||
list(APPEND CONFIGURE_TEST_WRAPPERS "malloc" "calloc" "realloc" "free")
|
||||
|
||||
if (enable-coverage)
|
||||
add_compile_options(-g -O0 --coverage -fprofile-arcs -ftest-coverage)
|
||||
endif()
|
||||
|
||||
list(LENGTH CONFIGURE_TEST_WRAPPERS WRAPPED_COUNT)
|
||||
|
||||
if(NOT ${WRAPPED_COUNT} STREQUAL "0")
|
||||
|
|
@ -45,5 +49,12 @@ function(configure_test)
|
|||
|
||||
target_link_libraries(${CONFIGURE_TEST_NAME}_test ${CMOCKA_LIBRARIES} ${CONFIGURE_TEST_LIBRARIES})
|
||||
|
||||
set(test_targets ${test_targets} ${CONFIGURE_TEST_NAME}_test PARENT_SCOPE)
|
||||
if (enable-coverage)
|
||||
target_link_libraries(${CONFIGURE_TEST_NAME}_test gcov)
|
||||
setup_target_for_coverage(
|
||||
${CONFIGURE_TEST_NAME}_cov
|
||||
${CONFIGURE_TEST_NAME}_test
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/coverage
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue