Skip to content

Commit

Permalink
Fix missing coverage compilations for unit-test files (#2013)
Browse files Browse the repository at this point in the history
* Fix missing coverage compilations for unit-test files

* Cleaning up .gdca removal, fixing #2008
  • Loading branch information
LeStarch authored and thomas-bc committed Aug 4, 2023
1 parent 0f4c28c commit e5fc8cd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
10 changes: 5 additions & 5 deletions cmake/target/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ function(build_setup_build_module MODULE SOURCES GENERATED EXCLUDED_SOURCES DEPE
endif()
endforeach()
set_property(TARGET "${MODULE}" PROPERTY FPRIME_TARGET_DEPENDENCIES ${TARGET_DEPENDENCIES})
# Special flags applied to modules when compiling with testing enabled
if (BUILD_TESTING)
target_compile_options("${MODULE}" PRIVATE ${FPRIME_TESTING_REQUIRED_COMPILE_FLAGS})
target_link_libraries("${MODULE}" PRIVATE ${FPRIME_TESTING_REQUIRED_LINK_FLAGS})
endif()
endfunction()

####
Expand Down Expand Up @@ -120,11 +125,6 @@ function(build_add_module_target MODULE TARGET SOURCES DEPENDENCIES)
run_ac_set("${SOURCES}" ${CUSTOM_AUTOCODERS})
resolve_dependencies(RESOLVED ${DEPENDENCIES} ${AC_DEPENDENCIES} )
build_setup_build_module("${MODULE}" "${SOURCES}" "${AC_GENERATED}" "${AC_SOURCES}" "${RESOLVED}")
# Special flags applied to modules when compiling with testing enabled
if (BUILD_TESTING)
target_compile_options("${MODULE}" PRIVATE ${FPRIME_TESTING_REQUIRED_COMPILE_FLAGS})
target_link_libraries("${MODULE}" PRIVATE ${FPRIME_TESTING_REQUIRED_LINK_FLAGS})
endif()

if (CMAKE_DEBUG_OUTPUT)
introspect("${MODULE}")
Expand Down
23 changes: 13 additions & 10 deletions cmake/target/check.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
# - **TARGET_NAME:** target name to be generated
####
function(check_add_global_target TARGET_NAME)
add_custom_target(${TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR} find . -name "*.gcda" -delete
COMMAND ${CMAKE_CTEST_COMMAND})
add_custom_target(${TARGET_NAME} COMMAND ${CMAKE_CTEST_COMMAND})
endfunction(check_add_global_target)

####
Expand All @@ -33,12 +31,18 @@ function(check_add_deployment_target MODULE TARGET SOURCES DEPENDENCIES FULL_DEP
get_property(DEPENDENCY_UTS TARGET "${DEPENDENCY}" PROPERTY FPRIME_UTS)
list(APPEND ALL_UTS ${DEPENDENCY_UTS})
endforeach()
string(REPLACE ";" "\\|" JOINED_UTS "${ALL_UTS}")
add_custom_target(${MODULE}_${TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR} find . -name "*.gcda" -delete
COMMAND ${CMAKE_CTEST_COMMAND} -R "${JOINED_UTS}"
DEPENDS ${ALL_UTS}
)
# Only run deployment UTs when some are defined
if (ALL_UTS)
string(REPLACE ";" "\\|" JOINED_UTS "${ALL_UTS}")
add_custom_target(${MODULE}_${TARGET_NAME}
COMMAND ${CMAKE_CTEST_COMMAND} -R "${JOINED_UTS}"
DEPENDS ${ALL_UTS}
)
else()
add_custom_target(${MODULE}_${TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E echo "No unit tests defined for ${MODULE}"
)
endif()
endfunction()

####
Expand All @@ -58,7 +62,6 @@ function(check_add_module_target MODULE_NAME TARGET_NAME SOURCE_FILES DEPENDENCI
elseif (NOT TARGET ${MODULE_NAME}_${TARGET_NAME})
add_custom_target(
"${MODULE_NAME}_${TARGET_NAME}"
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR} find . -name "*.gcda" -delete
COMMAND ${CMAKE_CTEST_COMMAND} --verbose
)
endif()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Flask-RESTful==0.3.9
fprime-fpp==1.2.0
fprime-gds==3.2.1a1
fprime-tools==3.2.0
gcovr==5.2
gcovr==6.0
idna==3.4
importlib-metadata==4.13.0
iniconfig==2.0.0
Expand Down

0 comments on commit e5fc8cd

Please sign in to comment.