Skip to content

Commit

Permalink
Add option to enable coverage reports
Browse files Browse the repository at this point in the history
  • Loading branch information
sphaerophoria committed Nov 18, 2019
1 parent 6bb8626 commit 1dc06ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ endif()

include(CTest)

set(REPORT_COVERAGE OFF CACHE BOOL "Generate coverage reports")

# I'm sure I could do this better but I don't want to spend my time on cmake really
function(tox_extension_messages_test test_name)
add_executable(${test_name} ${ARGN})
# we use gnu11 for the tests so we can use the container_of macro for inheritance a la linux
# Force _DEBUG for tests since we use the assert macro for verification
if(REPORT_COVERAGE)
target_compile_options(${test_name} PRIVATE -Wall -Wextra -Werror -std=gnu11 -ftest-coverage -fprofile-arcs -D_DEBUG -UNDEBUG)
#target_link_options(${test_name} PRIVATE -fprofile-arcs -ftest-coverage)
target_link_libraries(${test_name} gcov ToxExt::Mock)
else()
target_compile_options(${test_name} PRIVATE -Wall -Wextra -Werror -std=gnu11 -D_DEBUG -UNDEBUG)
target_link_libraries(${test_name} ToxExt::Mock)
endif()
target_include_directories(${test_name} PRIVATE "${TOXCORE_INCLUDEDIR}")
add_test(${test_name} ${test_name})
endfunction(tox_extension_messages_test)
Expand Down

0 comments on commit 1dc06ac

Please sign in to comment.