Tests can now be built as part of FSFW and versioning moved to CMake #500

Merged
mohr merged 33 commits from KSat/fsfw:mueller/integrated-unittests into development 2021-10-18 14:42:53 +02:00
Showing only changes of commit dd1631a456 - Show all commits

View File

@ -40,6 +40,7 @@ set(FSFW_TEST_TGT fsfw-tests)
add_library(${LIB_FSFW_NAME})
if(FSFW_BUILD_UNITTESTS)
message(STATUS "Building the FSFW unittests in addition to the static library")
mohr marked this conversation as resolved
Review

had to set set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg)

had to set `set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg)`
Review

That is possible as well. The path was always set to the user configuration path for my examples

That is possible as well. The path was always set to the user configuration path for my examples
# Check whether the user has already installed Catch2 first
find_package(Catch2 3)
# Not installed, so use FetchContent to download and provide Catch2
@ -61,12 +62,17 @@ if(FSFW_BUILD_UNITTESTS)
add_executable(${FSFW_TEST_TGT})
if(FSFW_TESTS_GEN_COV)
message(STATUS "Generating coverage data for the library")
message(STATUS "Targets linking against ${LIB_FSFW_NAME} "
"will be compiled with coverage data as well"
)
include(FetchContent)
FetchContent_Declare(
cmake-modules
GIT_REPOSITORY https://github.com/bilke/cmake-modules.git
)
FetchContent_MakeAvailable(cmake-modules)
set(CMAKE_BUILD_TYPE "Debug")
list(APPEND CMAKE_MODULE_PATH ${cmake-modules_SOURCE_DIR})
include(CodeCoverage)
endif()
@ -190,6 +196,11 @@ if(FSFW_BUILD_UNITTESTS)
-fprofile-arcs
Review

for me, "*/catch2-src/*" was needed to get catch2 out of the reports.

How do you feel about adding "*/fsfw_tests/*" as well, seems to be a bit too meta to coverage the coverage tests.

for me, `"*/catch2-src/*"` was needed to get catch2 out of the reports. How do you feel about adding `"*/fsfw_tests/*"` as well, seems to be a bit too meta to coverage the coverage tests.
Review

I actually installed catch2 and did not have that issue, I can add that directive. Adding the tests makes sense as well

I actually installed catch2 and did not have that issue, I can add that directive. Adding the tests makes sense as well
Review

Added the excludes

Added the excludes
Review

missing a leading * as in "*/catch2-src/*", as catch2 is stashed away somewhere by cmake.

missing a leading * as in `"*/catch2-src/*"`, as catch2 is stashed away somewhere by cmake.
Review

Done

Done
-ftest-coverage
)
# Need to specify this as an interface, otherwise there will the compile issues
target_link_options(${LIB_FSFW_NAME} INTERFACE
-fprofile-arcs
-ftest-coverage
)
if(WIN32)
setup_target_for_coverage_gcovr_html(
@ -302,3 +313,16 @@ target_compile_options(${LIB_FSFW_NAME} PRIVATE
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
${FSFW_ADDITIONAL_LINK_LIBS}
)
string(CONCAT POST_BUILD_COMMENT
"######################################################################\n"
Outdated
Review

And a small one, shouldn't this read "built FSFW [...]"

And a small one, shouldn't this read "*built* FSFW [...]"
"Building FSFW v${FSFW_VERSION}.${FSFW_SUBVERSION}.${FSFW_REVISION}, "
"Target OSAL: ${FSFW_OS_NAME}\n"
"######################################################################\n"
)
add_custom_command(
TARGET ${LIB_FSFW_NAME}
POST_BUILD
COMMENT ${POST_BUILD_COMMENT}
)