Skip to content

Commit

Permalink
fix: wrong overall coverage report dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
cuinixam committed Dec 4, 2023
1 parent 213aa3e commit f18b209
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ function(_spl_coverage_create_overall_report)
add_custom_command(
OUTPUT ${COV_OUT_VARIANT_HTML}
COMMAND gcovr --root ${CMAKE_SOURCE_DIR} --add-tracefile \"${CMAKE_CURRENT_BINARY_DIR}/**/coverage.json\" --html --html-details --output ${COV_OUT_VARIANT_HTML}
DEPENDS coverage
DEPENDS ${GLOBAL_COMPONENTS_COVERAGE_JSON_LIST}
COMMENT "Generating coverage overall report ${OUTPUT}..."
)
add_custom_target(
unittests
Expand All @@ -261,7 +262,7 @@ function(_spl_coverage_create_overall_report)
add_custom_target(
coverage_overall_report
ALL
DEPENDS coverage ${COV_OUT_VARIANT_HTML}
DEPENDS ${COV_OUT_VARIANT_HTML}
)
else(_SPL_COVERAGE_CREATE_OVERALL_REPORT_IS_NECESSARY)
add_custom_target(unittests)
Expand Down Expand Up @@ -318,6 +319,8 @@ macro(_spl_add_test_suite PROD_SRC TEST_SOURCES)
)

# Create coverage report
set(GLOBAL_COMPONENTS_COVERAGE_JSON_LIST "${GLOBAL_COMPONENTS_COVERAGE_JSON_LIST};${CMAKE_CURRENT_BINARY_DIR}/coverage.json" CACHE INTERNAL "List of all coverage.json files")

set(COV_OUT_JSON coverage.json)
add_custom_command(
OUTPUT ${COV_OUT_JSON}
Expand All @@ -326,13 +329,15 @@ macro(_spl_add_test_suite PROD_SRC TEST_SOURCES)
# Run gcovr to generate coverage json for the component
COMMAND gcovr --root ${CMAKE_SOURCE_DIR} --json --output ${COV_OUT_JSON} ${GCOVR_ADDITIONAL_OPTIONS} ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${TEST_OUT_JUNIT}
COMMENT "Generating component ${component_name} coverage json report ${COV_OUT_JSON}..."
)

set(COV_OUT_HTML reports/coverage/index.html)
add_custom_command(
OUTPUT ${COV_OUT_HTML}
COMMAND gcovr --root ${CMAKE_SOURCE_DIR} --add-tracefile ${COV_OUT_JSON} --html --html-details --output ${COV_OUT_HTML} ${GCOVR_ADDITIONAL_OPTIONS}
DEPENDS ${COV_OUT_JSON}
COMMENT "Generating component ${component_name} coverage html report ${COV_OUT_HTML}..."
)

add_custom_target(
Expand Down

0 comments on commit f18b209

Please sign in to comment.