Skip to content

Commit

Permalink
Fix #56, Update coverage compile/link flag options
Browse files Browse the repository at this point in the history
OSAL now sets these as UT_COVERAGE_COMPILE_FLAGS, UT_COVERAGE_LINK_FLAGS.
Building and linking the UT executable needs a corresponding update.
  • Loading branch information
jphickey authored and astrogeco committed May 1, 2020
1 parent 1e33c19 commit d2bae96
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ foreach(SRCFILE sample_app.c)
${UNIT_SOURCE_FILE}
)

# Apply the UT_C_FLAGS to the units under test
# Apply the UT_COVERAGE_COMPILE_FLAGS to the units under test
# This should enable coverage analysis on platforms that support this
set_target_properties(ut_${TESTNAME}_object PROPERTIES
COMPILE_FLAGS "${UT_C_FLAGS}")
target_compile_options(ut_${TESTNAME}_object PRIVATE ${UT_COVERAGE_COMPILE_FLAGS})

# Compile a test runner application, which contains the
# actual coverage test code (test cases) and the unit under test
Expand All @@ -56,13 +55,11 @@ foreach(SRCFILE sample_app.c)
$<TARGET_OBJECTS:ut_${TESTNAME}_object>
)

# This also needs to be linked with UT_C_FLAGS (for coverage)
set_target_properties(${TESTNAME}-testrunner PROPERTIES
LINK_FLAGS "${UT_C_FLAGS}")

# This also needs to be linked with UT_COVERAGE_LINK_FLAGS (for coverage)
# This is also linked with any other stub libraries needed,
# as well as the UT assert framework
target_link_libraries(${TESTNAME}-testrunner
${UT_COVERAGE_LINK_FLAGS}
ut_sample_lib_stubs
ut_cfe-core_stubs
ut_assert
Expand Down

0 comments on commit d2bae96

Please sign in to comment.