Skip to content

Commit

Permalink
Fix check targets and remove check_leak (#2430)
Browse files Browse the repository at this point in the history
* Remove check_leak target

* Fix check target names mismatch
  • Loading branch information
thomas-bc authored Dec 12, 2023
1 parent 95c42a0 commit d58a207
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 111 deletions.
2 changes: 1 addition & 1 deletion ci/tests/25-fputil-comp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ deployment="${FPRIME_DIR}/Ref"
component="SignalGen"
echo -e "${BLUE}Testing ${deployment} against fprime-util targets: ${FPUTIL_TARGETS}${NOCOLOR}"
export CHECK_TARGET_PLATFORM="native"
for target in "impl" "impl --ut" "build" "build --ut" "check --leak"
for target in "impl" "impl --ut" "build" "build --ut"
do
if [[ "${TEST_TYPE}" != "QUICK" ]] || [[ "${target}" == "generate" ]]
then
Expand Down
1 change: 0 additions & 1 deletion cmake/FPrime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ macro(fprime_setup_standard_targets)
if (FPRIME_ENABLE_UTIL_TARGETS)
register_fprime_target(target/refresh_cache)
register_fprime_ut_target(target/check)
register_fprime_ut_target(target/check_leak)
endif()
endif()
endmacro(fprime_setup_standard_targets)
Expand Down
4 changes: 2 additions & 2 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ endif()
####
# `FPRIME_ENABLE_UTIL_TARGETS`:
#
# Enables the targets required to run using `fprime-util`. These include: check, check-leak, coverage, impl, and
# testimpl targets. This switch defaults to "ON" providing those targets, but may be set to off when running within an
# Enables the targets required to run using `fprime-util`. These include: check and refresh_cache.
# This switch defaults to "ON" providing those targets, but may be set to off when running within an
# IDE where limiting the number of targets is desirable. Note: unit test targets are still only generated when running
# with -DBUILD_TESTING=ON.
#
Expand Down
17 changes: 12 additions & 5 deletions cmake/target/check.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include(target/ut)

####
# check.cmake:
#
Expand Down Expand Up @@ -46,9 +48,9 @@ function(check_add_deployment_target MODULE TARGET SOURCES DEPENDENCIES FULL_DEP
endfunction()

####
# Dict function `add_module_target`:
# Function `check_add_module_target`:
#
# Creates each module's coverage targets. Note: only run for "BUILD_TESTING=ON" builds.
# Creates each module's check targets. Note: only run for "BUILD_TESTING=ON" builds.
#
# - **MODULE_NAME:** name of the module
# - **TARGET_NAME:** name of target to produce
Expand All @@ -59,12 +61,17 @@ function(check_add_module_target MODULE_NAME TARGET_NAME SOURCE_FILES DEPENDENCI
# Protects against multiple calls to fprime_register_ut()
if (NOT BUILD_TESTING OR NOT MODULE_TYPE STREQUAL "Unit Test")
return()
elseif (NOT TARGET ${MODULE_NAME}_${TARGET_NAME})
endif()
# UTs MODULE_NAME defaults to <FPRIME_MODULE_NAME>_ut_exe
# The below handling gives CHECK_TARGET_NAME = <FPRIME_MODULE_NAME>_check
string(REGEX REPLACE "_${UT_TARGET}$" "" CHECK_TARGET_NAME "${MODULE_NAME}")
string(APPEND CHECK_TARGET_NAME "_${TARGET_NAME}")
if (NOT TARGET ${CHECK_TARGET_NAME})
add_custom_target(
"${MODULE_NAME}_${TARGET_NAME}"
"${CHECK_TARGET_NAME}"
COMMAND ${CMAKE_CTEST_COMMAND} --verbose
)
endif()
add_dependencies("${MODULE_NAME}_check" ${UT_EXE_NAME})
add_dependencies("${CHECK_TARGET_NAME}" ${UT_EXE_NAME})
add_dependencies(check ${UT_EXE_NAME})
endfunction(check_add_module_target)
98 changes: 0 additions & 98 deletions cmake/target/check_leak.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions docs/UsersGuide/user/fprime-util.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ each command's usage in more detail.
*Ai.xml file, saving significant development time. Providing the `--ut` flag will generate a unit
testing skeleton for the component.
7. `check`: Builds, if necessary, then runs unit tests in the current directory. The `--all` runs all
unit tests known to a deployment. The `--leak` flag will check for memory leaks while running the
unit tests.
unit tests known to a deployment.
8. `coverage`: Similar to check, but calculates and generates unit test code coverage reports.
9. `new`: Creates either a new component or port. Use `--component` or `--port` to specify whether
you want to create a component or port. If you would like to use a custom component
Expand Down
3 changes: 1 addition & 2 deletions docs/UsersGuide/user/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ directory) and run `fprime-util check [parameter flags]`.

Unit test check parameter | Description
---|---
`--all` | Run all unit tests, combinable with `leak` or `coverage`
`--all` | Run all unit tests, combinable with `coverage`
`--coverage` | Check for code coverage in unit tests
`--leak` | Check for memory leaks in unit tests

For example, to run all unit tests and check for code coverage, run `fprime-util check --all --coverage`.

Expand Down

0 comments on commit d58a207

Please sign in to comment.