Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing coverage compilations for unit-test files #2013

Merged
merged 2 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0
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